Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions source/brailleInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#: @type: int
UNICODE_BRAILLE_START = 0x2800
#: The Unicode braille character to use when masking cells in protected fields.
#: @type: unicode
#: @type: str
UNICODE_BRAILLE_PROTECTED = u"⣿" # All dots down

#: The singleton BrailleInputHandler instance.
Expand Down Expand Up @@ -82,7 +82,7 @@ def __init__(self):
#: or were translated but did not produce any text.
#: This is used to show these cells to the user while they're entering braille.
#: This is a string of Unicode braille.
#: @type: unicode
#: @type: str
self.untranslatedBraille = ""
#: The position in L{brailleBuffer} where untranslated braille begins.
self.untranslatedStart = 0
Expand Down Expand Up @@ -126,7 +126,7 @@ def _translate(self, endWord):
self.bufferText = u""
oldTextLen = len(self.bufferText)
pos = self.untranslatedStart + self.untranslatedCursorPos
data = u"".join([unichr(cell | LOUIS_DOTS_IO_START) for cell in self.bufferBraille[:pos]])
data = u"".join([chr(cell | LOUIS_DOTS_IO_START) for cell in self.bufferBraille[:pos]])
mode = louis.dotsIO | louis.noUndefinedDots
if (not self.currentFocusIsTextObj or self.currentModifiers) and self._table.contracted:
mode |= louis.partialTrans
Expand Down Expand Up @@ -175,10 +175,10 @@ def _translate(self, endWord):
def _translateForReportContractedCell(self, pos):
"""Translate text for current input as required by L{_reportContractedCell}.
@return: The previous translated text.
@rtype: unicode
@rtype: str
"""
cells = self.bufferBraille[:pos + 1]
data = u"".join([unichr(cell | LOUIS_DOTS_IO_START) for cell in cells])
data = u"".join([chr(cell | LOUIS_DOTS_IO_START) for cell in cells])
oldText = self.bufferText
text = louis.backTranslate(
[os.path.join(brailleTables.TABLES_DIR, self._table.fileName),
Expand Down Expand Up @@ -293,7 +293,7 @@ def _updateUntranslated(self):
if api.isTypingProtected():
self.untranslatedBraille = UNICODE_BRAILLE_PROTECTED * (len(self.bufferBraille) - self.untranslatedStart)
else:
self.untranslatedBraille = "".join([unichr(UNICODE_BRAILLE_START + dots) for dots in self.bufferBraille[self.untranslatedStart:]])
self.untranslatedBraille = "".join([chr(UNICODE_BRAILLE_START + dots) for dots in self.bufferBraille[self.untranslatedStart:]])

def updateDisplay(self):
"""Update the braille display to reflect untranslated input.
Expand Down Expand Up @@ -385,7 +385,7 @@ def emulateKey(self, key, withModifiers=True):
def sendChars(self, chars):
"""Sends the provided unicode characters to the system.
@param chars: The characters to send to the system.
@type chars: unicode
@type chars: str
"""
inputs = []
for ch in chars:
Expand Down Expand Up @@ -475,6 +475,7 @@ def _get_identifiers(self):

@classmethod
def _makeDisplayText(cls, dots, space):
out = ""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is a safety guard so that we won't get an UnboundLocalError?

if space and dots:
# Translators: Reported when braille space is pressed with dots in input help mode.
out = _("space with dot")
Expand All @@ -495,6 +496,7 @@ def _get_displayName(self):

@classmethod
def getDisplayTextForIdentifier(cls, identifier):
assert isinstance(identifier, str)
# Translators: Used when describing keys on a braille keyboard.
source = _("braille keyboard")
if identifier == cls.GENERIC_ID_SPACE_DOTS:
Expand Down