Skip to content

Commit

Permalink
Python 3 compatibility (NVDA >= 2019.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienCochuyt committed Feb 20, 2020
1 parent 42eee79 commit 411838b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
41 changes: 32 additions & 9 deletions addon/brailleDisplayDrivers/seikamini/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# 2019-04-23 (Accessolutions):
# - Repackaging as an NVDA add-on.
# - Amend driver description to mention newer models
# 2020-02-20 (Accessolutions):
# - Python 3 compatibility

from ctypes import *
import os
Expand All @@ -27,6 +29,20 @@
import winUser


try:
from six.moves import xrange
except ImportError:
# NVDA version < 2018.3
pass


try:
from addonAPIVersion import CURRENT as ADDON_API_VERSION
except ImportError:
# NVDA version < 2019.1
ADDON_API_VERSION = (0, 0, 0)


addonHandler.initTranslation()


Expand Down Expand Up @@ -120,8 +136,10 @@ def __init__(self):

# seikaDll.UpdateBrailleDisplay.errcheck=self.seika_errcheck
seikaDll.UpdateBrailleDisplay.restype=c_int
seikaDll.UpdateBrailleDisplay.argtype=(c_char_p,c_int)

if ADDON_API_VERSION >= (2019, 3):
seikaDll.UpdateBrailleDisplay.argtype = (POINTER(c_ubyte), c_int)
else:
seikaDll.UpdateBrailleDisplay.argtype = (c_char_p, c_int)
# seikaDll.GetBrailleKey.errcheck=self.seika_errcheck
seikaDll.GetBrailleKey.restype=c_int
seikaDll.GetBrailleKey.argtype=(c_void_p,c_void_p)
Expand Down Expand Up @@ -151,7 +169,7 @@ def __init__(self):
pN = port.split("COM")[1]
except IndexError:
pN = "0"
portNum = int(pN)
portNum = int(pN, 10)
log.info("seikamini test {c}, {b}".format(c=port, b=bName))

if seikaDll.BrailleOpen(0,portNum):
Expand All @@ -174,11 +192,16 @@ def terminate(self):
seikaDll.BrailleClose()

def display(self, cells):
# every transmitted line consists of the preamble SEIKA_SENDHEADER and the Cells
line = "".join(chr(cell) for cell in cells)
expectedLength = self.numCells
line += chr(0) * (expectedLength - len(line))
seikaDll.UpdateBrailleDisplay(line,self.numCells)
if ADDON_API_VERSION >= (2019, 3):
# cells will already be padded up to numCells.
cellBytes = bytes(cells)
seikaDll.UpdateBrailleDisplay(cellBytes,self.numCells)
else:
# every transmitted line consists of the preamble SEIKA_SENDHEADER and the Cells
line = "".join(chr(cell) for cell in cells)
expectedLength = self.numCells
line += chr(0) * (expectedLength - len(line))
seikaDll.UpdateBrailleDisplay(line,self.numCells)

def handleResponses(self):
pint = c_int * 1
Expand Down Expand Up @@ -209,7 +232,7 @@ def handleResponses(self):
if Key: # Mini Seika has no Btn ....
gesture = InputGesture(keys=Key)
if Btn: # Mini Seika has no Btn ....
gesture = InputGesture(keys=Btn)
gesture = InputGesture(keys=Btn)
if Brl: # or how to handle Brailleinput?
gesture = InputGesture(dots=Brl)
if Key or Btn or Brl:
Expand Down
4 changes: 2 additions & 2 deletions buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"addon_description" : _("""Repackaging by Accessolutions of the driver
provided by the manufacturer as an NVDA add-on."""),
# version
"addon_version" : "3.2.2019.1.1",
"addon_version" : "3.2.2019.3.1",
# Author(s)
"addon_author" : (
u"Accessolutions <contact@accessolutions.fr>, "
Expand All @@ -34,7 +34,7 @@
# Minimum NVDA version supported (e.g. "2018.3.0")
"addon_minimumNVDAVersion" : "2012.2",
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
"addon_lastTestedNVDAVersion" : "2019.1.1",
"addon_lastTestedNVDAVersion" : "2019.3.1",
# Add-on update channel (default is stable or None)
"addon_updateChannel" : None,
}
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
- Copyright (C) 2019 Accessolutions <contact@accessolutions.fr>

## Release Dates
- Seika notetakers driver NVDA add-on v3.2.2019.3.1 - February 20, 2020
- Seika notetakers driver NVDA add-on v3.2.2019.1.1 - April 23, 2019
- Seika Patch for NVDA v3.2 - July 10, 2017
- Seika Patch for NVDA v3.1 - July 6, 2017
- Seika Patch for NVDA v3.0 - June 12, 2017
- Seika Patch for NVDA v2.0 - April 23, 2017

## Version 3.2.2019.3.1
Python 3 compatibility

## Version 3.2.2019.1.1
Repackaging by Accessolutions as an NVDA add-on.

Expand Down

0 comments on commit 411838b

Please sign in to comment.