fix issue with GridVirtKeyboard usage while removing overkill optimization
This commit is contained in:
parent
00ce46ea0b
commit
be125cf84f
1 changed files with 4 additions and 9 deletions
|
|
@ -145,7 +145,10 @@ class VirtKeyboard(object):
|
|||
for i in self.md5:
|
||||
if md5sum == self.md5[i]:
|
||||
return i
|
||||
raise VirtKeyboardError('Symbol not found')
|
||||
raise VirtKeyboardError('Symbol not found for hash "%s".' % md5sum)
|
||||
|
||||
def get_string_code(self, string):
|
||||
return ''.join((self.get_symbol_code(self.symbols[c]) for c in string))
|
||||
|
||||
def check_symbols(self, symbols, dirname):
|
||||
# symbols: dictionary <symbol>:<md5 value>
|
||||
|
|
@ -229,11 +232,3 @@ class GridVirtKeyboard(VirtKeyboard):
|
|||
super(GridVirtKeyboard, self).__init__()
|
||||
|
||||
self.load_symbols(coords)
|
||||
|
||||
def load_symbols(self, coords):
|
||||
super(GridVirtKeyboard, self).load_symbols(coords)
|
||||
symbol_codes = map(self.get_symbol_code, self.symbols.itervalues())
|
||||
self._trans = maketrans(''.join(self.symbols), ''.join(symbol_codes))
|
||||
|
||||
def get_string_code(self, string):
|
||||
return str(string).translate(self._trans)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue