Changeset 393:977efa7a177b for src/mlx/gui
- Timestamp:
- 12/22/12 10:23:19 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r391 r393 15 15 import datetime 16 16 import time 17 import os 17 18 18 19 #----------------------------------------------------------------------------- … … 2872 2873 self._gate.get_active()>=0) 2873 2874 2875 wasSensitive = self._saveButton.get_sensitive() 2876 2877 gui = self._wizard.gui 2878 config = gui.config 2879 if config.pirepAutoSave and sensitive and not wasSensitive: 2880 self._lastSavePath = os.path.join(config.pirepDirectory, 2881 self._getDefaultPIREPName()) 2882 self._lastSavePath = text2unicode(self._lastSavePath) 2883 self._savePIREP(automatic = True) 2884 2874 2885 self._saveButton.set_sensitive(sensitive) 2875 2886 self._sendButton.set_sensitive(sensitive and … … 2903 2914 gui.reset() 2904 2915 2916 def _getDefaultPIREPName(self): 2917 """Get the default name of the PIREP.""" 2918 gui = self._wizard.gui 2919 2920 bookedFlight = gui.bookedFlight 2921 tm = time.gmtime() 2922 2923 pilotID = self._wizard.pilotID 2924 if pilotID: pilotID += " " 2925 return "%s%s %02d%02d %s-%s.pirep" % \ 2926 (pilotID, str(bookedFlight.departureTime.date()), 2927 tm.tm_hour, tm.tm_min, 2928 bookedFlight.departureICAO, bookedFlight.arrivalICAO) 2929 2930 2905 2931 def _saveClicked(self, button): 2906 2932 """Called when the Save PIREP button is clicked.""" 2907 2933 gui = self._wizard.gui 2908 2934 2909 bookedFlight = gui.bookedFlight 2910 tm = time.gmtime() 2911 2912 pilotID = self._wizard.pilotID 2913 if pilotID: pilotID += " " 2914 fileName = "%s%s %02d%02d %s-%s.pirep" % \ 2915 (pilotID, str(bookedFlight.departureTime.date()), 2916 tm.tm_hour, tm.tm_min, 2917 bookedFlight.departureICAO, 2918 bookedFlight.arrivalICAO) 2935 fileName = self._getDefaultPIREPName() 2919 2936 2920 2937 dialog = self._getSaveDialog() … … 2932 2949 2933 2950 if result==RESPONSETYPE_OK: 2934 pirep = PIREP(gui.flight)2935 2936 2951 self._lastSavePath = text2unicode(dialog.get_filename()) 2937 2938 if pirep.save(self._lastSavePath): 2939 type = MESSAGETYPE_INFO 2940 message = xstr("finish_save_done") 2952 self._savePIREP() 2953 2954 def _savePIREP(self, automatic = False): 2955 """Perform the saving of the PIREP.""" 2956 2957 gui = self._wizard.gui 2958 2959 if automatic: 2960 gui.beginBusy(xstr("finish_autosave_busy")) 2961 2962 pirep = PIREP(gui.flight) 2963 error = pirep.save(self._lastSavePath) 2964 2965 if automatic: 2966 gui.endBusy() 2967 2968 if error: 2969 type = MESSAGETYPE_ERROR 2970 message = xstr("finish_save_failed") 2971 secondary = xstr("finish_save_failed_sec") % (text2unicode(error),) 2972 else: 2973 type = MESSAGETYPE_INFO 2974 message = xstr("finish_save_done") 2975 if automatic: 2976 secondary = xstr("finish_save_done_sec") % (self._lastSavePath,) 2977 else: 2941 2978 secondary = None 2942 self._pirepSaved = True 2943 else: 2944 type = MESSAGETYPE_ERROR 2945 message = xstr("finish_save_failed") 2946 secondary = xstr("finish_save_failed_sec") 2947 2948 dialog = gtk.MessageDialog(parent = gui.mainWindow, 2949 type = type, message_format = message) 2950 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK) 2951 dialog.set_title(WINDOW_TITLE_BASE) 2952 if secondary is not None: 2953 dialog.format_secondary_markup(secondary) 2954 2955 dialog.run() 2956 dialog.hide() 2979 self._pirepSaved = True 2980 2981 dialog = gtk.MessageDialog(parent = gui.mainWindow, 2982 type = type, message_format = message) 2983 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK) 2984 dialog.set_title(WINDOW_TITLE_BASE) 2985 if secondary is not None: 2986 dialog.format_secondary_markup(secondary) 2987 2988 dialog.run() 2989 dialog.hide() 2957 2990 2958 2991 def _getSaveDialog(self): -
src/mlx/gui/gui.py
r391 r393 48 48 _authors = [ (u"Váradi", u"István", "prog_test"), 49 49 (u"Galyassy", u"Tamás", "negotiation"), 50 (u"Petrovszki", u"Gábor", "test"),51 (u"Zsebényi-Loksa", u"Gergely", "test"),52 50 (u"Kurják", u"Ákos", "test"), 53 51 (u"Nagy", u"Dániel", "test"), 54 (u"Radó", u"Iván", "test") ] 52 (u"Radó", u"Iván", "test"), 53 (u"Petrovszki", u"Gábor", "test"), 54 (u"Serfőző", u"Tamás", "test"), 55 (u"Szebenyi", u"Bálint", "test"), 56 (u"Zsebényi-Loksa", u"Gergely", "test") ] 55 57 56 58 def __init__(self, programDirectory, config):
Note:
See TracChangeset
for help on using the changeset viewer.