Changeset 347:175e29566656 for src/mlx/gui
- Timestamp:
- 12/08/12 15:50:51 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r309 r347 66 66 67 67 alignment = gtk.Alignment(xalign = 0.0, xscale = 0.0) 68 68 69 69 titleLabel = gtk.Label(title) 70 70 titleLabel.modify_font(pango.FontDescription("bold 24")) 71 71 alignment.set_padding(padding_top = 4, padding_bottom = 4, 72 72 padding_left = 6, padding_right = 0) 73 73 74 74 alignment.add(titleLabel) 75 75 eventBox.add(alignment) 76 76 77 77 self._vbox.pack_start(eventBox, False, False, 0) 78 78 … … 80 80 self._titleLabel = titleLabel 81 81 82 mainBox = gtk.VBox() 82 mainBox = gtk.VBox() 83 83 84 84 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.0, 85 xscale = 1.0, yscale = 1.0) 85 xscale = 1.0, yscale = 1.0) 86 86 alignment.set_padding(padding_top = 16, padding_bottom = 16, 87 87 padding_left = 16, padding_right = 16) 88 88 alignment.add(mainBox) 89 89 self._vbox.pack_start(alignment, True, True, 0) 90 90 91 91 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.0, 92 92 xscale = 0.0, yscale = 0.0) … … 102 102 else: 103 103 longerHelp = completedHelp 104 104 105 105 self._helpLabel = gtk.Label(completedHelp) 106 106 # FIXME: should be a constant in common … … 114 114 xscale = 1.0, yscale = 1.0) 115 115 mainBox.pack_start(self._mainAlignment, True, True, 0) 116 116 117 117 buttonAlignment = gtk.Alignment(xalign = 1.0, xscale=0.0, yscale = 0.0) 118 118 buttonAlignment.set_padding(padding_top = 4, padding_bottom = 10, … … 187 187 self._titleEventBox.modify_bg(0, style.bg[3]) 188 188 self._titleLabel.modify_fg(0, style.fg[3]) 189 189 190 190 def initialize(self): 191 191 """Initialize the page. … … 232 232 """Go to the page we were invoked from.""" 233 233 assert self._fromPage is not None 234 234 235 235 self._wizard.setCurrentPage(self._fromPage, finalize = False) 236 236 … … 245 245 """Called when the Cancel flight button is clicked.""" 246 246 self._wizard.gui.cancelFlight() 247 247 248 248 #----------------------------------------------------------------------------- 249 249 … … 328 328 self._password.set_text(config.password) 329 329 self._rememberButton.set_active(config.rememberPassword) 330 self._setControls(None) 330 self._setControls(None) 331 331 332 332 def _setControls(self, entry = None): … … 372 372 config.pilotID = self._pilotID.get_text() 373 373 374 rememberPassword = self._rememberButton.get_active() 374 rememberPassword = self._rememberButton.get_active() 375 375 config.password = result.password if rememberPassword else "" 376 376 … … 386 386 def __init__(self, wizard): 387 387 """Construct the flight selection page.""" 388 help = xstr("flightsel_help") 388 help = xstr("flightsel_help") 389 389 completedHelp = xstr("flightsel_chelp") 390 390 super(FlightSelectionPage, self).__init__(wizard, xstr("flightsel_title"), … … 416 416 417 417 flightSelection = self._flightList.get_selection() 418 flightSelection.connect("changed", self._selectionChanged) 418 flightSelection.connect("changed", self._selectionChanged) 419 419 420 420 scrolledWindow = gtk.ScrolledWindow() … … 450 450 self._loadButton.connect("clicked", self._loadButtonClicked) 451 451 self._loadDialog = None 452 452 453 453 self._button = self.addNextButton(sensitive = False, 454 454 clicked = self._forwardClicked) … … 462 462 self._refreshButton.set_sensitive(self._wizard.loggedIn) 463 463 self._buildFlights() 464 464 465 465 def finalize(self): 466 466 """Finalize the page.""" … … 521 521 dialog.run() 522 522 dialog.hide() 523 523 524 524 def _refreshClicked(self, button): 525 525 """Called when the refresh button is clicked.""" … … 551 551 with open(fileName, "rt") as f: 552 552 bookedFlight.readFromFile(f) 553 self._addFlight(bookedFlight) 553 self._addFlight(bookedFlight) 554 554 except Exception, e: 555 555 print "Failed to load flight:", str(e) … … 563 563 dialog.format_secondary_markup(secondary) 564 564 dialog.run() 565 dialog.hide() 566 565 dialog.hide() 566 567 567 def _forwardClicked(self, button): 568 568 """Called when the forward button was clicked.""" … … 582 582 self._wizard._bookedFlight = flight 583 583 self._wizard.gui.enableFlightInfo() 584 584 585 585 self._updateDepartureGate() 586 586 … … 591 591 path = listStore.get_path(iter) 592 592 [index] = path.get_indices() if pygobject else path 593 593 594 594 return self._flights[index] 595 595 … … 610 610 else: 611 611 menu.popup(None, None, None, event.button, event.time) 612 612 613 613 def _updateDepartureGate(self): 614 614 """Update the departure gate for the booked flight.""" … … 625 625 self._nextDistance = 2 626 626 self._wizard.jumpPage(2) 627 627 628 628 def _fleetRetrieved(self, fleet): 629 629 """Called when the fleet has been retrieved.""" … … 654 654 if self._saveDialog is not None: 655 655 return self._saveDialog 656 656 657 657 gui = self._wizard.gui 658 658 dialog = gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + … … 663 663 gtk.STOCK_OK, RESPONSETYPE_OK), 664 664 parent = gui.mainWindow) 665 dialog.set_modal(True) 665 dialog.set_modal(True) 666 666 dialog.set_do_overwrite_confirmation(True) 667 667 … … 670 670 filter.add_pattern("*.vaflight") 671 671 dialog.add_filter(filter) 672 672 673 673 filter = gtk.FileFilter() 674 674 filter.set_name(xstr("file_filter_all")) … … 677 677 678 678 self._saveDialog = dialog 679 680 return dialog 681 679 680 return dialog 681 682 682 def _getLoadDialog(self): 683 683 """Get the dialog to load a flight file.""" 684 684 if self._loadDialog is not None: 685 685 return self._loadDialog 686 686 687 687 gui = self._wizard.gui 688 688 dialog = gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + … … 693 693 gtk.STOCK_OK, RESPONSETYPE_OK), 694 694 parent = gui.mainWindow) 695 dialog.set_modal(True) 695 dialog.set_modal(True) 696 696 697 697 filter = gtk.FileFilter() … … 699 699 filter.add_pattern("*.vaflight") 700 700 dialog.add_filter(filter) 701 701 702 702 filter = gtk.FileFilter() 703 703 filter.set_name(xstr("file_filter_all")) … … 706 706 707 707 self._loadDialog = dialog 708 709 return dialog 708 709 return dialog 710 710 711 711 def _getListPopupMenu(self): … … 721 721 722 722 menu.append(menuItem) 723 723 724 724 menuItem = gtk.MenuItem() 725 725 menuItem.set_label(xstr("flightsel_popup_save")) … … 738 738 if not self._completed: 739 739 self._flightSelected() 740 740 741 741 def _popupSave(self, menuItem): 742 742 """Called when the Save menu item is activated in the popup menu.""" 743 743 if not self._completed: 744 744 self._saveSelected() 745 745 746 746 #----------------------------------------------------------------------------- 747 747 … … 753 753 super(GateSelectionPage, self).__init__(wizard, xstr("gatesel_title"), 754 754 xstr("gatesel_help")) 755 755 756 756 self._listStore = gtk.ListStore(str) 757 757 self._gateList = gtk.TreeView(self._listStore) … … 779 779 alignment.add(scrolledWindow) 780 780 781 self.setMainWidget(alignment) 781 self.setMainWidget(alignment) 782 782 783 783 self.addCancelFlightButton() 784 784 785 785 self.addPreviousButton(clicked = self._backClicked) 786 786 787 787 self._button = self.addNextButton(sensitive = False, 788 788 clicked = self._forwardClicked) … … 831 831 self._wizard.updatePlane(self._planeUpdated, 832 832 self._wizard._bookedFlight.tailNumber, 833 const.PLANE_HOME, gateNumber) 833 const.PLANE_HOME, gateNumber) 834 834 835 835 def _planeUpdated(self, success): … … 855 855 else: 856 856 self.activate() 857 857 858 858 #----------------------------------------------------------------------------- 859 859 … … 869 869 xstr("connect_help"), 870 870 completedHelp = xstr("connect_chelp")) 871 871 872 872 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 873 873 xscale = 0.0, yscale = 0.0) … … 962 962 aircraftType = aircraftNames[bookedFlight.aircraftType] 963 963 self._aircraft.set_markup("<b>" + aircraftType + "</b>") 964 964 965 965 self._tailNumber.set_markup("<b>" + bookedFlight.tailNumber + "</b>") 966 966 … … 1023 1023 table.attach(self._numCrew, 1, 2, 0, 1) 1024 1024 label.set_mnemonic_widget(self._numCrew) 1025 1025 1026 1026 label = gtk.Label(xstr("payload_pax")) 1027 1027 label.set_use_underline(True) … … 1029 1029 table.attach(label, 0, 1, 1, 2) 1030 1030 1031 self._numPassengers = IntegerEntry(defaultValue = 0) 1031 self._numPassengers = IntegerEntry(defaultValue = 0) 1032 1032 self._numPassengers.set_width_chars(6) 1033 1033 self._numPassengers.connect("integer-changed", self._weightChanged) … … 1035 1035 table.attach(self._numPassengers, 1, 2, 1, 2) 1036 1036 label.set_mnemonic_widget(self._numPassengers) 1037 1037 1038 1038 label = gtk.Label(xstr("payload_bag")) 1039 1039 label.set_use_underline(True) … … 1049 1049 1050 1050 table.attach(gtk.Label("kg"), 2, 3, 2, 3) 1051 1051 1052 1052 label = gtk.Label(xstr("payload_cargo")) 1053 1053 label.set_use_underline(True) … … 1063 1063 1064 1064 table.attach(gtk.Label("kg"), 2, 3, 3, 4) 1065 1065 1066 1066 label = gtk.Label(xstr("payload_mail")) 1067 1067 label.set_use_underline(True) … … 1077 1077 1078 1078 table.attach(gtk.Label("kg"), 2, 3, 4, 5) 1079 1079 1080 1080 label = gtk.Label("<b>" + xstr("payload_zfw") + "</b>") 1081 1081 label.set_alignment(0.0, 0.5) … … 1112 1112 """The number of the crew members on the flight.""" 1113 1113 return self._numCrew.get_int() 1114 1114 1115 1115 @property 1116 1116 def numPassengers(self): 1117 1117 """The number of the passengers on the flight.""" 1118 1118 return self._numPassengers.get_int() 1119 1119 1120 1120 @property 1121 1121 def bagWeight(self): … … 1148 1148 self._mailWeight.set_int(bookedFlight.mailWeight) 1149 1149 self._mailWeight.set_sensitive(True) 1150 1150 1151 1151 self._simulatorZFW.set_text("-") 1152 1152 self._simulatorZFWValue = None … … 1171 1171 zfw += self._mailWeight.get_int() 1172 1172 return zfw 1173 1173 1174 1174 def _updateCalculatedZFW(self): 1175 1175 """Update the calculated ZFW""" … … 1187 1187 """Called when one of the weight values or humanm counts has changed.""" 1188 1188 self._updateCalculatedZFW() 1189 1189 1190 1190 def _zfwRequested(self, button): 1191 1191 """Called when the ZFW is requested from the simulator.""" … … 1218 1218 """Called when the Back button is pressed.""" 1219 1219 self.goBack() 1220 1220 1221 1221 #----------------------------------------------------------------------------- 1222 1222 … … 1246 1246 self._departure.set_alignment(0.0, 0.5) 1247 1247 table.attach(self._departure, 1, 2, 0, 1) 1248 1248 1249 1249 label = gtk.Label(xstr("time_arrival")) 1250 1250 label.set_alignment(0.0, 0.5) … … 1319 1319 """Called when the Back button is pressed.""" 1320 1320 self.goBack() 1321 1321 1322 1322 def _forwardClicked(self, button): 1323 1323 """Called when the forward button is clicked.""" … … 1325 1325 gui = self._wizard.gui 1326 1326 gui.beginBusy(xstr("fuel_get_busy")) 1327 1327 1328 1328 gui.simulator.getFuel(self._handleFuel) 1329 1329 else: … … 1339 1339 self._wizard._fuelData = fuelData 1340 1340 self._wizard.nextPage() 1341 1341 1342 1342 #----------------------------------------------------------------------------- 1343 1343 … … 1373 1373 self._tankFigure.connect("motion_notify_event", self._motionNotify) 1374 1374 self._tankFigure.connect("scroll-event", self._scrolled) 1375 1375 1376 1376 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 1377 1377 xscale = 0.0, yscale = 1.0) … … 1393 1393 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 1394 1394 xscale = 0.0, yscale = 1.0) 1395 alignment.add(self._expectedButton) 1395 alignment.add(self._expectedButton) 1396 1396 self.pack_start(alignment, False, False, 4) 1397 1397 … … 1421 1421 (xOffset, yOffset) = (0, 0) if pygobject \ 1422 1422 else (tankFigure.allocation.x, tankFigure.allocation.y) 1423 1423 1424 1424 width = tankFigure.get_allocated_width() if pygobject \ 1425 1425 else tankFigure.allocation.width … … 1489 1489 level = min(1.0, max(0.0, level)) 1490 1490 self._expectedButton.set_value(level * self.capacity) 1491 1491 1492 1492 def _buttonPressed(self, tankFigure, event): 1493 1493 """Called when a button is pressed in the figure. … … 1496 1496 if self._enabled and event.button==1: 1497 1497 self._setExpectedFromY(event.y) 1498 1498 1499 1499 def _motionNotify(self, tankFigure, event): 1500 1500 """Called when the mouse pointer moves within the area of a tank figure.""" 1501 if self._enabled and event.state==BUTTON1_MASK: 1501 if self._enabled and event.state==BUTTON1_MASK: 1502 1502 self._setExpectedFromY(event.y) 1503 1503 … … 1512 1512 increment *= -1 1513 1513 self._expectedButton.spin(SPIN_USER_DEFINED, increment) 1514 1514 1515 1515 def _expectedChanged(self, spinButton): 1516 1516 """Called when the expected value has changed.""" 1517 1517 self.expectedWeight = spinButton.get_value_as_int() 1518 self._redraw() 1518 self._redraw() 1519 1519 1520 1520 #----------------------------------------------------------------------------- … … 1523 1523 """The page containing the fuel tank filling.""" 1524 1524 _pumpStep = 0.02 1525 1525 1526 1526 def __init__(self, wizard): 1527 1527 """Construct the page.""" … … 1558 1558 """Called when the Back button is pressed.""" 1559 1559 self.goBack() 1560 1560 1561 1561 def _forwardClicked(self, button): 1562 1562 """Called when the forward button is clicked.""" … … 1566 1566 self._pump() 1567 1567 else: 1568 self._wizard.nextPage() 1568 self._wizard.nextPage() 1569 1569 1570 1570 def _setupTanks(self, tankData): … … 1586 1586 self._fuelTanks.append(fuelTank) 1587 1587 index += 1 1588 1588 1589 1589 self._fuelAlignment.add(self._fuelTable) 1590 1590 self.show_all() … … 1624 1624 currentLevel)]) 1625 1625 gobject.timeout_add(50, self._pump) 1626 1626 1627 1627 #----------------------------------------------------------------------------- 1628 1628 … … 1694 1694 1695 1695 label.set_mnemonic_widget(self._route) 1696 routeBox.pack_start(routeWindow, True, True, 0) 1696 routeBox.pack_start(routeWindow, True, True, 0) 1697 1697 1698 1698 mainBox.pack_start(routeBox, True, True, 8) … … 1700 1700 self.addCancelFlightButton() 1701 1701 1702 self._backButton = self.addPreviousButton(clicked = self._backClicked) 1702 self._backButton = self.addPreviousButton(clicked = self._backClicked) 1703 1703 self._button = self.addNextButton(clicked = self._forwardClicked) 1704 1704 … … 1735 1735 self._button.set_sensitive(self._cruiseLevel.get_value_as_int()>=50 and \ 1736 1736 self._getRoute()!="") 1737 1737 1738 1738 def _cruiseLevelChanged(self, spinButton): 1739 1739 """Called when the cruise level has changed.""" … … 1764 1764 """Called when the Back button is pressed.""" 1765 1765 self.goBack() 1766 1766 1767 1767 def _forwardClicked(self, button): 1768 1768 """Called when the Forward button is clicked.""" … … 1824 1824 """Construct the briefing page.""" 1825 1825 self._departure = departure 1826 1826 1827 1827 title = xstr("briefing_title") % (1 if departure else 2, 1828 1828 xstr("briefing_departure") … … 1860 1860 self._notamsFrame.add(alignment) 1861 1861 mainBox.pack_start(self._notamsFrame, True, True, 4) 1862 1862 1863 1863 self._metarFrame = gtk.Frame() 1864 1864 self._metarFrame.set_label(xstr("briefing_metar_init")) … … 1897 1897 buffer = self._metar.get_buffer() 1898 1898 return buffer.get_text(buffer.get_start_iter(), 1899 buffer.get_end_iter(), True) 1899 buffer.get_end_iter(), True) 1900 1900 1901 1901 def setMETAR(self, metar): … … 1957 1957 """Called when the Back button is pressed.""" 1958 1958 self.goBack() 1959 1959 1960 1960 def _forwardClicked(self, button): 1961 1961 """Called when the forward button is clicked.""" … … 2025 2025 table.attach(self._runway, 1, 3, 0, 1) 2026 2026 label.set_mnemonic_widget(self._runway) 2027 2027 2028 2028 label = gtk.Label(xstr("takeoff_sid")) 2029 2029 label.set_use_underline(True) … … 2037 2037 table.attach(self._sid, 1, 3, 1, 2) 2038 2038 label.set_mnemonic_widget(self._sid) 2039 2039 2040 2040 label = gtk.Label(xstr("takeoff_v1")) 2041 2041 label.set_use_markup(True) … … 2053 2053 self._v1Unit = gtk.Label(xstr("label_knots")) 2054 2054 table.attach(self._v1Unit, 3, 4, 2, 3) 2055 2055 2056 2056 label = gtk.Label(xstr("takeoff_vr")) 2057 2057 label.set_use_markup(True) … … 2066 2066 table.attach(self._vr, 2, 3, 3, 4) 2067 2067 label.set_mnemonic_widget(self._vr) 2068 2068 2069 2069 self._vrUnit = gtk.Label(xstr("label_knots")) 2070 2070 table.attach(self._vrUnit, 3, 4, 3, 4) 2071 2071 2072 2072 label = gtk.Label(xstr("takeoff_v2")) 2073 2073 label.set_use_markup(True) … … 2082 2082 table.attach(self._v2, 2, 3, 4, 5) 2083 2083 label.set_mnemonic_widget(self._v2) 2084 2084 2085 2085 self._v2Unit = gtk.Label(xstr("label_knots")) 2086 2086 table.attach(self._v2Unit, 3, 4, 4, 5) … … 2142 2142 self._button.set_sensitive(False) 2143 2143 self._forwardAllowed = False 2144 2144 2145 2145 def allowForward(self): 2146 2146 """Allow going to the next page.""" … … 2154 2154 self._vr.reset() 2155 2155 self._v2.reset() 2156 2156 2157 2157 def _updateForwardButton(self): 2158 2158 """Update the sensitivity of the forward button based on some conditions.""" … … 2170 2170 """Called when the value of some widget has changed.""" 2171 2171 self._updateForwardButton() 2172 2172 2173 2173 def _upperChanged(self, entry, arg = None): 2174 2174 """Called when the value of some entry widget has changed and the value … … 2176 2176 entry.set_text(entry.get_text().upper()) 2177 2177 self._valueChanged(entry, arg) 2178 2178 2179 2179 def _backClicked(self, button): 2180 2180 """Called when the Back button is pressed.""" 2181 2181 self.goBack() 2182 2182 2183 2183 def _forwardClicked(self, button): 2184 2184 """Called when the forward button is clicked.""" … … 2323 2323 self._vref.reset() 2324 2324 self._flightEnded = False 2325 2325 2326 2326 def activate(self): 2327 2327 """Called when the page is activated.""" … … 2371 2371 self._transition.set_sensitive(active) 2372 2372 if active: 2373 self._transition.grab_focus() 2374 self._updateForwardButton() 2373 self._transition.grab_focus() 2374 self._updateForwardButton() 2375 2375 2376 2376 def _updateForwardButton(self): … … 2400 2400 """Called when the Back button is pressed.""" 2401 2401 self.goBack() 2402 2402 2403 2403 def _forwardClicked(self, button): 2404 2404 """Called when the forward button is clicked.""" … … 2425 2425 ("flighttype_vip", const.FLIGHTTYPE_VIP), 2426 2426 ("flighttype_charter", const.FLIGHTTYPE_CHARTER) ] 2427 2427 2428 2428 def __init__(self, wizard): 2429 2429 """Construct the finish page.""" 2430 2430 super(FinishPage, self).__init__(wizard, xstr("finish_title"), 2431 2431 xstr("finish_help")) 2432 2432 2433 2433 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 2434 2434 xscale = 0.0, yscale = 0.0) … … 2492 2492 labelAlignment.add(self._distanceFlown) 2493 2493 table.attach(labelAlignment, 1, 2, 3, 4) 2494 2494 2495 2495 labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0) 2496 2496 label = gtk.Label(xstr("finish_fuel")) … … 2527 2527 flightTypeAlignment.add(self._flightType) 2528 2528 table.attach(flightTypeAlignment, 1, 2, 5, 6) 2529 label.set_mnemonic_widget(self._flightType) 2529 label.set_mnemonic_widget(self._flightType) 2530 2530 2531 2531 self._onlineFlight = gtk.CheckButton(xstr("finish_online")) … … 2550 2550 self._gate.add_attribute(renderer, "text", 0) 2551 2551 self._gate.set_tooltip_text(xstr("finish_gate_tooltip")) 2552 self._gate.connect("changed", self._gateChanged) 2552 self._gate.connect("changed", self._gateChanged) 2553 2553 gateAlignment = gtk.Alignment(xalign=0.0, xscale=1.0) 2554 2554 gateAlignment.add(self._gate) … … 2573 2573 self._pirepSaved = False 2574 2574 self._pirepSent = False 2575 2575 2576 2576 self._sendButton = self.addButton(xstr("sendPIREP"), default = True, 2577 2577 sensitive = False, 2578 2578 clicked = self._sendClicked, 2579 2579 tooltip = xstr("sendPIREP_tooltip")) 2580 2580 2581 2581 @property 2582 2582 def flightType(self): … … 2605 2605 self._flightTime.set_markup("<b>%s</b>" % \ 2606 2606 (util.getTimeIntervalString(flightLength),)) 2607 2607 2608 2608 blockLength = flight.blockTimeEnd - flight.blockTimeStart 2609 2609 self._blockTime.set_markup("<b>%s</b>" % \ … … 2612 2612 self._distanceFlown.set_markup("<b>%.2f NM</b>" % \ 2613 2613 (flight.flownDistance,)) 2614 2614 2615 2615 self._fuelUsed.set_markup("<b>%.0f kg</b>" % \ 2616 2616 (flight.startFuel - flight.endFuel,)) … … 2644 2644 (self._gatesModel.get_iter_first() is None or 2645 2645 self._gate.get_active()>=0) 2646 2646 2647 2647 self._saveButton.set_sensitive(sensitive) 2648 2648 self._sendButton.set_sensitive(sensitive and … … 2673 2673 if result!=RESPONSETYPE_YES: 2674 2674 return 2675 2675 2676 2676 gui.reset() 2677 2677 … … 2699 2699 else: 2700 2700 dialog.set_current_folder(os.path.dirname(self._lastSavePath)) 2701 2701 2702 2702 dialog.set_current_name(fileName) 2703 2703 result = dialog.run() … … 2708 2708 2709 2709 self._lastSavePath = text2unicode(dialog.get_filename()) 2710 2710 2711 2711 if pirep.save(self._lastSavePath): 2712 2712 type = MESSAGETYPE_INFO … … 2718 2718 message = xstr("finish_save_failed") 2719 2719 secondary = xstr("finish_save_failed_sec") 2720 2720 2721 2721 dialog = gtk.MessageDialog(parent = gui.mainWindow, 2722 2722 type = type, message_format = message) … … 2744 2744 dialog.set_modal(True) 2745 2745 dialog.set_do_overwrite_confirmation(True) 2746 2746 2747 2747 filter = gtk.FileFilter() 2748 2748 filter.set_name(xstr("file_filter_pireps")) 2749 2749 filter.add_pattern("*.pirep") 2750 2750 dialog.add_filter(filter) 2751 2751 2752 2752 filter = gtk.FileFilter() 2753 2753 filter.set_name(xstr("file_filter_all")) … … 2758 2758 2759 2759 return self._savePIREPDialog 2760 2760 2761 2761 2762 2762 def _sendClicked(self, button): … … 2774 2774 bookedFlight = self._wizard.bookedFlight 2775 2775 if bookedFlight.arrivalICAO=="LHBP": 2776 iter = self._gate.get_active_iter() 2776 iter = self._gate.get_active_iter() 2777 2777 gateNumber = None if iter is None \ 2778 2778 else self._gatesModel.get_value(iter, 0) 2779 2779 2780 2780 status = const.PLANE_PARKING if gateNumber is None \ 2781 2781 else const.PLANE_HOME … … 2791 2791 """Callback for the plane updating.""" 2792 2792 pass 2793 2793 2794 2794 #----------------------------------------------------------------------------- 2795 2795 … … 2810 2810 self._pages.append(GateSelectionPage(self)) 2811 2811 self._pages.append(ConnectPage(self)) 2812 self._payloadPage = PayloadPage(self) 2812 self._payloadPage = PayloadPage(self) 2813 2813 self._pages.append(self._payloadPage) 2814 2814 self._payloadIndex = len(self._pages) … … 2822 2822 self._pages.append(self._arrivalBriefingPage) 2823 2823 self._arrivalBriefingIndex = len(self._pages) 2824 self._takeoffPage = TakeoffPage(self) 2824 self._takeoffPage = TakeoffPage(self) 2825 2825 self._pages.append(self._takeoffPage) 2826 self._landingPage = LandingPage(self) 2826 self._landingPage = LandingPage(self) 2827 2827 self._pages.append(self._landingPage) 2828 2828 self._finishPage = FinishPage(self) … … 2859 2859 """Indicate if there was a successful login.""" 2860 2860 return self._loginResult is not None 2861 2861 2862 2862 @property 2863 2863 def loginResult(self): … … 3037 3037 self.gui.webHandler.getMETARs(self._arrivalMETARCallback, 3038 3038 [self._bookedFlight.arrivalICAO]) 3039 3039 3040 3040 elif stage==const.STAGE_END: 3041 3041 for page in self._pages: … … 3051 3051 self._fleet = None 3052 3052 self._fleetCallback = None 3053 3053 3054 3054 self._bookedFlight = None 3055 3055 self._departureGate = "-" … … 3063 3063 for page in self._pages[firstPage:]: 3064 3064 page.reset() 3065 3065 3066 3066 self.setCurrentPage(firstPage) 3067 3067 … … 3081 3081 3082 3082 self.gui.beginBusy(busyMessage) 3083 3083 3084 3084 self.gui.webHandler.login(self._loginResultCallback, 3085 3085 pilotID, password, … … 3137 3137 else xstr("login_failconn_sec") 3138 3138 dialog.format_secondary_markup(secondary) 3139 3139 3140 3140 dialog.run() 3141 3141 dialog.hide() … … 3156 3156 self._fleetCallback(fleet) 3157 3157 self._fleetCallback = None 3158 3158 3159 3159 def updatePlane(self, callback, tailNumber, status, gateNumber = None): 3160 3160 """Update the given plane's gate information.""" … … 3169 3169 """Called when the METAR of the arrival airport is retrieved.""" 3170 3170 gobject.idle_add(self._handleArrivalMETAR, returned, result) 3171 3171 3172 3172 def _handleArrivalMETAR(self, returned, result): 3173 3173 """Called when the METAR of the arrival airport is retrieved.""" … … 3177 3177 if metar!="": 3178 3178 self._arrivalBriefingPage.setMETAR(metar) 3179 3179 3180 3180 #----------------------------------------------------------------------------- 3181 3181
Note:
See TracChangeset
for help on using the changeset viewer.