1 from Components.Console import Console
2 from os import listdir as os_listdir, path as os_path
3 from re import compile as re_compile
8 self.readKeyboardMapFiles()
10 def readKeyboardMapFiles(self):
11 for keymapfile in os_listdir('/usr/share/keymaps/'):
12 if (keymapfile.endswith(".info")):
13 f = open('/usr/share/keymaps/' + keymapfile)
17 m = re_compile('^\s*(\w+)\s*=\s*(.*)\s*$').match(line)
24 if (mapfile is not None) and (mapname is not None):
25 self.keyboardmaps.append(( mapfile,mapname))
28 if len(self.keyboardmaps) == 0:
29 self.keyboardmaps = [('dream-de.kmap', 'Dreambox Keyboard Deutsch'), ('eng.kmap', 'Keyboard English')]
31 def activateKeyboardMap(self, index):
33 keymap = self.keyboardmaps[index]
34 print "Activating keymap:",keymap[1]
35 keymappath = '/usr/share/keymaps/' + keymap[0]
36 if os_path.exists(keymappath):
37 Console().ePopen(("loadkmap < " + str(keymappath)))
39 print "Selected keymap does not exist!"
41 def getKeyboardMaplist(self):
42 return self.keyboardmaps
44 def getDefaultKeyboardMap(self):