Changeset 168:71af690e0c26 for src/mlx/gui
- Timestamp:
- 05/12/12 11:52:03 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/gui.py
r164 r168 152 152 self._lastLoadedPIREP = None 153 153 154 self._hotkeySetID = None 155 154 156 @property 155 157 def mainWindow(self): … … 320 322 self._wizard.connected(fsType, descriptor) 321 323 self._reconnecting = False 324 self._listenHotkeys() 322 325 323 326 def connectionFailed(self): … … 402 405 """Disconnect from the simulator if connected.""" 403 406 self.stopMonitoring() 407 self._clearHotkeys() 404 408 405 409 if self._connected: … … 875 879 def _editPreferences(self, menuItem): 876 880 """Callback for editing the preferences.""" 881 self._clearHotkeys() 877 882 self._preferences.run(self.config) 878 883 self._setupTimeSync() 884 self._listenHotkeys() 879 885 880 886 def _setupTimeSync(self): … … 1106 1112 if callback is not None: 1107 1113 callback(returned, result) 1114 1115 def _listenHotkeys(self): 1116 """Setup the hotkeys based on the configuration.""" 1117 if self._hotkeySetID is None and self._simulator is not None: 1118 self._hotkeySetID = \ 1119 self._simulator.listenHotkeys([self.config.pilotHotkey, 1120 self.config.checklistHotkey], 1121 self._handleHotkeys) 1122 1123 def _clearHotkeys(self): 1124 """Clear the hotkeys.""" 1125 if self._hotkeySetID is not None: 1126 self._hotkeySetID=None 1127 self._simulator.clearHotkeys() 1128 1129 def _handleHotkeys(self, id, hotkeys): 1130 """Handle the hotkeys.""" 1131 if id==self._hotkeySetID: 1132 print "gui.GUI._handleHotkeys", hotkeys -
src/mlx/gui/prefs.py
r167 r168 40 40 labelAlignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 41 41 xscale = 0.0, yscale = 0.0) 42 labelAlignment.set_padding(padding_top = 0, padding_bottom = 0, 43 padding_left = 0, padding_right = 4) 42 44 labelAlignment.add(label) 43 self.pack_start(labelAlignment, False, False, 8)45 self.pack_start(labelAlignment, False, False, 0) 44 46 45 47 self._ctrl = gtk.CheckButton("Ctrl") … … 54 56 55 57 self._hotkeyModel = gtk.ListStore(str) 56 for keyCode in range(ord("0"), ord("9") ) + range(ord("A"), ord("Z")):58 for keyCode in range(ord("0"), ord("9")+1) + range(ord("A"), ord("Z")+1): 57 59 self._hotkeyModel.append([chr(keyCode)]) 58 60
Note:
See TracChangeset
for help on using the changeset viewer.