Changeset 858:1f655516b7ae for src/mlx/gui
- Timestamp:
- 06/08/17 18:36:07 (7 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/common.py
r852 r858 106 106 107 107 SELECTION_MULTIPLE = gtk.SELECTION_MULTIPLE 108 109 WINDOW_POPUP = gtk.WINDOW_POPUP 108 110 109 111 pixbuf_new_from_file = gdk.pixbuf_new_from_file … … 549 551 #------------------------------------------------------------------------------ 550 552 553 aircraftFamilyNames = { 554 _const.AIRCRAFT_FAMILY_B737NG: xstr("aircraft_family_b737ng"), 555 556 _const.AIRCRAFT_FAMILY_B737CL: xstr("aircraft_family_b737cl"), 557 558 _const.AIRCRAFT_FAMILY_DH8D: xstr("aircraft_family_dh8d"), 559 560 _const.AIRCRAFT_FAMILY_B767: xstr("aircraft_family_b767"), 561 562 _const.AIRCRAFT_FAMILY_CRJ2: xstr("aircraft_family_crj2"), 563 564 _const.AIRCRAFT_FAMILY_F70: xstr("aircraft_family_f70"), 565 566 _const.AIRCRAFT_FAMILY_DC3: xstr("aircraft_family_dc3"), 567 568 _const.AIRCRAFT_FAMILY_T134: xstr("aircraft_family_t134"), 569 570 _const.AIRCRAFT_FAMILY_T154: xstr("aircraft_family_t154"), 571 572 _const.AIRCRAFT_FAMILY_YK40: xstr("aircraft_family_yk40"), 573 574 _const.AIRCRAFT_FAMILY_B462: xstr("aircraft_family_b462") 575 } 576 577 #------------------------------------------------------------------------------ 578 551 579 def formatFlightLogLine(timeStr, line): 552 580 """Format the given flight log line.""" -
src/mlx/gui/flightlist.py
r857 r858 42 42 43 43 @param index is the 0-based index of the column.""" 44 column = gtk.TreeViewColumn(self._heading, self._renderer, 45 text = index) 44 if isinstance(self._renderer, gtk.CellRendererText): 45 column = gtk.TreeViewColumn(self._heading, self._renderer, 46 text = index) 47 elif isinstance(self._renderer, gtk.CellRendererToggle): 48 column = gtk.TreeViewColumn(self._heading, self._renderer, 49 active = index) 50 else: 51 column = gtk.TreeViewColumn(self._heading, self._renderer) 46 52 column.set_expand(True) 47 53 if self._sortable: -
src/mlx/gui/gui.py
r855 r858 17 17 from mlx.gui.bugreport import BugReportDialog 18 18 from mlx.gui.acars import ACARS 19 from mlx.gui.timetable import TimetableWindow 19 20 import cef 20 21 … … 120 121 121 122 self._preferences = Preferences(self) 123 self._timetableWindow = TimetableWindow(self) 124 self._timetableWindow.connect("delete-event", self._hideTimetableWindow) 122 125 self._flightsWindow = AcceptedFlightsWindow(self) 123 126 self._flightsWindow.connect("delete-event", self._hideFlightsWindow) … … 1063 1066 toolsMenuItem.set_submenu(toolsMenu) 1064 1067 menuBar.append(toolsMenuItem) 1068 1069 self._timetableMenuItem = timetableMenuItem = \ 1070 gtk.ImageMenuItem(gtk.STOCK_INDENT) 1071 timetableMenuItem.set_use_stock(True) 1072 timetableMenuItem.set_label(xstr("menu_tools_timetable")) 1073 timetableMenuItem.add_accelerator("activate", accelGroup, 1074 ord(xstr("menu_tools_timetable_key")), 1075 CONTROL_MASK, ACCEL_VISIBLE) 1076 timetableMenuItem.connect("activate", self.showTimetable) 1077 self._timetableMenuItem.set_sensitive(False) 1078 toolsMenu.append(timetableMenuItem) 1065 1079 1066 1080 self._flightsMenuItem = flightsMenuItem = \ … … 1240 1254 """Called when the login is successful.""" 1241 1255 self._flightsMenuItem.set_sensitive(True) 1256 self._timetableMenuItem.set_sensitive(True) 1242 1257 1243 1258 def isWizardActive(self): 1244 1259 """Determine if the flight wizard is active.""" 1245 1260 return self._notebook.get_current_page()==0 1261 1262 def showTimetable(self, menuItem): 1263 """Callback for showing the timetable.""" 1264 if self._timetableWindow.hasFlightPairs: 1265 self._timetableWindow.show_all() 1266 else: 1267 date = datetime.date.today() 1268 self._timetableWindow.setTypes(self.loginResult.types) 1269 self._timetableWindow.setDate(date) 1270 self.updateTimeTable(date) 1271 self.beginBusy(xstr("timetable_query_busy")) 1272 1273 def updateTimeTable(self, date): 1274 """Update the time table for the given date.""" 1275 self.beginBusy(xstr("timetable_query_busy")) 1276 self._timetableWindow.set_sensitive(False) 1277 window = self._timetableWindow.get_window() 1278 if window is not None: 1279 window.set_cursor(self._busyCursor) 1280 self.webHandler.getTimetable(self._timetableCallback, date, 1281 self.loginResult.types) 1282 1283 def _timetableCallback(self, returned, result): 1284 """Called when the timetable has been received.""" 1285 gobject.idle_add(self._handleTimetable, returned, result) 1286 1287 def _handleTimetable(self, returned, result): 1288 """Handle the result of the query for the timetable.""" 1289 self.endBusy() 1290 window = self._timetableWindow.get_window() 1291 if window is not None: 1292 window.set_cursor(None) 1293 self._timetableWindow.set_sensitive(True) 1294 if returned: 1295 self._timetableWindow.setFlightPairs(result.flightPairs) 1296 self._timetableWindow.show_all() 1297 else: 1298 dialog = gtk.MessageDialog(parent = self.mainWindow, 1299 type = MESSAGETYPE_ERROR, 1300 message_format = xstr("timetable_failed")) 1301 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK) 1302 dialog.set_title(WINDOW_TITLE_BASE) 1303 dialog.run() 1304 dialog.hide() 1305 self._timetableWindow.clear() 1246 1306 1247 1307 def showFlights(self, menuItem): … … 1273 1333 dialog.run() 1274 1334 dialog.hide() 1335 1336 def _hideTimetableWindow(self, window, event): 1337 """Hide the window of the timetable.""" 1338 self._timetableWindow.hide() 1339 return True 1275 1340 1276 1341 def _hideFlightsWindow(self, window, event):
Note:
See TracChangeset
for help on using the changeset viewer.