Skip to content

Commit

Permalink
Use numCells instead
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonarddeR committed Jan 21, 2025
1 parent 442f00f commit e51cfcc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
13 changes: 10 additions & 3 deletions source/braille.py
Original file line number Diff line number Diff line change
Expand Up @@ -2541,9 +2541,14 @@ def _set_displaySize(self, value):
_cache_displayDimensions = True

def _get_displayDimensions(self) -> DisplayDimensions:
if not self.display:
numRows = numCols = 0
else:
numRows = self.display.numRows
numCols = self.display.numCols if numRows > 1 else self.display.numCells
rawDisplayDimensions = DisplayDimensions(
numRows=self.display.numRows if self.display else 0,
numCols=self.display.numCols if self.display else 0,
numRows=numRows,
numCols=numCols,
)
filteredDisplayDimensions = filter_displayDimensions.apply(rawDisplayDimensions)
# Would be nice if there were a more official way to find out if the displaySize filter is currently registered by at least 1 handler.
Expand Down Expand Up @@ -3286,7 +3291,9 @@ class BrailleDisplayDriver(driverHandler.Driver):
containing a BrailleDisplayDriver class which inherits from this base class.
At a minimum, drivers must set L{name} and L{description} and override the L{check} method.
To display braille, L{numCols} and L{display} must be implemented.
To display braille, L{display} must be implemented.
For a single line display, L{numCells} must be implemented.
For a multi line display, L{numRows} and L{numCols} must be implemented.
To support automatic detection of braille displays belonging to this driver:
* The driver must be thread safe and L{isThreadSafe} should be set to C{True}
Expand Down
2 changes: 1 addition & 1 deletion source/brailleDisplayDrivers/ecoBraille.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def terminate(self):
self._dev.close()
self._dev = None

def _get_numCols(self):
def _get_numCells(self):
return self._ecoType

def display(self, cells: List[int]):
Expand Down
2 changes: 1 addition & 1 deletion source/brailleDisplayDrivers/hedoMobilLine.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class BrailleDisplayDriver(braille.BrailleDisplayDriver):
name = "hedoMobilLine"
description = "hedo MobilLine USB"

numCols = HEDO_MOBIL_CELL_COUNT
numCells = HEDO_MOBIL_CELL_COUNT

@classmethod
def check(cls):
Expand Down
2 changes: 1 addition & 1 deletion source/brailleDisplayDrivers/hedoProfiLine.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class BrailleDisplayDriver(braille.BrailleDisplayDriver):
name = "hedoProfiLine"
description = "hedo ProfiLine USB"

numCols = HEDO_CELL_COUNT
numCells = HEDO_CELL_COUNT

@classmethod
def check(cls):
Expand Down
4 changes: 3 additions & 1 deletion source/brailleDisplayDrivers/lilli.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ class BrailleDisplayDriver(braille.BrailleDisplayDriver):
name = "lilli"
# Translators: Name of a braille display.
description = _("MDV Lilli")
numRows: int = 40

@classmethod
def check(cls):
Expand All @@ -135,6 +134,9 @@ def terminate(self):
pass
lilliDll.Close408USB()

def _get_numCells(self) -> int:
return 40

def _handleKeyPresses(self):
while True:
key: Optional[int] = None
Expand Down
2 changes: 0 additions & 2 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ Instead, a `callback` property has been added, which returns a function that per
* Because SAPI5 voices now use `nvwave.WavePlayer` to output audio: (#17592, @gexgd0419)
* `synthDrivers.sapi5.SPAudioState` has been removed.
* `synthDrivers.sapi5.SynthDriver.ttsAudioStream` has been removed.
* Overriding `_get_numCells` on a `BrailleDisplayDriver` or setting `numCells` at the class level is no longer supported.
Either set `self.numCells` in an instance method explicitly, override `_get_numCols` or set `numCols`. (#17011)

#### Deprecations

Expand Down

0 comments on commit e51cfcc

Please sign in to comment.