Changeset 151:a2584357ff6c
- Timestamp:
- 05/05/12 11:02:52 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/common.py
r149 r151 46 46 47 47 FILE_CHOOSER_ACTION_SELECT_FOLDER = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER 48 FILE_CHOOSER_ACTION_OPEN = gtk.FILE_CHOOSER_ACTION_OPEN 49 FILE_CHOOSER_ACTION_SAVE = gtk.FILE_CHOOSER_ACTION_SAVE 48 50 49 51 def text2unicode(text): … … 85 87 86 88 FILE_CHOOSER_ACTION_SELECT_FOLDER = gtk.FileChooserAction.SELECT_FOLDER 89 FILE_CHOOSER_ACTION_OPEN = gtk.FileChooserAction.OPEN 90 FILE_CHOOSER_ACTION_SAVE = gtk.FileChooserAction.SAVE 87 91 88 92 import codecs -
src/mlx/gui/flight.py
r146 r151 2187 2187 self._saveButton = self.addButton(xstr("finish_save"), 2188 2188 sensitive = False, 2189 tooltip = xstr("finish_send_tooltip")) 2190 2191 self._sendButton = self.addButton(xstr("finish_send"), default = True, 2189 clicked = self._saveClicked, 2190 tooltip = xstr("finish_save_tooltip")) 2191 self._savePIREPDialog = None 2192 self._lastSavePath = None 2193 2194 self._sendButton = self.addButton(xstr("sendPIREP"), default = True, 2192 2195 sensitive = False, 2193 2196 clicked = self._sendClicked, 2194 tooltip = xstr(" finish_send_tooltip"))2197 tooltip = xstr("sendPIREP_tooltip")) 2195 2198 2196 2199 @property … … 2255 2258 self._gate.get_active()>=0) 2256 2259 2257 #self._saveButton.set_sensitive(sensitive)2260 self._saveButton.set_sensitive(sensitive) 2258 2261 self._sendButton.set_sensitive(sensitive) 2259 2262 … … 2266 2269 self._updateButtons() 2267 2270 2271 def _saveClicked(self, button): 2272 """Called when the Save PIREP button is clicked.""" 2273 gui = self._wizard.gui 2274 2275 bookedFlight = gui.bookedFlight 2276 tm = time.gmtime() 2277 2278 fileName = "%s %s %02d%02d %s-%s.pirep" % \ 2279 (gui.loginResult.pilotID, 2280 str(bookedFlight.departureTime.date()), 2281 tm.tm_hour, tm.tm_min, 2282 bookedFlight.departureICAO, 2283 bookedFlight.arrivalICAO) 2284 2285 dialog = self._getSaveDialog() 2286 2287 if self._lastSavePath is None: 2288 pirepDirectory = gui.config.pirepDirectory 2289 if pirepDirectory is not None: 2290 dialog.set_current_folder(pirepDirectory) 2291 else: 2292 dialog.set_current_folder(os.path.dirname(self._lastSavePath)) 2293 2294 dialog.set_current_name(fileName) 2295 result = dialog.run() 2296 dialog.hide() 2297 2298 if result==RESPONSETYPE_OK: 2299 pirep = PIREP(gui) 2300 2301 self._lastSavePath = dialog.get_filename() 2302 2303 if pirep.save(self._lastSavePath): 2304 type = MESSAGETYPE_INFO 2305 message = xstr("finish_save_done") 2306 secondary = None 2307 else: 2308 type = MESSAGETYPE_ERROR 2309 message = xstr("finish_save_failed") 2310 secondary = xstr("finish_save_failed_sec") 2311 2312 dialog = gtk.MessageDialog(parent = gui.mainWindow, 2313 type = type, message_format = message) 2314 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK) 2315 dialog.set_title(WINDOW_TITLE_BASE) 2316 if secondary is not None: 2317 dialog.format_secondary_markup(secondary) 2318 2319 dialog.run() 2320 dialog.hide() 2321 2322 def _getSaveDialog(self): 2323 """Get the PIREP saving dialog. 2324 2325 If it does not exist yet, create it.""" 2326 if self._savePIREPDialog is None: 2327 gui = self._wizard.gui 2328 dialog = gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + 2329 xstr("finish_save_title"), 2330 action = FILE_CHOOSER_ACTION_SAVE, 2331 buttons = (gtk.STOCK_CANCEL, 2332 RESPONSETYPE_CANCEL, 2333 gtk.STOCK_OK, RESPONSETYPE_OK), 2334 parent = gui.mainWindow) 2335 dialog.set_modal(True) 2336 dialog.set_do_overwrite_confirmation(True) 2337 2338 filter = gtk.FileFilter() 2339 filter.set_name(xstr("loadPIREP_filter_pireps")) 2340 filter.add_pattern("*.pirep") 2341 dialog.add_filter(filter) 2342 2343 filter = gtk.FileFilter() 2344 filter.set_name(xstr("loadPIREP_filter_all")) 2345 filter.add_pattern("*.*") 2346 dialog.add_filter(filter) 2347 2348 self._savePIREPDialog = dialog 2349 2350 return self._savePIREPDialog 2351 2352 2268 2353 def _sendClicked(self, button): 2269 2354 """Called when the Send button is clicked.""" 2270 2355 pirep = PIREP(self._wizard.gui) 2271 gui = self._wizard.gui 2272 gui.beginBusy(xstr("finish_send_busy")) 2273 gui.webHandler.sendPIREP(self._pirepSentCallback, pirep) 2274 2275 def _pirepSentCallback(self, returned, result): 2276 """Callback for the PIREP sending result.""" 2277 gobject.idle_add(self._handlePIREPSent, returned, result) 2356 self._wizard.gui.sendPIREP(pirep, 2357 callback = self._handlePIREPSent) 2278 2358 2279 2359 def _handlePIREPSent(self, returned, result): 2280 2360 """Callback for the PIREP sending result.""" 2281 self._wizard.gui.endBusy()2282 secondaryMarkup = None2283 type = MESSAGETYPE_ERROR2284 if returned:2285 if result.success:2286 type = MESSAGETYPE_INFO2287 messageFormat = xstr("finish_send_success")2288 secondaryMarkup = xstr("finish_send_success_sec")2289 elif result.alreadyFlown:2290 messageFormat = xstr("finish_send_already")2291 secondaryMarkup = xstr("finish_send_already_sec")2292 elif result.notAvailable:2293 messageFormat = xstr("finish_send_notavail")2294 else:2295 messageFormat = xstr("finish_send_unknown")2296 secondaryMarkup = xstr("finish_send_unknown_sec")2297 else:2298 print "PIREP sending failed", result2299 messageFormat = xstr("finish_send_failed")2300 secondaryMarkup = xstr("finish_send_failed_sec")2301 2302 dialog = gtk.MessageDialog(parent = self._wizard.gui.mainWindow,2303 type = type, message_format = messageFormat)2304 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)2305 dialog.set_title(WINDOW_TITLE_BASE)2306 if secondaryMarkup is not None:2307 dialog.format_secondary_markup(secondaryMarkup)2308 2309 dialog.run()2310 dialog.hide()2311 2312 2361 if self._wizard.gui.config.onlineGateSystem and returned and result.success: 2313 2362 bookedFlight = self._wizard.bookedFlight -
src/mlx/gui/gui.py
r148 r151 19 19 import mlx.web as web 20 20 from mlx.i18n import xstr 21 from mlx.pirep import PIREP 21 22 22 23 import time … … 61 62 self._stdioText = "" 62 63 64 self._sendPIREPCallback = None 65 63 66 self.webHandler = web.Handler() 64 67 self.webHandler.start() … … 145 148 self._busyCursor = gdk.Cursor(gdk.CursorType.WATCH if pygobject 146 149 else gdk.WATCH) 150 151 self._loadPIREPDialog = None 152 self._lastLoadedPIREP = None 147 153 148 154 @property … … 730 736 menuBar.append(fileMenuItem) 731 737 738 loadPIREPMenuItem = gtk.ImageMenuItem(gtk.STOCK_OPEN) 739 loadPIREPMenuItem.set_use_stock(True) 740 loadPIREPMenuItem.set_label(xstr("menu_file_loadPIREP")) 741 loadPIREPMenuItem.add_accelerator("activate", accelGroup, 742 ord(xstr("menu_file_loadPIREP_key")), 743 CONTROL_MASK, ACCEL_VISIBLE) 744 loadPIREPMenuItem.connect("activate", self._loadPIREP) 745 fileMenu.append(loadPIREPMenuItem) 746 747 fileMenu.append(gtk.SeparatorMenuItem()) 748 732 749 quitMenuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT) 733 750 quitMenuItem.set_use_stock(True) … … 865 882 else: 866 883 simulator.disableTimeSync() 884 885 def _loadPIREP(self, menuItem): 886 """Load a PIREP for sending.""" 887 dialog = self._getLoadPirepDialog() 888 889 if self._lastLoadedPIREP: 890 dialog.set_current_folder(os.path.dirname(self._lastLoadedPIREP)) 891 else: 892 pirepDirectory = self.config.pirepDirectory 893 if pirepDirectory is not None: 894 dialog.set_current_folder(pirepDirectory) 895 896 result = dialog.run() 897 dialog.hide() 898 899 if result==RESPONSETYPE_OK: 900 self._lastLoadedPIREP = dialog.get_filename() 901 902 pirep = PIREP.load(self._lastLoadedPIREP) 903 if pirep is None: 904 dialog = gtk.MessageDialog(parent = self._mainWindow, 905 type = MESSAGETYPE_ERROR, 906 message_format = xstr("loadPIREP_failed")) 907 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK) 908 dialog.set_title(WINDOW_TITLE_BASE) 909 dialog.format_secondary_markup(xstr("loadPIREP_failed_sec")) 910 dialog.run() 911 dialog.hide() 912 else: 913 dialog = self._getSendLoadedDialog(pirep) 914 dialog.show_all() 915 result = dialog.run() 916 dialog.hide() 917 918 if result==RESPONSETYPE_OK: 919 self.sendPIREP(pirep) 920 921 def _getLoadPirepDialog(self): 922 """Get the PIREP loading file chooser dialog. 923 924 If it is not created yet, it will be created.""" 925 if self._loadPIREPDialog is None: 926 dialog = gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + 927 xstr("loadPIREP_browser_title"), 928 action = FILE_CHOOSER_ACTION_OPEN, 929 buttons = (gtk.STOCK_CANCEL, 930 RESPONSETYPE_CANCEL, 931 gtk.STOCK_OK, RESPONSETYPE_OK), 932 parent = self._mainWindow) 933 dialog.set_modal(True) 934 935 936 filter = gtk.FileFilter() 937 filter.set_name(xstr("loadPIREP_filter_pireps")) 938 filter.add_pattern("*.pirep") 939 dialog.add_filter(filter) 940 941 filter = gtk.FileFilter() 942 filter.set_name(xstr("loadPIREP_filter_all")) 943 filter.add_pattern("*.*") 944 dialog.add_filter(filter) 945 946 self._loadPIREPDialog = dialog 947 948 return self._loadPIREPDialog 949 950 def _getSendLoadedDialog(self, pirep): 951 """Get a dialog displaying the main information of the flight from the 952 PIREP and providing Cancel and Send buttons.""" 953 dialog = gtk.Dialog(title = WINDOW_TITLE_BASE + " - " + 954 xstr("loadPIREP_send_title"), 955 parent = self._mainWindow, 956 flags = DIALOG_MODAL) 957 958 contentArea = dialog.get_content_area() 959 960 label = gtk.Label(xstr("loadPIREP_send_help")) 961 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 962 xscale = 0.0, yscale = 0.0) 963 alignment.set_padding(padding_top = 16, padding_bottom = 0, 964 padding_left = 48, padding_right = 48) 965 alignment.add(label) 966 contentArea.pack_start(alignment, False, False, 8) 967 968 table = gtk.Table(5, 2) 969 tableAlignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 970 xscale = 0.0, yscale = 0.0) 971 tableAlignment.set_padding(padding_top = 0, padding_bottom = 32, 972 padding_left = 48, padding_right = 48) 973 table.set_row_spacings(4) 974 table.set_col_spacings(16) 975 tableAlignment.add(table) 976 contentArea.pack_start(tableAlignment, True, True, 8) 977 978 bookedFlight = pirep.bookedFlight 979 980 label = gtk.Label("<b>" + xstr("loadPIREP_send_flightno") + "</b>") 981 label.set_use_markup(True) 982 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 983 xscale = 0.0, yscale = 0.0) 984 labelAlignment.add(label) 985 table.attach(labelAlignment, 0, 1, 0, 1) 986 987 label = gtk.Label(bookedFlight.callsign) 988 labelAlignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 989 xscale = 0.0, yscale = 0.0) 990 labelAlignment.add(label) 991 table.attach(labelAlignment, 1, 2, 0, 1) 992 993 label = gtk.Label("<b>" + xstr("loadPIREP_send_date") + "</b>") 994 label.set_use_markup(True) 995 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 996 xscale = 0.0, yscale = 0.0) 997 labelAlignment.add(label) 998 table.attach(labelAlignment, 0, 1, 1, 2) 999 1000 label = gtk.Label(str(bookedFlight.departureTime.date())) 1001 labelAlignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 1002 xscale = 0.0, yscale = 0.0) 1003 labelAlignment.add(label) 1004 table.attach(labelAlignment, 1, 2, 1, 2) 1005 1006 label = gtk.Label("<b>" + xstr("loadPIREP_send_from") + "</b>") 1007 label.set_use_markup(True) 1008 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 1009 xscale = 0.0, yscale = 0.0) 1010 labelAlignment.add(label) 1011 table.attach(labelAlignment, 0, 1, 2, 3) 1012 1013 label = gtk.Label(bookedFlight.departureICAO) 1014 labelAlignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 1015 xscale = 0.0, yscale = 0.0) 1016 labelAlignment.add(label) 1017 table.attach(labelAlignment, 1, 2, 2, 3) 1018 1019 label = gtk.Label("<b>" + xstr("loadPIREP_send_to") + "</b>") 1020 label.set_use_markup(True) 1021 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 1022 xscale = 0.0, yscale = 0.0) 1023 labelAlignment.add(label) 1024 table.attach(labelAlignment, 0, 1, 3, 4) 1025 1026 label = gtk.Label(bookedFlight.arrivalICAO) 1027 labelAlignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 1028 xscale = 0.0, yscale = 0.0) 1029 labelAlignment.add(label) 1030 table.attach(labelAlignment, 1, 2, 3, 4) 1031 1032 label = gtk.Label("<b>" + xstr("loadPIREP_send_rating") + "</b>") 1033 label.set_use_markup(True) 1034 labelAlignment = gtk.Alignment(xalign = 1.0, yalign = 0.5, 1035 xscale = 0.0, yscale = 0.0) 1036 labelAlignment.add(label) 1037 table.attach(labelAlignment, 0, 1, 4, 5) 1038 1039 rating = pirep.rating 1040 label = gtk.Label() 1041 if rating<0: 1042 label.set_markup('<b><span foreground="red">NO GO</span></b>') 1043 else: 1044 label.set_text("%.1f %%" % (rating,)) 1045 1046 labelAlignment = gtk.Alignment(xalign = 0.0, yalign = 0.5, 1047 xscale = 0.0, yscale = 0.0) 1048 labelAlignment.add(label) 1049 table.attach(labelAlignment, 1, 2, 4, 5) 1050 1051 dialog.add_button(xstr("button_cancel"), RESPONSETYPE_REJECT) 1052 dialog.add_button(xstr("sendPIREP"), RESPONSETYPE_OK) 1053 1054 return dialog 1055 1056 def sendPIREP(self, pirep, callback = None): 1057 """Send the given PIREP.""" 1058 self.beginBusy(xstr("sendPIREP_busy")) 1059 self._sendPIREPCallback = callback 1060 self.webHandler.sendPIREP(self._pirepSentCallback, pirep) 1061 1062 def _pirepSentCallback(self, returned, result): 1063 """Callback for the PIREP sending result.""" 1064 gobject.idle_add(self._handlePIREPSent, returned, result) 1065 1066 def _handlePIREPSent(self, returned, result): 1067 """Callback for the PIREP sending result.""" 1068 self.endBusy() 1069 secondaryMarkup = None 1070 type = MESSAGETYPE_ERROR 1071 if returned: 1072 if result.success: 1073 type = MESSAGETYPE_INFO 1074 messageFormat = xstr("sendPIREP_success") 1075 secondaryMarkup = xstr("sendPIREP_success_sec") 1076 elif result.alreadyFlown: 1077 messageFormat = xstr("sendPIREP_already") 1078 secondaryMarkup = xstr("sendPIREP_already_sec") 1079 elif result.notAvailable: 1080 messageFormat = xstr("sendPIREP_notavail") 1081 else: 1082 messageFormat = xstr("sendPIREP_unknown") 1083 secondaryMarkup = xstr("sendPIREP_unknown_sec") 1084 else: 1085 print "PIREP sending failed", result 1086 messageFormat = xstr("sendPIREP_failed") 1087 secondaryMarkup = xstr("sendPIREP_failed_sec") 1088 1089 dialog = gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 1090 type = type, message_format = messageFormat) 1091 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK) 1092 dialog.set_title(WINDOW_TITLE_BASE) 1093 if secondaryMarkup is not None: 1094 dialog.format_secondary_markup(secondaryMarkup) 1095 1096 dialog.run() 1097 dialog.hide() 1098 1099 callback = self._sendPIREPCallback 1100 self._sendPIREPCallback = None 1101 if callback is not None: 1102 callback(returned, result) -
src/mlx/gui/prefs.py
r149 r151 238 238 action = FILE_CHOOSER_ACTION_SELECT_FOLDER, 239 239 buttons = (gtk.STOCK_CANCEL, RESPONSETYPE_CANCEL, 240 gtk.STOCK_OK, RESPONSETYPE_OK)) 240 gtk.STOCK_OK, RESPONSETYPE_OK), 241 parent = self) 242 dialog.set_modal(True) 243 dialog.set_transient_for(self) 241 244 242 245 directory = self._pirepDirectory.get_text() -
src/mlx/i18n.py
r149 r151 131 131 132 132 self.add("menu_file", "File") 133 self.add("menu_file_loadPIREP", "_Load PIREP...") 134 self.add("menu_file_loadPIREP_key", "l") 133 135 self.add("menu_file_quit", "_Quit") 134 136 self.add("menu_file_quit_key", "q") … … 426 428 self.add("finish_gate_tooltip", 427 429 "Select the gate or stand at which you have arrived to LHBP.") 428 self.add("finish_save", "S _ave PIREP...")430 self.add("finish_save", "Sa_ve PIREP...") 429 431 self.add("finish_save_tooltip", 430 432 "Click to save the PIREP into a file on your computer. " \ 431 433 "The PIREP can be loaded and sent later.") 432 self.add("finish_send", "_Send PIREP...") 433 self.add("finish_send_tooltip", 434 "Click to send the PIREP to the MAVA website for further review.") 435 self.add("finish_send_busy", "Sending PIREP...") 436 self.add("finish_send_success", 437 "The PIREP was sent successfully.") 438 self.add("finish_send_success_sec", 439 "Await the thorough scrutiny by our fearless PIREP reviewers! :)") 440 self.add("finish_send_already", 441 "The PIREP for this flight has already been sent!") 442 self.add("finish_send_already_sec", 443 "You may clear the old PIREP on the MAVA website.") 444 self.add("finish_send_notavail", 445 "This flight is not available anymore!") 446 self.add("finish_send_unknown", 447 "The MAVA website returned with an unknown error.") 448 self.add("finish_send_unknown_sec", 449 "See the debug log for more information.") 450 self.add("finish_send_failed", 451 "Could not send the PIREP to the MAVA website.") 452 self.add("finish_send_failed_sec", 453 "This can be a network problem, in which case\n" \ 454 "you may try again later. Or it can be a bug;\n" \ 455 "see the debug log for more information.") 434 self.add("finish_save_title", "Save PIREP into") 435 self.add("finish_save_done", "The PIREP was saved successfully") 436 self.add("finish_save_failed", "Failed to save the PIREP") 437 self.add("finish_save_failed_sec", "See the debug log for the details.") 456 438 457 439 # C D … … 665 647 "_Visibility Messages") 666 648 649 self.add("loadPIREP_browser_title", "Select the PIREP to load") 650 self.add("loadPIREP_filter_pireps", "PIREP files") 651 self.add("loadPIREP_filter_all", "All files") 652 self.add("loadPIREP_failed", "Failed to load the PIREP") 653 self.add("loadPIREP_failed_sec", "See the debug log for the details.") 654 self.add("loadPIREP_send_title", "PIREP") 655 self.add("loadPIREP_send_help", 656 "The main data of the PIREP loaded:") 657 self.add("loadPIREP_send_flightno", "Flight number:") 658 self.add("loadPIREP_send_date", "Date:") 659 self.add("loadPIREP_send_from", "From:") 660 self.add("loadPIREP_send_to", "To:") 661 self.add("loadPIREP_send_rating", "Rating:") 662 663 self.add("sendPIREP", "_Send PIREP...") 664 self.add("sendPIREP_tooltip", 665 "Click to send the PIREP to the MAVA website for further review.") 666 self.add("sendPIREP_busy", "Sending PIREP...") 667 self.add("sendPIREP_success", 668 "The PIREP was sent successfully.") 669 self.add("sendPIREP_success_sec", 670 "Await the thorough scrutiny by our fearless PIREP reviewers! :)") 671 self.add("sendPIREP_already", 672 "The PIREP for this flight has already been sent!") 673 self.add("sendPIREP_already_sec", 674 "You may clear the old PIREP on the MAVA website.") 675 self.add("sendPIREP_notavail", 676 "This flight is not available anymore!") 677 self.add("sendPIREP_unknown", 678 "The MAVA website returned with an unknown error.") 679 self.add("sendPIREP_unknown_sec", 680 "See the debug log for more information.") 681 self.add("sendPIREP_failed", 682 "Could not send the PIREP to the MAVA website.") 683 self.add("sendPIREP_failed_sec", 684 "This can be a network problem, in which case\n" \ 685 "you may try again later. Or it can be a bug;\n" \ 686 "see the debug log for more information.") 687 667 688 #------------------------------------------------------------------------------ 668 689 … … 682 703 683 704 self.add("menu_file", "Fájl") 705 self.add("menu_file_loadPIREP", "PIREP be_töltése...") 706 self.add("menu_file_loadPIREP_key", "t") 684 707 self.add("menu_file_quit", "_Kilépés") 685 708 self.add("menu_file_quit_key", "k") … … 988 1011 "Kattints ide, hogy elmenthesd a PIREP-et egy fájlba a számítógépeden. " \ 989 1012 "A PIREP-et később be lehet tölteni és el lehet küldeni.") 990 self.add("finish_send", "PIREP _elküldése...") 991 self.add("finish_send_tooltip", 992 "Kattints ide, hogy elküldd a PIREP-et a MAVA szerverére javításra.") 993 self.add("finish_send_busy", "PIREP küldése...") 994 self.add("finish_send_success", 995 "A PIREP elküldése sikeres volt.") 996 self.add("finish_send_success_sec", 997 "Várhatod félelmet nem ismerő PIREP javítóink alapos észrevételeit! :)") 998 self.add("finish_send_already", 999 "Ehhez a járathoz már küldtél be PIREP-et!") 1000 self.add("finish_send_already_sec", 1001 "A korábban beküldött PIREP-et törölheted a MAVA honlapján.") 1002 self.add("finish_send_notavail", 1003 "Ez a járat már nem elérhető!") 1004 self.add("finish_send_unknown", 1005 "A MAVA szervere ismeretlen hibaüzenettel tért vissza.") 1006 self.add("finish_send_unknown_sec", 1007 "A debug naplóban részletesebb információt találsz.") 1008 self.add("finish_send_failed", 1009 "Nem tudtam elküldeni a PIREP-et a MAVA szerverére.") 1010 self.add("finish_send_failed_sec", 1011 "Lehet, hogy hálózati probléma áll fenn, amely esetben később\n" \ 1012 "újra próbálkozhatsz. Lehet azonban hiba is a loggerben:\n" \ 1013 "részletesebb információt találhatsz a debug naplóban.") 1013 self.add("finish_save_title", "PIREP mentése") 1014 self.add("finish_save_done", "A PIREP mentése sikerült") 1015 self.add("finish_save_failed", "A PIREP mentése nem sikerült") 1016 self.add("finish_save_failed_sec", "A részleteket lásd a debug naplóban.") 1014 1017 1015 1018 # M A … … 1226 1229 "Lá_tótávolság üzenetek") 1227 1230 1231 self.add("loadPIREP_browser_title", "Válaszd ki a betöltendő PIREP-et") 1232 self.add("loadPIREP_filter_pireps", "PIREP fájlok") 1233 self.add("loadPIREP_filter_all", "Összes fájl") 1234 self.add("loadPIREP_failed", "Nem tudtam betölteni a PIREP-et") 1235 self.add("loadPIREP_failed_sec", 1236 "A részleteket lásd a debug naplóban.") 1237 self.add("loadPIREP_send_title", "PIREP") 1238 self.add("loadPIREP_send_help", 1239 "A betöltött PIREP főbb adatai:") 1240 self.add("loadPIREP_send_flightno", "Járatszám:") 1241 self.add("loadPIREP_send_date", "Dátum:") 1242 self.add("loadPIREP_send_from", "Honnan:") 1243 self.add("loadPIREP_send_to", "Hová:") 1244 self.add("loadPIREP_send_rating", "Pontszám:") 1245 1246 self.add("sendPIREP", "PIREP _elküldése...") 1247 self.add("sendPIREP_tooltip", 1248 "Kattints ide, hogy elküldd a PIREP-et a MAVA szerverére javításra.") 1249 self.add("sendPIREP_busy", "PIREP küldése...") 1250 self.add("sendPIREP_success", 1251 "A PIREP elküldése sikeres volt.") 1252 self.add("sendPIREP_success_sec", 1253 "Várhatod félelmet nem ismerő PIREP javítóink alapos észrevételeit! :)") 1254 self.add("sendPIREP_already", 1255 "Ehhez a járathoz már küldtél be PIREP-et!") 1256 self.add("sendPIREP_already_sec", 1257 "A korábban beküldött PIREP-et törölheted a MAVA honlapján.") 1258 self.add("sendPIREP_notavail", 1259 "Ez a járat már nem elérhető!") 1260 self.add("sendPIREP_unknown", 1261 "A MAVA szervere ismeretlen hibaüzenettel tért vissza.") 1262 self.add("sendPIREP_unknown_sec", 1263 "A debug naplóban részletesebb információt találsz.") 1264 self.add("sendPIREP_failed", 1265 "Nem tudtam elküldeni a PIREP-et a MAVA szerverére.") 1266 self.add("sendPIREP_failed_sec", 1267 "Lehet, hogy hálózati probléma áll fenn, amely esetben később\n" \ 1268 "újra próbálkozhatsz. Lehet azonban hiba is a loggerben:\n" \ 1269 "részletesebb információt találhatsz a debug naplóban.") 1270 1228 1271 #------------------------------------------------------------------------------ 1229 1272 -
src/mlx/pirep.py
r102 r151 4 4 5 5 import const 6 import cPickle as pickle 6 7 7 8 #------------------------------------------------------------------------------ … … 25 26 some other things.""" 26 27 return "[" + timeStr + "]-[" + line + "]" 28 29 @staticmethod 30 def load(path): 31 """Load a PIREP from the given path. 32 33 Returns the PIREP object, or None on error.""" 34 try: 35 with open(path, "rb") as f: 36 return pickle.load(f) 37 except Exception, e: 38 print "Failed loading PIREP from %s: %s" % (path, str(e)) 39 return None 27 40 28 41 def __init__(self, gui): … … 114 127 star += self.transition 115 128 return star.upper() 129 130 def save(self, path): 131 """Save the PIREP to the given file. 132 133 Returns whether the saving has succeeded.""" 134 try: 135 with open(path, "wb") as f: 136 pickle.dump(self, f) 137 return True 138 except Exception, e: 139 print "Failed saving PIREP to %s: %s" % (path, str(e)) 140 return False -
src/mlx/web.py
r139 r151 375 375 376 376 if result.loggedIn: 377 result.pilotID = self._pilotID 377 378 result.pilotName = self.iso88592decoder(readline(f))[0] 378 379 result.exams = readline(f)
Note:
See TracChangeset
for help on using the changeset viewer.