Changes to keystrokes are reflected in keystroke editor automatically

This commit is contained in:
Manuel Cortez 2016-10-09 09:03:21 -05:00
parent 656b031c5c
commit 32dd232350
2 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,7 @@ class KeystrokeEditor(object):
if new_keystroke != self.map[action]: if new_keystroke != self.map[action]:
self.changed = True self.changed = True
self.map[action] = new_keystroke self.map[action] = new_keystroke
self.dialog.put_keystrokes(constants.actions, self.map)
def set_keystroke(self, keystroke, dialog): def set_keystroke(self, keystroke, dialog):
for i in keystroke.split("+"): for i in keystroke.split("+"):

View File

@ -29,6 +29,8 @@ class keystrokeEditorDialog(baseDialog.BaseWXDialog):
self.SetClientSize(sizer.CalcMin()) self.SetClientSize(sizer.CalcMin())
def put_keystrokes(self, actions, keystrokes): def put_keystrokes(self, actions, keystrokes):
selection = self.keys.get_selected()
self.keys.clear()
for i in keystrokes: for i in keystrokes:
if actions.has_key(i) == False: if actions.has_key(i) == False:
continue continue
@ -36,6 +38,7 @@ class keystrokeEditorDialog(baseDialog.BaseWXDialog):
self.actions.append(i) self.actions.append(i)
keystroke = keystrokes[i] keystroke = keystrokes[i]
self.keys.insert_item(False, *[action, keystroke]) self.keys.insert_item(False, *[action, keystroke])
self.keys.select_item(selection)
def get_action(self): def get_action(self):
return self.keys.get_selected() return self.keys.get_selected()