Changeset 999:e096a5638b87 for src/mlx/gui/flight.py
- Timestamp:
- 07/04/19 18:54:23 (5 years ago)
- Branch:
- python3
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/flight.py
r998 r999 641 641 dialog.hide() 642 642 643 if response== RESPONSETYPE_OK:643 if response==Gtk.ResponseType.OK: 644 644 fileName = dialog.get_filename() 645 645 print("Saving", fileName) … … 650 650 print("Failed to save flight:", util.utf2unicode(str(e))) 651 651 dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 652 type = MESSAGETYPE_ERROR,652 type = Gtk.MessageType.ERROR, 653 653 message_format = 654 654 xstr("flightsel_save_failed")) 655 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)655 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 656 656 dialog.set_title(WINDOW_TITLE_BASE) 657 657 secondary = xstr("flightsel_save_failed_sec") … … 716 716 font = Pango.FontDescription("sans") 717 717 font.set_size(int(32 * scale * Pango.SCALE)) 718 font.set_weight(Pango.W EIGHT_NORMAL)718 font.set_weight(Pango.Weight.NORMAL) 719 719 layout.set_font_description(font) 720 720 … … 932 932 dialog.hide() 933 933 934 if response== RESPONSETYPE_OK:934 if response==Gtk.ResponseType.OK: 935 935 fileName = dialog.get_filename() 936 936 print("Loading", fileName) … … 943 943 print("Failed to load flight:", util.utf2unicode(str(e))) 944 944 dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 945 type = MESSAGETYPE_ERROR,945 type = Gtk.MessageType.ERROR, 946 946 message_format = 947 947 xstr("flightsel_load_failed")) 948 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)948 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 949 949 dialog.set_title(WINDOW_TITLE_BASE) 950 950 secondary = xstr("flightsel_load_failed_sec") … … 1026 1026 dialog = Gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + 1027 1027 xstr("flightsel_save_title"), 1028 action = FILE_CHOOSER_ACTION_SAVE,1028 action = Gtk.FileChooserAction.SAVE, 1029 1029 buttons = (Gtk.STOCK_CANCEL, 1030 RESPONSETYPE_CANCEL,1031 Gtk.STOCK_OK, RESPONSETYPE_OK),1030 Gtk.ResponseType.CANCEL, 1031 Gtk.STOCK_OK, Gtk.ResponseType.OK), 1032 1032 parent = gui.mainWindow) 1033 1033 dialog.set_modal(True) … … 1056 1056 dialog = Gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + 1057 1057 xstr("flightsel_load_title"), 1058 action = FILE_CHOOSER_ACTION_OPEN,1058 action = Gtk.FileChooserAction.OPEN, 1059 1059 buttons = (Gtk.STOCK_CANCEL, 1060 RESPONSETYPE_CANCEL,1061 Gtk.STOCK_OK, RESPONSETYPE_OK),1060 Gtk.ResponseType.CANCEL, 1061 Gtk.STOCK_OK, Gtk.ResponseType.OK), 1062 1062 parent = gui.mainWindow) 1063 1063 dialog.set_modal(True) … … 1228 1228 else: 1229 1229 dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 1230 type = MESSAGETYPE_ERROR,1230 type = Gtk.MessageType.ERROR, 1231 1231 message_format = xstr("gatesel_conflict")) 1232 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1232 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1233 1233 dialog.set_title(WINDOW_TITLE_BASE) 1234 1234 dialog.format_secondary_markup(xstr("gatesel_conflict_sec")) … … 1660 1660 else: 1661 1661 secondaryMessage = xstr("register_nologin") % (result.pilotID,) 1662 messageType = MESSAGETYPE_INFO1662 messageType = Gtk.MessageType.INFO 1663 1663 1664 1664 config = gui.config … … 1673 1673 elif returned and result.emailAlreadyRegistered: 1674 1674 secondaryMessage = xstr("register_email_already") 1675 messageType = MESSAGETYPE_ERROR1675 messageType = Gtk.MessageType.ERROR 1676 1676 elif returned and result.invalidData: 1677 1677 secondaryMessage = xstr("register_invalid_data") 1678 messageType = MESSAGETYPE_ERROR1678 messageType = Gtk.MessageType.ERROR 1679 1679 else: 1680 1680 secondaryMessage = xstr("register_error") 1681 messageType = MESSAGETYPE_ERROR1681 messageType = Gtk.MessageType.ERROR 1682 1682 1683 1683 dialog = Gtk.MessageDialog(parent = gui.mainWindow, … … 1733 1733 labelAlignment.add(label) 1734 1734 labelAlignment.resize_children() 1735 table.attach(labelAlignment, 0, 1, row, row + 1, xoptions = FILL) 1735 table.attach(labelAlignment, 0, 1, row, row + 1, 1736 xoptions = Gtk.AttachOptions.FILL) 1736 1737 1737 1738 alignment = Gtk.Alignment(xalign=0.0, yalign = 0.5, … … 1753 1754 1754 1755 buttonAlignment.add(button) 1755 table.attach(buttonAlignment, 0, 4, row, row + 1, xoptions = FILL, 1756 table.attach(buttonAlignment, 0, 4, row, row + 1, 1757 xoptions = Gtk.AttachOptions.FILL, 1756 1758 ypadding = 4) 1757 1759 … … 1762 1764 label = Gtk.Label(xstr("student_check_flight_status")) 1763 1765 labelAlignment.add(label) 1764 table.attach(labelAlignment, 0, 1, row, row + 1, xoptions = FILL) 1766 table.attach(labelAlignment, 0, 1, row, row + 1, 1767 xoptions = Gtk.AttachOptions.FILL) 1765 1768 1766 1769 alignment = Gtk.Alignment(xalign=0.0, yalign = 0.5, … … 1807 1810 1808 1811 alignment.add(hbox) 1809 table.attach(alignment, 0, 4, row, row + 1, xoptions = FILL) 1812 table.attach(alignment, 0, 4, row, row + 1, 1813 xoptions = Gtk.AttachOptions.FILL) 1810 1814 1811 1815 @property … … 1895 1899 1896 1900 dialog = Gtk.MessageDialog(parent = gui.mainWindow, 1897 type = MESSAGETYPE_INFO,1901 type = Gtk.MessageType.INFO, 1898 1902 message_format = xstr("student_fo")) 1899 1903 1900 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1904 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1901 1905 dialog.set_title(WINDOW_TITLE_BASE) 1902 1906 secondary = xstr("student_fo_secondary") … … 2501 2505 self._route = Gtk.TextView() 2502 2506 self._route.set_tooltip_text(xstr("route_route_tooltip")) 2503 self._route.set_wrap_mode( WRAP_WORD)2507 self._route.set_wrap_mode(Gtk.WrapMode.WORD) 2504 2508 self._route.get_buffer().connect("changed", self._routeChanged) 2505 2509 self._route.get_buffer().connect_after("insert-text", self._routeInserted) … … 2626 2630 xstr("simbrief_credentials_title"), 2627 2631 gui.mainWindow, 2628 DIALOG_MODAL)2629 self.add_button(xstr("button_cancel"), RESPONSETYPE_CANCEL)2630 self.add_button(xstr("button_ok"), RESPONSETYPE_OK)2632 Gtk.DialogFlags.MODAL) 2633 self.add_button(xstr("button_cancel"), Gtk.ResponseType.CANCEL) 2634 self.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 2631 2635 2632 2636 contentArea = self.get_content_area() … … 3016 3020 response = dialog.run() 3017 3021 3018 if response== RESPONSETYPE_OK:3022 if response==Gtk.ResponseType.OK: 3019 3023 userName = dialog.userName 3020 3024 self._userName.set_text(userName) … … 3054 3058 "simbrief_result_unknown") 3055 3059 dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 3056 type = MESSAGETYPE_ERROR,3060 type = Gtk.MessageType.ERROR, 3057 3061 message_format = 3058 3062 xstr(message) + "\n"+ 3059 3063 xstr("simbrief_cancelled")) 3060 3064 3061 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)3065 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 3062 3066 dialog.set_title(WINDOW_TITLE_BASE) 3063 3067 secondary = xstr("flightsel_save_failed_sec") … … 3239 3243 label.set_use_markup(True) 3240 3244 label.set_use_underline(True) 3241 label.set_justify( JUSTIFY_CENTER)3245 label.set_justify(Gtk.Justification.CENTER) 3242 3246 label.set_alignment(0.5, 1.0) 3243 3247 … … 3379 3383 def _motionNotify(self, tankFigure, event): 3380 3384 """Called when the mouse pointer moves within the area of a tank figure.""" 3381 if self._enabled and event.state== BUTTON1_MASK:3385 if self._enabled and event.state==Gdk.ModifierType.BUTTON1_MASK: 3382 3386 self._setExpectedFromY(event.y) 3383 3387 … … 3385 3389 """Called when a scroll event is received.""" 3386 3390 if self._enabled: 3387 increment = 1 if event.state== CONTROL_MASK \3388 else 100 if event.state== SHIFT_MASK \3391 increment = 1 if event.state==Gdk.ModifierType.CONTROL_MASK \ 3392 else 100 if event.state==Gdk.ModifierType.SHIFT_MASK \ 3389 3393 else 10 if event.state==0 else 0 3390 3394 if increment!=0: 3391 if event.direction== SCROLL_DOWN:3395 if event.direction==Gdk.ScrollDirection.DOWN: 3392 3396 increment *= -1 3393 self._expectedButton.spin( SPIN_USER_DEFINED, increment)3397 self._expectedButton.spin(Gtk.SpinType.USER_DEFINED, increment) 3394 3398 3395 3399 def _expectedChanged(self, spinButton): … … 4749 4753 dialog.hide() 4750 4754 4751 if result== RESPONSETYPE_OK:4755 if result==Gtk.ResponseType.OK: 4752 4756 self._lastSavePath = dialog.get_filename() 4753 4757 self._savePIREP(page) … … 4768 4772 4769 4773 if error: 4770 type = MESSAGETYPE_ERROR4774 type = Gtk.MessageType.ERROR 4771 4775 message = xstr("finish_save_failed") 4772 4776 secondary = xstr("finish_save_failed_sec") % (error,) 4773 4777 else: 4774 type = MESSAGETYPE_INFO4778 type = Gtk.MessageType.INFO 4775 4779 message = xstr("finish_save_done") 4776 4780 if automatic: … … 4782 4786 dialog = Gtk.MessageDialog(parent = gui.mainWindow, 4783 4787 type = type, message_format = message) 4784 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)4788 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 4785 4789 dialog.set_title(WINDOW_TITLE_BASE) 4786 4790 if secondary is not None: … … 4798 4802 dialog = Gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + 4799 4803 xstr("finish_save_title"), 4800 action = FILE_CHOOSER_ACTION_SAVE,4804 action = Gtk.FileChooserAction.SAVE, 4801 4805 buttons = (Gtk.STOCK_CANCEL, 4802 RESPONSETYPE_CANCEL,4803 Gtk.STOCK_OK, RESPONSETYPE_OK),4806 Gtk.ResponseType.CANCEL, 4807 Gtk.STOCK_OK, Gtk.ResponseType.OK), 4804 4808 parent = gui.mainWindow) 4805 4809 dialog.set_modal(True) … … 5144 5148 if not self._pirepSent and not self._pirepSaved: 5145 5149 dialog = Gtk.MessageDialog(parent = gui.mainWindow, 5146 type = MESSAGETYPE_QUESTION,5150 type = Gtk.MessageType.QUESTION, 5147 5151 message_format = xstr("finish_newFlight_question")) 5148 5152 5149 dialog.add_button(xstr("button_no"), RESPONSETYPE_NO)5150 dialog.add_button(xstr("button_yes"), RESPONSETYPE_YES)5153 dialog.add_button(xstr("button_no"), Gtk.ResponseType.NO) 5154 dialog.add_button(xstr("button_yes"), Gtk.ResponseType.YES) 5151 5155 5152 5156 dialog.set_title(WINDOW_TITLE_BASE) 5153 5157 result = dialog.run() 5154 5158 dialog.hide() 5155 if result!= RESPONSETYPE_YES:5159 if result!=Gtk.ResponseType.YES: 5156 5160 return 5157 5161 … … 5350 5354 else: 5351 5355 dialog = Gtk.MessageDialog(parent = gui.mainWindow, 5352 type = MESSAGETYPE_ERROR,5356 type = Gtk.MessageType.ERROR, 5353 5357 message_format = 5354 5358 xstr("chkfinish_passedset_failed")) … … 5882 5886 xstr("login_invalid")) 5883 5887 dialog = Gtk.MessageDialog(parent = self.gui.mainWindow, 5884 type = MESSAGETYPE_ERROR,5888 type = Gtk.MessageType.ERROR, 5885 5889 message_format = message) 5886 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)5890 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 5887 5891 dialog.set_title(WINDOW_TITLE_BASE) 5888 5892 if isReload: … … 5899 5903 else xstr("login_failconn") 5900 5904 dialog = Gtk.MessageDialog(parent = self.gui.mainWindow, 5901 type = MESSAGETYPE_ERROR,5905 type = Gtk.MessageType.ERROR, 5902 5906 message_format = message) 5903 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)5907 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 5904 5908 dialog.set_title(WINDOW_TITLE_BASE) 5905 5909 secondary = xstr("reload_failconn_sec") if isReload \
Note:
See TracChangeset
for help on using the changeset viewer.