|
8 | 8 | import braille |
9 | 9 | import brailleInput |
10 | 10 | import inputCore |
11 | | -import versionInfo |
12 | 11 | from brailleViewer import postBrailleViewerToolToggledAction |
13 | 12 | from hwIo import IoThread, intToByte |
14 | 13 | from logHandler import log |
|
24 | 23 | protocol = addon.loadModule("lib.protocol") |
25 | 24 |
|
26 | 25 |
|
27 | | -_supportsDisplayDimensions = versionInfo.version_year >= 2025 |
28 | | - |
29 | | - |
30 | 26 | class RemoteBrailleHandler(RemoteHandler[braille.BrailleDisplayDriver]): |
31 | 27 | driverType = protocol.DriverType.BRAILLE |
32 | 28 | _queuedWrite: list[int] | None = None |
@@ -57,21 +53,19 @@ def _outgoing_numCells(self, numCells=None) -> bytes: |
57 | 53 | numCells = braille.handler.displaySize |
58 | 54 | return intToByte(numCells) |
59 | 55 |
|
60 | | - if _supportsDisplayDimensions: |
61 | | - |
62 | | - @protocol.attributeSender(protocol.BrailleAttribute.NUM_COLS) |
63 | | - def _outgoing_numCols(self, numCols=None) -> bytes: |
64 | | - if numCols is None: |
65 | | - # Use the display dimensions of the local braille handler |
66 | | - numCols = braille.handler.displayDimensions.numCols |
67 | | - return intToByte(numCols) |
| 56 | + @protocol.attributeSender(protocol.BrailleAttribute.NUM_COLS) |
| 57 | + def _outgoing_numCols(self, numCols=None) -> bytes: |
| 58 | + if numCols is None: |
| 59 | + # Use the display dimensions of the local braille handler |
| 60 | + numCols = braille.handler.displayDimensions.numCols |
| 61 | + return intToByte(numCols) |
68 | 62 |
|
69 | | - @protocol.attributeSender(protocol.BrailleAttribute.NUM_ROWS) |
70 | | - def _outgoing_numRows(self, numRows=None) -> bytes: |
71 | | - if numRows is None: |
72 | | - # Use the display dimensions of the local braille handler |
73 | | - numRows = braille.handler.displayDimensions.numRows |
74 | | - return intToByte(numRows) |
| 63 | + @protocol.attributeSender(protocol.BrailleAttribute.NUM_ROWS) |
| 64 | + def _outgoing_numRows(self, numRows=None) -> bytes: |
| 65 | + if numRows is None: |
| 66 | + # Use the display dimensions of the local braille handler |
| 67 | + numRows = braille.handler.displayDimensions.numRows |
| 68 | + return intToByte(numRows) |
75 | 69 |
|
76 | 70 | @protocol.attributeSender(protocol.BrailleAttribute.GESTURE_MAP) |
77 | 71 | def _outgoing_gestureMap(self, gestureMap: inputCore.GlobalGestureMap | None = None) -> bytes: |
@@ -138,9 +132,8 @@ def _handleDriverChanged(self, display: braille.BrailleDisplayDriver): |
138 | 132 |
|
139 | 133 | def _handleDisplayDimensionChanges(self): |
140 | 134 | self._attributeSenderStore(protocol.BrailleAttribute.NUM_CELLS) |
141 | | - if _supportsDisplayDimensions: |
142 | | - self._attributeSenderStore(protocol.BrailleAttribute.NUM_COLS) |
143 | | - self._attributeSenderStore(protocol.BrailleAttribute.NUM_ROWS) |
| 135 | + self._attributeSenderStore(protocol.BrailleAttribute.NUM_COLS) |
| 136 | + self._attributeSenderStore(protocol.BrailleAttribute.NUM_ROWS) |
144 | 137 |
|
145 | 138 | def _handleNotifications(self, connected: bool): |
146 | 139 | if not braille.handler.enabled: |
|
0 commit comments