Changeset 999:e096a5638b87 for src/mlx
- Timestamp:
- 07/04/19 18:54:23 (5 years ago)
- Branch:
- python3
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/bugreport.py
r996 r999 24 24 xstr("bugreport_title"), 25 25 gui.mainWindow, 26 DIALOG_MODAL)26 Gtk.DialogFlags.MODAL) 27 27 28 self.add_button(xstr("button_cancel"), RESPONSETYPE_REJECT)29 self._sendButton = self.add_button(xstr("button_send"), RESPONSETYPE_ACCEPT)28 self.add_button(xstr("button_cancel"), Gtk.ResponseType.REJECT) 29 self._sendButton = self.add_button(xstr("button_send"), Gtk.ResponseType.ACCEPT) 30 30 self._sendButton.set_can_default(True) 31 31 self._gui = gui … … 64 64 self._description = description = Gtk.TextView() 65 65 description.set_tooltip_text(xstr("bugreport_description_tooltip")) 66 description.set_wrap_mode( WRAP_WORD)66 description.set_wrap_mode(Gtk.WrapMode.WORD) 67 67 label.set_mnemonic_widget(description) 68 68 … … 70 70 scrolledWindow.add(description) 71 71 scrolledWindow.set_size_request(-1, 200) 72 scrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) 73 scrolledWindow.set_shadow_type(SHADOW_IN) 72 scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, 73 Gtk.PolicyType.AUTOMATIC) 74 scrolledWindow.set_shadow_type(Gtk.ShadowType.IN) 74 75 75 76 alignment = Gtk.Alignment(xalign = 0.5, yalign = 0.0, xscale = 1.0, yscale = 1.0) … … 105 106 response = super(BugReportDialog, self).run() 106 107 107 print("response", response, RESPONSETYPE_ACCEPT)108 if response== RESPONSETYPE_ACCEPT:108 print("response", response, Gtk.ResponseType.ACCEPT) 109 if response==Gtk.ResponseType.ACCEPT: 109 110 self._send() 110 111 else: -
src/mlx/gui/callouts.py
r996 r999 54 54 xstr("callouts_title"), 55 55 gui.mainWindow, 56 DIALOG_MODAL)57 58 self.add_button(xstr("button_cancel"), RESPONSETYPE_REJECT)59 self.add_button(xstr("button_ok"), RESPONSETYPE_ACCEPT)56 Gtk.DialogFlags.MODAL) 57 58 self.add_button(xstr("button_cancel"), Gtk.ResponseType.REJECT) 59 self.add_button(xstr("button_ok"), Gtk.ResponseType.ACCEPT) 60 60 61 61 self._gui = gui … … 133 133 134 134 self._fileListModel = Gtk.ListStore(int, str, str) 135 self._fileListModel.set_sort_column_id(0, SORT_DESCENDING)135 self._fileListModel.set_sort_column_id(0, Gtk.SortType.DESCENDING) 136 136 137 137 self._addingFile = False … … 156 156 column.set_sort_indicator(True) 157 157 column.set_sort_column_id(0) 158 column.set_sort_order( SORT_DESCENDING)158 column.set_sort_order(Gtk.SortType.DESCENDING) 159 159 column.set_expand(False) 160 160 … … 173 173 self._fileListButtonPressed) 174 174 selection = self._fileList.get_selection() 175 selection.set_mode( SELECTION_MULTIPLE)175 selection.set_mode(Gtk.SelectionMode.MULTIPLE) 176 176 selection.connect("changed", self._fileListSelectionChanged) 177 177 … … 181 181 scrolledWindow.add(self._fileList) 182 182 scrolledWindow.set_size_request(300, -1) 183 scrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) 184 scrolledWindow.set_shadow_type(SHADOW_IN) 183 scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, 184 Gtk.PolicyType.AUTOMATIC) 185 scrolledWindow.set_shadow_type(Gtk.ShadowType.IN) 185 186 186 187 fileListAlignment = Gtk.Alignment(xscale=1.0, yscale=1.0, … … 204 205 self.hide() 205 206 206 if response== RESPONSETYPE_ACCEPT:207 if response==Gtk.ResponseType.ACCEPT: 207 208 self._saveApproachCallouts() 208 209 config = self._gui.config … … 225 226 dialog.hide() 226 227 227 if result== RESPONSETYPE_OK:228 if result==Gtk.ResponseType.OK: 228 229 filePath = dialog.get_filename() 229 230 baseName = os.path.basename(filePath) … … 293 294 if otherPath is not None: 294 295 dialog = Gtk.MessageDialog(parent = self, 295 type = MESSAGETYPE_QUESTION,296 type = Gtk.MessageType.QUESTION, 296 297 message_format = 297 298 xstr("callouts_altitude_clash")) 298 299 dialog.format_secondary_markup(xstr("callouts_altitude_clash_sec")) 299 dialog.add_button(xstr("button_no"), RESPONSETYPE_NO)300 dialog.add_button(xstr("button_yes"), RESPONSETYPE_YES)300 dialog.add_button(xstr("button_no"), Gtk.ResponseType.NO) 301 dialog.add_button(xstr("button_yes"), Gtk.ResponseType.YES) 301 302 dialog.set_title(WINDOW_TITLE_BASE) 302 303 … … 304 305 dialog.hide() 305 306 306 if result!= RESPONSETYPE_YES:307 if result!=Gtk.ResponseType.YES: 307 308 newAltitude = None 308 309 … … 348 349 dialog = Gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + 349 350 xstr("callouts_open_title"), 350 action = FILE_CHOOSER_ACTION_OPEN,351 action = Gtk.FileChooserAction.OPEN, 351 352 buttons = (Gtk.STOCK_CANCEL, 352 RESPONSETYPE_CANCEL,353 Gtk.STOCK_OK, RESPONSETYPE_OK),353 Gtk.ResponseType.CANCEL, 354 Gtk.STOCK_OK, Gtk.ResponseType.OK), 354 355 parent = self) 355 356 dialog.set_modal(True) … … 389 390 if altitude is not None: return altitude 390 391 391 descending = self._fileList.get_column(0).get_sort_order()== SORT_DESCENDING392 descending = self._fileList.get_column(0).get_sort_order()==Gtk.SortType.DESCENDING 392 393 model = self._fileListModel 393 394 numEntries = model.iter_n_children(None) … … 473 474 def _fileListButtonPressed(self, widget, event): 474 475 """Called when a mouse button is pressed on the file list.""" 475 if event.type!= EVENT_BUTTON_PRESS or event.button!=3:476 if event.type!=Gdk.EventType.BUTTON_PRESS or event.button!=3: 476 477 return 477 478 -
src/mlx/gui/checklist.py
r996 r999 28 28 xstr("chklst_title"), 29 29 gui.mainWindow, 30 DIALOG_MODAL)31 32 self.add_button(xstr("button_cancel"), RESPONSETYPE_REJECT)33 self.add_button(xstr("button_ok"), RESPONSETYPE_ACCEPT)30 Gtk.DialogFlags.MODAL) 31 32 self.add_button(xstr("button_cancel"), Gtk.ResponseType.REJECT) 33 self.add_button(xstr("button_ok"), Gtk.ResponseType.ACCEPT) 34 34 35 35 self._gui = gui … … 162 162 self._fileListPopupMenu = None 163 163 selection = self._fileList.get_selection() 164 selection.set_mode( SELECTION_MULTIPLE)164 selection.set_mode(Gtk.SelectionMode.MULTIPLE) 165 165 selection.connect("changed", self._fileListSelectionChanged) 166 166 … … 170 170 scrolledWindow.add(self._fileList) 171 171 scrolledWindow.set_size_request(200, -1) 172 scrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) 173 scrolledWindow.set_shadow_type(SHADOW_IN) 172 scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, 173 Gtk.PolicyType.AUTOMATIC) 174 scrolledWindow.set_shadow_type(Gtk.ShadowType.IN) 174 175 175 176 fileBox.pack_start(scrolledWindow, False, False, 4) … … 187 188 self.hide() 188 189 189 if response== RESPONSETYPE_ACCEPT:190 if response==Gtk.ResponseType.ACCEPT: 190 191 self._saveChecklist() 191 192 config = self._gui.config … … 321 322 def _fileListButtonPressed(self, widget, event): 322 323 """Called when a mouse button is pressed on the file list.""" 323 if event.type!= EVENT_BUTTON_PRESS or event.button!=3:324 if event.type!=Gdk.EventType.BUTTON_PRESS or event.button!=3: 324 325 return 325 326 -
src/mlx/gui/common.py
r998 r999 35 35 from gi.repository import Pango 36 36 37 38 MESSAGETYPE_ERROR = Gtk.MessageType.ERROR39 MESSAGETYPE_QUESTION = Gtk.MessageType.QUESTION40 MESSAGETYPE_INFO = Gtk.MessageType.INFO41 RESPONSETYPE_NONE = Gtk.ResponseType.NONE42 RESPONSETYPE_OK = Gtk.ResponseType.OK43 RESPONSETYPE_YES = Gtk.ResponseType.YES44 RESPONSETYPE_NO = Gtk.ResponseType.NO45 RESPONSETYPE_ACCEPT = Gtk.ResponseType.ACCEPT46 RESPONSETYPE_REJECT = Gtk.ResponseType.REJECT47 RESPONSETYPE_CANCEL = Gtk.ResponseType.CANCEL48 ACCEL_VISIBLE = Gtk.AccelFlags.VISIBLE49 CONTROL_MASK = Gdk.ModifierType.CONTROL_MASK50 DIALOG_MODAL = Gtk.DialogFlags.MODAL51 WRAP_WORD = Gtk.WrapMode.WORD52 JUSTIFY_CENTER = Gtk.Justification.CENTER53 JUSTIFY_LEFT = Gtk.Justification.LEFT54 55 CONTROL_MASK = Gdk.ModifierType.CONTROL_MASK56 SHIFT_MASK = Gdk.ModifierType.SHIFT_MASK57 BUTTON1_MASK = Gdk.ModifierType.BUTTON1_MASK58 59 SCROLL_UP = Gdk.ScrollDirection.UP60 SCROLL_DOWN = Gdk.ScrollDirection.DOWN61 62 SPIN_USER_DEFINED = Gtk.SpinType.USER_DEFINED63 64 FILE_CHOOSER_ACTION_SELECT_FOLDER = Gtk.FileChooserAction.SELECT_FOLDER65 FILE_CHOOSER_ACTION_OPEN = Gtk.FileChooserAction.OPEN66 FILE_CHOOSER_ACTION_SAVE = Gtk.FileChooserAction.SAVE67 68 SELECTION_MULTIPLE = Gtk.SelectionMode.MULTIPLE69 70 SHADOW_IN = Gtk.ShadowType.IN71 SHADOW_NONE = Gtk.ShadowType.NONE72 73 POLICY_AUTOMATIC = Gtk.PolicyType.AUTOMATIC74 POLICY_NEVER = Gtk.PolicyType.NEVER75 POLICY_ALWAYS = Gtk.PolicyType.ALWAYS76 77 WEIGHT_NORMAL = Pango.Weight.NORMAL78 WEIGHT_BOLD = Pango.Weight.BOLD79 80 WINDOW_STATE_ICONIFIED = Gdk.WindowState.ICONIFIED81 WINDOW_STATE_WITHDRAWN = Gdk.WindowState.WITHDRAWN82 83 SORT_ASCENDING = Gtk.SortType.ASCENDING84 SORT_DESCENDING = Gtk.SortType.DESCENDING85 86 EVENT_BUTTON_PRESS = Gdk.EventType.BUTTON_PRESS87 88 TREE_VIEW_COLUMN_FIXED = Gtk.TreeViewColumnSizing.FIXED89 90 FILL = Gtk.AttachOptions.FILL91 EXPAND = Gtk.AttachOptions.EXPAND92 93 UPDATE_IF_VALID = Gtk.SpinButtonUpdatePolicy.IF_VALID94 95 SELECTION_MULTIPLE = Gtk.SelectionMode.MULTIPLE96 97 pixbuf_new_from_file = GdkPixbuf.Pixbuf.new_from_file98 99 37 import codecs 100 38 _utf8Decoder = codecs.getdecoder("utf-8") … … 314 252 titleLabel, 315 253 gui.mainWindow, 316 DIALOG_MODAL)317 self.add_button(cancelButtonLabel, RESPONSETYPE_CANCEL)318 self.add_button(okButtonLabel, RESPONSETYPE_OK)254 Gtk.DialogFlags.MODAL) 255 self.add_button(cancelButtonLabel, Gtk.ResponseType.CANCEL) 256 self.add_button(okButtonLabel, Gtk.ResponseType.OK) 319 257 320 258 contentArea = self.get_content_area() … … 488 426 def addFaultTag(buffer): 489 427 """Add a tag named 'fault' to the given buffer.""" 490 buffer.create_tag("fault", foreground="red", weight= WEIGHT_BOLD)428 buffer.create_tag("fault", foreground="red", weight=Pango.Weight.BOLD) 491 429 492 430 #------------------------------------------------------------------------------ … … 523 461 Return a boolean indicating the answer.""" 524 462 dialog = Gtk.MessageDialog(parent = parent, 525 type = MESSAGETYPE_QUESTION,463 type = Gtk.MessageType.QUESTION, 526 464 message_format = question) 527 465 528 dialog.add_button(xstr("button_no"), RESPONSETYPE_NO)529 dialog.add_button(xstr("button_yes"), RESPONSETYPE_YES)466 dialog.add_button(xstr("button_no"), Gtk.ResponseType.NO) 467 dialog.add_button(xstr("button_yes"), Gtk.ResponseType.YES) 530 468 531 469 dialog.set_title(title) … … 533 471 dialog.hide() 534 472 535 return result== RESPONSETYPE_YES473 return result==Gtk.ResponseType.YES 536 474 537 475 #------------------------------------------------------------------------------ … … 541 479 """Display an error dialog box with the given message.""" 542 480 dialog = Gtk.MessageDialog(parent = parent, 543 type = MESSAGETYPE_ERROR,481 type = Gtk.MessageType.ERROR, 544 482 message_format = message) 545 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)483 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 546 484 dialog.set_title(title) 547 485 if secondary is not None: -
src/mlx/gui/delaycodes.py
r996 r999 198 198 self._viewport = self._createViewport() 199 199 self._viewport.add(self._eventBox) 200 self._viewport.set_shadow_type( SHADOW_NONE)200 self._viewport.set_shadow_type(Gtk.ShadowType.NONE) 201 201 202 202 self.pack_start(self._viewport, True, True, 0) … … 255 255 256 256 column = Gtk.TreeViewColumn("", Gtk.CellRendererText()) 257 column.set_sizing( TREE_VIEW_COLUMN_FIXED)257 column.set_sizing(Gtk.TreeViewColumnSizing.FIXED) 258 258 self._treeView.append_column(column) 259 259 260 260 for header in headers: 261 261 column = Gtk.TreeViewColumn(header, Gtk.CellRendererText()) 262 column.set_sizing( TREE_VIEW_COLUMN_FIXED)262 column.set_sizing(Gtk.TreeViewColumnSizing.FIXED) 263 263 self._treeView.append_column(column) 264 264 … … 283 283 alignment.add(label) 284 284 self._table.attach(alignment, 1, numColumns, i, i+1, 285 yoptions = FILL)285 yoptions = Gtk.AttachOptions.FILL) 286 286 self._table.set_row_spacing(i, 8) 287 287 elif type==DELAYCODE: … … 292 292 alignment.add(checkButton) 293 293 self._table.attach(alignment, 0, 1, i, i+1, 294 xoptions = FILL, yoptions = FILL) 294 xoptions = Gtk.AttachOptions.FILL, 295 yoptions = Gtk.AttachOptions.FILL) 295 296 if firstDelayCodeRow: 296 297 self._alignments.append(alignment) … … 302 303 xscale = 1.0) 303 304 alignment.add(label) 304 xoptions = FILL305 if j==(numColumns-2): xoptions |= EXPAND305 xoptions = Gtk.AttachOptions.FILL 306 if j==(numColumns-2): xoptions |= Gtk.AttachOptions.EXPAND 306 307 self._table.attach(alignment, j+1, j+2, i, i+1, 307 xoptions = xoptions, yoptions = FILL) 308 xoptions = xoptions, 309 yoptions = Gtk.AttachOptions.FILL) 308 310 if firstDelayCodeRow: 309 311 self._alignments.append(alignment) -
src/mlx/gui/faultexplain.py
r997 r999 34 34 self._fault = fault = Gtk.Label() 35 35 fault.set_xalign(0.0) 36 fault.set_justify( JUSTIFY_LEFT)36 fault.set_justify(Gtk.Justification.LEFT) 37 37 fault.set_line_wrap(True) 38 38 … … 47 47 48 48 self._explanation = explanation = Gtk.TextView() 49 explanation.set_wrap_mode( WRAP_WORD)49 explanation.set_wrap_mode(Gtk.WrapMode.WORD) 50 50 explanation.set_accepts_tab(False) 51 51 explanation.set_size_request(-1, 100) … … 153 153 154 154 scroller = Gtk.ScrolledWindow() 155 scroller.set_policy( POLICY_AUTOMATIC, POLICY_AUTOMATIC)156 scroller.set_shadow_type( SHADOW_NONE)155 scroller.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) 156 scroller.set_shadow_type(Gtk.ShadowType.NONE) 157 157 158 158 self._faults = Gtk.VBox() -
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 \ -
src/mlx/gui/flightlist.py
r997 r999 116 116 self._model = Gtk.ListStore(*types) 117 117 if defaultSortableIndex is not None: 118 sortOrder = SORT_DESCENDING \118 sortOrder = Gtk.SortType.DESCENDING \ 119 119 if self._columnDescriptors[defaultSortableIndex-1]._defaultDescending \ 120 else SORT_ASCENDING120 else Gtk.SortType.ASCENDING 121 121 self._model.set_sort_column_id(defaultSortableIndex, sortOrder) 122 122 self._view = Gtk.TreeView(self._model) … … 138 138 selection.connect("changed", self._selectionChanged) 139 139 if multiSelection: 140 selection.set_mode( SELECTION_MULTIPLE)140 selection.set_mode(Gtk.SelectionMode.MULTIPLE) 141 141 142 142 scrolledWindow = Gtk.ScrolledWindow() … … 206 206 def _buttonPressEvent(self, widget, event): 207 207 """Called when a mouse button is pressed or released.""" 208 if event.type!= EVENT_BUTTON_PRESS or event.button!=3 or \208 if event.type!=Gdk.EventType.BUTTON_PRESS or event.button!=3 or \ 209 209 self._popupMenuProducer is None: 210 210 return -
src/mlx/gui/gui.py
r997 r999 502 502 503 503 dialog = Gtk.MessageDialog(parent = self._mainWindow, 504 type = MESSAGETYPE_ERROR,504 type = Gtk.MessageType.ERROR, 505 505 message_format = xstr("conn_failed")) 506 506 … … 533 533 self._statusbar.updateConnection(self._connecting, self._connected) 534 534 535 dialog = Gtk.MessageDialog(type = MESSAGETYPE_ERROR,535 dialog = Gtk.MessageDialog(type = Gtk.MessageType.ERROR, 536 536 message_format = xstr("conn_broken"), 537 537 parent = self._mainWindow) … … 592 592 """Cancel the current file, if the user confirms it.""" 593 593 dialog = Gtk.MessageDialog(parent = self._mainWindow, 594 type = MESSAGETYPE_QUESTION,594 type = Gtk.MessageType.QUESTION, 595 595 message_format = xstr("cancelFlight_question")) 596 596 597 dialog.add_button(xstr("button_no"), RESPONSETYPE_NO)598 dialog.add_button(xstr("button_yes"), RESPONSETYPE_YES)597 dialog.add_button(xstr("button_no"), Gtk.ResponseType.NO) 598 dialog.add_button(xstr("button_yes"), Gtk.ResponseType.YES) 599 599 600 600 dialog.set_title(WINDOW_TITLE_BASE) … … 602 602 dialog.hide() 603 603 604 if result== RESPONSETYPE_YES:604 if result==Gtk.ResponseType.YES: 605 605 self.reset() 606 606 … … 741 741 iconified = Gdk.WindowState.ICONIFIED 742 742 743 if (event.changed_mask& WINDOW_STATE_WITHDRAWN)!=0:744 if (event.new_window_state& WINDOW_STATE_WITHDRAWN)!=0:743 if (event.changed_mask&Gdk.WindowState.WITHDRAWN)!=0: 744 if (event.new_window_state&Gdk.WindowState.WITHDRAWN)!=0: 745 745 self._statusIcon.mainWindowHidden() 746 746 else: 747 747 self._statusIcon.mainWindowShown() 748 748 749 if (event.changed_mask& WINDOW_STATE_ICONIFIED)!=0 and \750 (event.new_window_state& WINDOW_STATE_ICONIFIED)==0:749 if (event.changed_mask&Gdk.WindowState.ICONIFIED)!=0 and \ 750 (event.new_window_state&Gdk.WindowState.ICONIFIED)==0: 751 751 self._mainWindow.present() 752 752 … … 931 931 932 932 dialog = Gtk.MessageDialog(parent = self.mainWindow, 933 type = MESSAGETYPE_ERROR,933 type = Gtk.MessageType.ERROR, 934 934 message_format = xstr("fleet_failed")) 935 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)935 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 936 936 dialog.set_title(WINDOW_TITLE_BASE) 937 937 dialog.run() … … 976 976 else: 977 977 dialog = Gtk.MessageDialog(parent = self.mainWindow, 978 type = MESSAGETYPE_ERROR,978 type = Gtk.MessageType.ERROR, 979 979 message_format = xstr("fleet_update_failed")) 980 dialog.add_button(xstr("button_ok"), RESPONSETYPE_ACCEPT)980 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.ACCEPT) 981 981 dialog.set_title(WINDOW_TITLE_BASE) 982 982 dialog.run() … … 1077 1077 loadPIREPMenuItem.add_accelerator("activate", accelGroup, 1078 1078 ord(xstr("menu_file_loadPIREP_key")), 1079 CONTROL_MASK, ACCEL_VISIBLE) 1079 Gdk.ModifierType.CONTROL_MASK, 1080 Gtk.AccelFlags.VISIBLE) 1080 1081 loadPIREPMenuItem.connect("activate", self._loadPIREP) 1081 1082 fileMenu.append(loadPIREPMenuItem) … … 1088 1089 quitMenuItem.add_accelerator("activate", accelGroup, 1089 1090 ord(xstr("menu_file_quit_key")), 1090 CONTROL_MASK, ACCEL_VISIBLE) 1091 Gdk.ModifierType.CONTROL_MASK, 1092 Gtk.AccelFlags.VISIBLE) 1091 1093 quitMenuItem.connect("activate", self._quit) 1092 1094 fileMenu.append(quitMenuItem) … … 1103 1105 timetableMenuItem.add_accelerator("activate", accelGroup, 1104 1106 ord(xstr("menu_tools_timetable_key")), 1105 CONTROL_MASK, ACCEL_VISIBLE) 1107 Gdk.ModifierType.CONTROL_MASK, 1108 Gtk.AccelFlags.VISIBLE) 1106 1109 timetableMenuItem.connect("activate", self.showTimetable) 1107 1110 self._timetableMenuItem.set_sensitive(False) … … 1114 1117 flightsMenuItem.add_accelerator("activate", accelGroup, 1115 1118 ord(xstr("menu_tools_flights_key")), 1116 CONTROL_MASK, ACCEL_VISIBLE) 1119 Gdk.ModifierType.CONTROL_MASK, 1120 Gtk.AccelFlags.VISIBLE) 1117 1121 flightsMenuItem.connect("activate", self.showFlights) 1118 1122 self._flightsMenuItem.set_sensitive(False) … … 1124 1128 checklistMenuItem.add_accelerator("activate", accelGroup, 1125 1129 ord(xstr("menu_tools_chklst_key")), 1126 CONTROL_MASK, ACCEL_VISIBLE) 1130 Gdk.ModifierType.CONTROL_MASK, 1131 Gtk.AccelFlags.VISIBLE) 1127 1132 checklistMenuItem.connect("activate", self._editChecklist) 1128 1133 toolsMenu.append(checklistMenuItem) … … 1133 1138 approachCalloutsMenuItem.add_accelerator("activate", accelGroup, 1134 1139 ord(xstr("menu_tools_callouts_key")), 1135 CONTROL_MASK, ACCEL_VISIBLE) 1140 Gdk.ModifierType.CONTROL_MASK, 1141 Gtk.AccelFlags.VISIBLE) 1136 1142 approachCalloutsMenuItem.connect("activate", self._editApproachCallouts) 1137 1143 toolsMenu.append(approachCalloutsMenuItem) … … 1142 1148 prefsMenuItem.add_accelerator("activate", accelGroup, 1143 1149 ord(xstr("menu_tools_prefs_key")), 1144 CONTROL_MASK, ACCEL_VISIBLE) 1150 Gdk.ModifierType.CONTROL_MASK, 1151 Gtk.AccelFlags.VISIBLE) 1145 1152 prefsMenuItem.connect("activate", self._editPreferences) 1146 1153 toolsMenu.append(prefsMenuItem) … … 1153 1160 bugReportMenuItem.add_accelerator("activate", accelGroup, 1154 1161 ord(xstr("menu_tools_bugreport_key")), 1155 CONTROL_MASK, ACCEL_VISIBLE) 1162 Gdk.ModifierType.CONTROL_MASK, 1163 Gtk.AccelFlags.VISIBLE) 1156 1164 bugReportMenuItem.connect("activate", self._reportBug) 1157 1165 toolsMenu.append(bugReportMenuItem) … … 1168 1176 self._showMonitorMenuItem.add_accelerator("activate", accelGroup, 1169 1177 ord(xstr("menu_view_monitor_key")), 1170 CONTROL_MASK, ACCEL_VISIBLE) 1178 Gdk.ModifierType.CONTROL_MASK, 1179 Gtk.AccelFlags.VISIBLE) 1171 1180 self._showMonitorMenuItem.connect("toggled", self._toggleMonitorWindow) 1172 1181 viewMenu.append(self._showMonitorMenuItem) … … 1178 1187 showDebugMenuItem.add_accelerator("activate", accelGroup, 1179 1188 ord(xstr("menu_view_debug_key")), 1180 CONTROL_MASK, ACCEL_VISIBLE) 1189 Gdk.ModifierType.CONTROL_MASK, 1190 Gtk.AccelFlags.VISIBLE) 1181 1191 showDebugMenuItem.connect("toggled", self._toggleDebugLog) 1182 1192 viewMenu.append(showDebugMenuItem) … … 1192 1202 manualMenuItem.add_accelerator("activate", accelGroup, 1193 1203 ord(xstr("menu_help_manual_key")), 1194 CONTROL_MASK, ACCEL_VISIBLE) 1204 Gdk.ModifierType.CONTROL_MASK, 1205 Gtk.AccelFlags.VISIBLE) 1195 1206 manualMenuItem.connect("activate", self._showManual) 1196 1207 helpMenu.append(manualMenuItem) … … 1203 1214 aboutMenuItem.add_accelerator("activate", accelGroup, 1204 1215 ord(xstr("menu_help_about_key")), 1205 CONTROL_MASK, ACCEL_VISIBLE) 1216 Gdk.ModifierType.CONTROL_MASK, 1217 Gtk.AccelFlags.VISIBLE) 1206 1218 aboutMenuItem.connect("activate", self._showAbout) 1207 1219 helpMenu.append(aboutMenuItem) … … 1254 1266 """Quit from the application.""" 1255 1267 if force: 1256 result= RESPONSETYPE_YES1268 result=Gtk.ResponseType.YES 1257 1269 else: 1258 1270 dialog = Gtk.MessageDialog(parent = self._mainWindow, 1259 type = MESSAGETYPE_QUESTION,1271 type = Gtk.MessageType.QUESTION, 1260 1272 message_format = xstr("quit_question")) 1261 1273 1262 dialog.add_button(xstr("button_no"), RESPONSETYPE_NO)1263 dialog.add_button(xstr("button_yes"), RESPONSETYPE_YES)1274 dialog.add_button(xstr("button_no"), Gtk.ResponseType.NO) 1275 dialog.add_button(xstr("button_yes"), Gtk.ResponseType.YES) 1264 1276 1265 1277 dialog.set_title(WINDOW_TITLE_BASE) … … 1267 1279 dialog.hide() 1268 1280 1269 if result== RESPONSETYPE_YES:1281 if result==Gtk.ResponseType.YES: 1270 1282 self._statusIcon.destroy() 1271 1283 return Gtk.main_quit() … … 1324 1336 else: 1325 1337 dialog = Gtk.MessageDialog(parent = self.mainWindow, 1326 type = MESSAGETYPE_ERROR,1338 type = Gtk.MessageType.ERROR, 1327 1339 message_format = xstr("timetable_failed")) 1328 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1340 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1329 1341 dialog.set_title(WINDOW_TITLE_BASE) 1330 1342 dialog.run() … … 1354 1366 else: 1355 1367 dialog = Gtk.MessageDialog(parent = self.mainWindow, 1356 type = MESSAGETYPE_ERROR,1368 type = Gtk.MessageType.ERROR, 1357 1369 message_format = xstr("acceptedflt_failed")) 1358 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1370 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1359 1371 dialog.set_title(WINDOW_TITLE_BASE) 1360 1372 dialog.run() … … 1419 1431 self._pirepEditor.setPIREP(pirep) 1420 1432 self._pirepEditor.show_all() 1421 if self._pirepEditor.run()== RESPONSETYPE_OK:1433 if self._pirepEditor.run()==Gtk.ResponseType.OK: 1422 1434 self.beginBusy(xstr("pirepEdit_save_busy")) 1423 1435 self.webHandler.sendPIREP(self._pirepUpdatedCallback, pirep, … … 1434 1446 self.endBusy() 1435 1447 secondaryMarkup = None 1436 type = MESSAGETYPE_ERROR1448 type = Gtk.MessageType.ERROR 1437 1449 if returned: 1438 1450 if result.success: … … 1454 1466 dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 1455 1467 type = type, message_format = messageFormat) 1456 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1468 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1457 1469 dialog.set_title(WINDOW_TITLE_BASE) 1458 1470 if secondaryMarkup is not None: … … 1478 1490 dialog.hide() 1479 1491 1480 if result== RESPONSETYPE_OK:1492 if result==Gtk.ResponseType.OK: 1481 1493 self._lastLoadedPIREP = dialog.get_filename() 1482 1494 … … 1484 1496 if pirep is None: 1485 1497 dialog = Gtk.MessageDialog(parent = self._mainWindow, 1486 type = MESSAGETYPE_ERROR,1498 type = Gtk.MessageType.ERROR, 1487 1499 message_format = xstr("loadPIREP_failed")) 1488 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1500 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1489 1501 dialog.set_title(WINDOW_TITLE_BASE) 1490 1502 dialog.format_secondary_markup(xstr("loadPIREP_failed_sec")) … … 1497 1509 result = dialog.run() 1498 1510 1499 if result== RESPONSETYPE_OK:1511 if result==Gtk.ResponseType.OK: 1500 1512 self.sendPIREP(pirep) 1501 1513 elif result==1: … … 1513 1525 dialog = Gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + 1514 1526 xstr("loadPIREP_browser_title"), 1515 action = FILE_CHOOSER_ACTION_OPEN,1527 action = Gtk.FileChooserAction.OPEN, 1516 1528 buttons = (Gtk.STOCK_CANCEL, 1517 RESPONSETYPE_CANCEL,1518 Gtk.STOCK_OK, RESPONSETYPE_OK),1529 Gtk.ResponseType.CANCEL, 1530 Gtk.STOCK_OK, Gtk.ResponseType.OK), 1519 1531 parent = self._mainWindow) 1520 1532 dialog.set_modal(True) … … 1541 1553 xstr("loadPIREP_send_title"), 1542 1554 parent = self._mainWindow, 1543 flags = DIALOG_MODAL)1555 flags = Gtk.DialogFlags.MODAL) 1544 1556 1545 1557 contentArea = dialog.get_content_area() … … 1636 1648 table.attach(labelAlignment, 1, 2, 4, 5) 1637 1649 1638 dialog.add_button(xstr("button_cancel"), RESPONSETYPE_REJECT)1650 dialog.add_button(xstr("button_cancel"), Gtk.ResponseType.REJECT) 1639 1651 dialog.add_button(xstr("viewPIREP"), 1) 1640 dialog.add_button(xstr("sendPIREP"), RESPONSETYPE_OK)1652 dialog.add_button(xstr("sendPIREP"), Gtk.ResponseType.OK) 1641 1653 1642 1654 return dialog … … 1656 1668 self.endBusy() 1657 1669 secondaryMarkup = None 1658 type = MESSAGETYPE_ERROR1670 type = Gtk.MessageType.ERROR 1659 1671 if returned: 1660 1672 if result.success: 1661 type = MESSAGETYPE_INFO1673 type = Gtk.MessageType.INFO 1662 1674 messageFormat = xstr("sendPIREP_success") 1663 1675 secondaryMarkup = xstr("sendPIREP_success_sec") … … 1677 1689 dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow, 1678 1690 type = type, message_format = messageFormat) 1679 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1691 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1680 1692 dialog.set_title(WINDOW_TITLE_BASE) 1681 1693 if secondaryMarkup is not None: … … 1723 1735 self.endBusy() 1724 1736 secondaryMarkup = None 1725 type = MESSAGETYPE_ERROR1737 type = Gtk.MessageType.ERROR 1726 1738 if returned: 1727 1739 if result.success: 1728 type = MESSAGETYPE_INFO1740 type = Gtk.MessageType.INFO 1729 1741 messageFormat = xstr("sendBugReport_success") % (result.ticketID,) 1730 1742 secondaryMarkup = xstr("sendBugReport_success_sec") … … 1738 1750 dialog = Gtk.MessageDialog(parent = self._wizard.gui._bugReportDialog, 1739 1751 type = type, message_format = messageFormat) 1740 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)1752 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 1741 1753 dialog.set_title(WINDOW_TITLE_BASE) 1742 1754 if secondaryMarkup is not None: … … 1815 1827 1816 1828 logoPath = os.path.join(self._programDirectory, "logo.png") 1817 logo = pixbuf_new_from_file(logoPath)1829 logo = GdkPixbuf.Pixbuf.new_from_file(logoPath) 1818 1830 dialog.set_logo(logo) 1819 1831 … … 1887 1899 response = dialog.run() 1888 1900 1889 if response== RESPONSETYPE_OK:1901 if response==Gtk.ResponseType.OK: 1890 1902 self._credentialsUserName = dialog.userName 1891 1903 self._credentialsPassword = dialog.password … … 1915 1927 if not self.config.pilotID and not self.config.password: 1916 1928 dialog = Gtk.MessageDialog(parent = self._mainWindow, 1917 type = MESSAGETYPE_QUESTION,1929 type = Gtk.MessageType.QUESTION, 1918 1930 message_format = xstr("register_ask")) 1919 1931 -
src/mlx/gui/info.py
r996 r999 41 41 42 42 scroller = Gtk.ScrolledWindow() 43 scroller.set_policy( POLICY_AUTOMATIC, POLICY_AUTOMATIC)44 scroller.set_shadow_type( SHADOW_IN)43 scroller.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) 44 scroller.set_shadow_type(Gtk.ShadowType.IN) 45 45 46 46 comments = Gtk.TextView() 47 comments.set_wrap_mode( WRAP_WORD)47 comments.set_wrap_mode(Gtk.WrapMode.WORD) 48 48 scroller.add(comments) 49 49 alignment.add(scroller) … … 90 90 scrolledWindow.add(table) 91 91 scrolledWindow.set_size_request(-1, 185) 92 scrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) 93 scrolledWindow.set_shadow_type(SHADOW_IN) 92 scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, 93 Gtk.PolicyType.AUTOMATIC) 94 scrolledWindow.set_shadow_type(Gtk.ShadowType.IN) 94 95 95 96 alignment.add(scrolledWindow) -
src/mlx/gui/pirep.py
r996 r999 40 40 heading.set_editable(False) 41 41 heading.set_can_focus(False) 42 heading.set_wrap_mode( WRAP_WORD)42 heading.set_wrap_mode(Gtk.WrapMode.WORD) 43 43 heading.set_size_request(-1, 16) 44 44 45 45 buffer = heading.get_buffer() 46 self._headingTag = buffer.create_tag("heading", weight= WEIGHT_BOLD)46 self._headingTag = buffer.create_tag("heading", weight=Pango.Weight.BOLD) 47 47 buffer.set_text("%s - %s" % (senderPID, senderName)) 48 48 buffer.apply_tag(self._headingTag, … … 57 57 58 58 self._messageView = messageView = Gtk.TextView() 59 messageView.set_wrap_mode( WRAP_WORD)59 messageView.set_wrap_mode(Gtk.WrapMode.WORD) 60 60 messageView.set_editable(False) 61 61 messageView.set_can_focus(False) … … 112 112 113 113 scroller = Gtk.ScrolledWindow() 114 scroller.set_policy( POLICY_AUTOMATIC, POLICY_AUTOMATIC)115 scroller.set_shadow_type( SHADOW_NONE)114 scroller.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) 115 scroller.set_shadow_type(Gtk.ShadowType.NONE) 116 116 117 117 self._messages = Gtk.VBox() … … 204 204 - the text view.""" 205 205 scrolledWindow = Gtk.ScrolledWindow() 206 scrolledWindow.set_shadow_type(SHADOW_IN) 207 scrolledWindow.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) 206 scrolledWindow.set_shadow_type(Gtk.ShadowType.IN) 207 scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, 208 Gtk.PolicyType.AUTOMATIC) 208 209 209 210 textView = Gtk.TextView() 210 textView.set_wrap_mode( WRAP_WORD)211 textView.set_wrap_mode(Gtk.WrapMode.WORD) 211 212 textView.set_editable(editable) 212 213 textView.set_cursor_visible(editable) … … 313 314 self._notebook.append_page(messagesTab, label) 314 315 315 self._okButton = self.add_button(xstr("button_ok"), RESPONSETYPE_OK)316 self._okButton = self.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 316 317 self._okButton.set_can_default(True) 317 318 … … 868 869 self._notebook.append_page(logTab, label) 869 870 870 self.add_button(xstr("button_cancel"), RESPONSETYPE_CANCEL)871 872 self._okButton = self.add_button(xstr("button_save"), RESPONSETYPE_NONE)871 self.add_button(xstr("button_cancel"), Gtk.ResponseType.CANCEL) 872 873 self._okButton = self.add_button(xstr("button_save"), Gtk.ResponseType.NONE) 873 874 self._okButton.connect("clicked", self._okClicked) 874 875 self._okButton.set_can_default(True) … … 1512 1513 The PIREP is updated from the data in the window.""" 1513 1514 if not askYesNo(xstr("pirepEdit_save_question"), parent = self): 1514 self.response( RESPONSETYPE_CANCEL)1515 self.response(Gtk.ResponseType.CANCEL) 1515 1516 1516 1517 pirep = self._pirep … … 1559 1560 pirep.flightDefects = self._flightInfo.faultsAndExplanations 1560 1561 1561 self.response( RESPONSETYPE_OK)1562 self.response(Gtk.ResponseType.OK) 1562 1563 1563 1564 -
src/mlx/gui/prefs.py
r996 r999 173 173 xstr("prefs_title"), 174 174 gui.mainWindow, 175 DIALOG_MODAL)176 177 self.add_button(xstr("button_cancel"), RESPONSETYPE_REJECT)178 self.add_button(xstr("button_ok"), RESPONSETYPE_ACCEPT)175 Gtk.DialogFlags.MODAL) 176 177 self.add_button(xstr("button_cancel"), Gtk.ResponseType.REJECT) 178 self.add_button(xstr("button_ok"), Gtk.ResponseType.ACCEPT) 179 179 self.set_resizable(False) 180 180 … … 222 222 self.hide() 223 223 224 if response== RESPONSETYPE_ACCEPT:224 if response==Gtk.ResponseType.ACCEPT: 225 225 self._toConfig(config) 226 226 config.save() … … 512 512 if not self._changingLanguage and not self._warnedRestartNeeded: 513 513 dialog = Gtk.MessageDialog(parent = self, 514 type = MESSAGETYPE_INFO,514 type = Gtk.MessageType.INFO, 515 515 message_format = xstr("prefs_restart")) 516 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)516 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 517 517 dialog.set_title(self.get_title()) 518 518 dialog.format_secondary_markup(xstr("prefs_language_restart_sec")) … … 550 550 dialog = Gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " + 551 551 xstr("prefs_pirepDirectory_browser_title"), 552 action = FILE_CHOOSER_ACTION_SELECT_FOLDER,553 buttons = (Gtk.STOCK_CANCEL, RESPONSETYPE_CANCEL,554 Gtk.STOCK_OK, RESPONSETYPE_OK),552 action = Gtk.FileChooserAction.SELECT_FOLDER, 553 buttons = (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, 554 Gtk.STOCK_OK, Gtk.ResponseType.OK), 555 555 parent = self) 556 556 dialog.set_modal(True) … … 564 564 dialog.hide() 565 565 566 if result== RESPONSETYPE_OK:566 if result==Gtk.ResponseType.OK: 567 567 self._pirepDirectory.set_text(dialog.get_filename()) 568 568 … … 592 592 593 593 label = Gtk.Label(xstr("prefs_msgs_fs")) 594 label.set_justify( JUSTIFY_CENTER)594 label.set_justify(Gtk.Justification.CENTER) 595 595 label.set_alignment(0.5, 1.0) 596 596 table.attach(label, 1, 2, 0, 1) 597 597 598 598 label = Gtk.Label(xstr("prefs_msgs_sound")) 599 label.set_justify( JUSTIFY_CENTER)599 label.set_justify(Gtk.Justification.CENTER) 600 600 label.set_alignment(0.5, 1.0) 601 601 table.attach(label, 2, 3, 0, 1) … … 607 607 messageTypeStr = const.messageType2string(messageType) 608 608 label = Gtk.Label(xstr("prefs_msgs_type_" + messageTypeStr)) 609 label.set_justify( JUSTIFY_CENTER)609 label.set_justify(Gtk.Justification.CENTER) 610 610 label.set_use_underline(True) 611 611 label.set_alignment(0.5, 0.5) … … 834 834 pass 835 835 836 okButton = self.get_widget_for_response( RESPONSETYPE_ACCEPT)836 okButton = self.get_widget_for_response(Gtk.ResponseType.ACCEPT) 837 837 okButton.set_sensitive(sensitive) 838 838 … … 842 842 not self._autoUpdate.get_active(): 843 843 dialog = Gtk.MessageDialog(parent = self, 844 type = MESSAGETYPE_INFO,844 type = Gtk.MessageType.INFO, 845 845 message_format = xstr("prefs_update_auto_warning")) 846 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)846 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 847 847 dialog.set_title(self.get_title()) 848 848 dialog.run() -
src/mlx/gui/statusbar.py
r997 r999 42 42 43 43 iconPath = os.path.join(iconDirectory, "conn_grey.png") 44 self._connGreyIcon = pixbuf_new_from_file(iconPath)44 self._connGreyIcon = GdkPixbuf.Pixbuf.new_from_file(iconPath) 45 45 46 46 iconPath = os.path.join(iconDirectory, "conn_red.png") 47 self._connRedIcon = pixbuf_new_from_file(iconPath)47 self._connRedIcon = GdkPixbuf.Pixbuf.new_from_file(iconPath) 48 48 49 49 iconPath = os.path.join(iconDirectory, "conn_green.png") 50 self._connGreenIcon = pixbuf_new_from_file(iconPath)50 self._connGreenIcon = GdkPixbuf.Pixbuf.new_from_file(iconPath) 51 51 52 52 self._connStateArea = Gtk.DrawingArea() -
src/mlx/gui/timetable.py
r997 r999 76 76 self._model = Gtk.ListStore(*types) 77 77 if defaultSortableIndex is not None: 78 sortOrder = SORT_DESCENDING \78 sortOrder = Gtk.SortType.DESCENDING \ 79 79 if self._columnDescriptors[defaultSortableIndex-1]._defaultDescending \ 80 else SORT_ASCENDING80 else Gtk.SortType.ASCENDING 81 81 self._model.set_sort_column_id(defaultSortableIndex, sortOrder) 82 82 self._view = Gtk.TreeView(self._model) … … 175 175 def _buttonPressEvent(self, widget, event): 176 176 """Called when a mouse button is pressed or released.""" 177 if event.type!= EVENT_BUTTON_PRESS or event.button!=3 or \177 if event.type!=Gdk.EventType.BUTTON_PRESS or event.button!=3 or \ 178 178 self._popupMenuProducer is None: 179 179 return … … 441 441 contentArea.pack_start(frame, True, True, 4) 442 442 443 self.add_button(xstr("button_cancel"), RESPONSETYPE_CANCEL)444 445 self._okButton = self.add_button(xstr("button_book"), RESPONSETYPE_OK)443 self.add_button(xstr("button_cancel"), Gtk.ResponseType.CANCEL) 444 445 self._okButton = self.add_button(xstr("button_book"), Gtk.ResponseType.OK) 446 446 self._okButton.set_use_underline(True) 447 447 self._okButton.set_can_default(True) … … 755 755 result = dialog.run() 756 756 dialog.hide() 757 if result== RESPONSETYPE_OK:757 if result==Gtk.ResponseType.OK: 758 758 flightIDs = [flightPair.flight0.id] 759 759 if flightPair.flight1 is not None: … … 772 772 if returned: 773 773 dialog = Gtk.MessageDialog(parent = self, 774 type = MESSAGETYPE_INFO,774 type = Gtk.MessageType.INFO, 775 775 message_format = xstr("bookflights_successful")) 776 776 dialog.format_secondary_markup(xstr("bookflights_successful_secondary")) 777 777 else: 778 778 dialog = Gtk.MessageDialog(parent = self, 779 type = MESSAGETYPE_ERROR,779 type = Gtk.MessageType.ERROR, 780 780 message_format = xstr("bookflights_failed")) 781 781 dialog.format_secondary_markup(xstr("bookflights_failed_secondary")) 782 782 783 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)783 dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 784 784 dialog.set_title(WINDOW_TITLE_BASE) 785 785
Note:
See TracChangeset
for help on using the changeset viewer.