Ignore:
Timestamp:
07/04/19 18:54:23 (5 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

Removed Gtk 2/3 constant definitions (re #347)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/flight.py

    r998 r999  
    641641        dialog.hide()
    642642
    643         if response==RESPONSETYPE_OK:
     643        if response==Gtk.ResponseType.OK:
    644644            fileName = dialog.get_filename()
    645645            print("Saving", fileName)
     
    650650                print("Failed to save flight:", util.utf2unicode(str(e)))
    651651                dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow,
    652                                            type = MESSAGETYPE_ERROR,
     652                                           type = Gtk.MessageType.ERROR,
    653653                                           message_format =
    654654                                           xstr("flightsel_save_failed"))
    655                 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     655                dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    656656                dialog.set_title(WINDOW_TITLE_BASE)
    657657                secondary = xstr("flightsel_save_failed_sec")
     
    716716        font = Pango.FontDescription("sans")
    717717        font.set_size(int(32 * scale * Pango.SCALE))
    718         font.set_weight(Pango.WEIGHT_NORMAL)
     718        font.set_weight(Pango.Weight.NORMAL)
    719719        layout.set_font_description(font)
    720720
     
    932932        dialog.hide()
    933933
    934         if response==RESPONSETYPE_OK:
     934        if response==Gtk.ResponseType.OK:
    935935            fileName = dialog.get_filename()
    936936            print("Loading", fileName)
     
    943943                print("Failed to load flight:", util.utf2unicode(str(e)))
    944944                dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow,
    945                                            type = MESSAGETYPE_ERROR,
     945                                           type = Gtk.MessageType.ERROR,
    946946                                           message_format =
    947947                                           xstr("flightsel_load_failed"))
    948                 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     948                dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    949949                dialog.set_title(WINDOW_TITLE_BASE)
    950950                secondary = xstr("flightsel_load_failed_sec")
     
    10261026        dialog = Gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " +
    10271027                                       xstr("flightsel_save_title"),
    1028                                        action = FILE_CHOOSER_ACTION_SAVE,
     1028                                       action = Gtk.FileChooserAction.SAVE,
    10291029                                       buttons = (Gtk.STOCK_CANCEL,
    1030                                                   RESPONSETYPE_CANCEL,
    1031                                                   Gtk.STOCK_OK, RESPONSETYPE_OK),
     1030                                                  Gtk.ResponseType.CANCEL,
     1031                                                  Gtk.STOCK_OK, Gtk.ResponseType.OK),
    10321032                                       parent = gui.mainWindow)
    10331033        dialog.set_modal(True)
     
    10561056        dialog = Gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " +
    10571057                                       xstr("flightsel_load_title"),
    1058                                        action = FILE_CHOOSER_ACTION_OPEN,
     1058                                       action = Gtk.FileChooserAction.OPEN,
    10591059                                       buttons = (Gtk.STOCK_CANCEL,
    1060                                                   RESPONSETYPE_CANCEL,
    1061                                                   Gtk.STOCK_OK, RESPONSETYPE_OK),
     1060                                                  Gtk.ResponseType.CANCEL,
     1061                                                  Gtk.STOCK_OK, Gtk.ResponseType.OK),
    10621062                                       parent = gui.mainWindow)
    10631063        dialog.set_modal(True)
     
    12281228        else:
    12291229            dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow,
    1230                                        type = MESSAGETYPE_ERROR,
     1230                                       type = Gtk.MessageType.ERROR,
    12311231                                       message_format = xstr("gatesel_conflict"))
    1232             dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     1232            dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    12331233            dialog.set_title(WINDOW_TITLE_BASE)
    12341234            dialog.format_secondary_markup(xstr("gatesel_conflict_sec"))
     
    16601660            else:
    16611661                secondaryMessage = xstr("register_nologin") % (result.pilotID,)
    1662             messageType = MESSAGETYPE_INFO
     1662            messageType = Gtk.MessageType.INFO
    16631663
    16641664            config = gui.config
     
    16731673        elif returned and result.emailAlreadyRegistered:
    16741674            secondaryMessage = xstr("register_email_already")
    1675             messageType = MESSAGETYPE_ERROR
     1675            messageType = Gtk.MessageType.ERROR
    16761676        elif returned and result.invalidData:
    16771677            secondaryMessage = xstr("register_invalid_data")
    1678             messageType = MESSAGETYPE_ERROR
     1678            messageType = Gtk.MessageType.ERROR
    16791679        else:
    16801680            secondaryMessage = xstr("register_error")
    1681             messageType = MESSAGETYPE_ERROR
     1681            messageType = Gtk.MessageType.ERROR
    16821682
    16831683        dialog = Gtk.MessageDialog(parent = gui.mainWindow,
     
    17331733        labelAlignment.add(label)
    17341734        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)
    17361737
    17371738        alignment = Gtk.Alignment(xalign=0.0, yalign = 0.5,
     
    17531754
    17541755        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,
    17561758                     ypadding = 4)
    17571759
     
    17621764        label = Gtk.Label(xstr("student_check_flight_status"))
    17631765        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)
    17651768
    17661769        alignment = Gtk.Alignment(xalign=0.0, yalign = 0.5,
     
    18071810
    18081811        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)
    18101814
    18111815    @property
     
    18951899
    18961900        dialog = Gtk.MessageDialog(parent = gui.mainWindow,
    1897                                    type = MESSAGETYPE_INFO,
     1901                                   type = Gtk.MessageType.INFO,
    18981902                                   message_format = xstr("student_fo"))
    18991903
    1900         dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     1904        dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    19011905        dialog.set_title(WINDOW_TITLE_BASE)
    19021906        secondary = xstr("student_fo_secondary")
     
    25012505        self._route = Gtk.TextView()
    25022506        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)
    25042508        self._route.get_buffer().connect("changed", self._routeChanged)
    25052509        self._route.get_buffer().connect_after("insert-text", self._routeInserted)
     
    26262630                                                        xstr("simbrief_credentials_title"),
    26272631                                                        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)
    26312635
    26322636        contentArea = self.get_content_area()
     
    30163020            response = dialog.run()
    30173021
    3018             if response==RESPONSETYPE_OK:
     3022            if response==Gtk.ResponseType.OK:
    30193023                userName = dialog.userName
    30203024                self._userName.set_text(userName)
     
    30543058                                                               "simbrief_result_unknown")
    30553059                dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow,
    3056                                            type = MESSAGETYPE_ERROR,
     3060                                           type = Gtk.MessageType.ERROR,
    30573061                                           message_format =
    30583062                                           xstr(message) + "\n"+
    30593063                                           xstr("simbrief_cancelled"))
    30603064
    3061                 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     3065                dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    30623066                dialog.set_title(WINDOW_TITLE_BASE)
    30633067                secondary = xstr("flightsel_save_failed_sec")
     
    32393243        label.set_use_markup(True)
    32403244        label.set_use_underline(True)
    3241         label.set_justify(JUSTIFY_CENTER)
     3245        label.set_justify(Gtk.Justification.CENTER)
    32423246        label.set_alignment(0.5, 1.0)
    32433247
     
    33793383    def _motionNotify(self, tankFigure, event):
    33803384        """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:
    33823386            self._setExpectedFromY(event.y)
    33833387
     
    33853389        """Called when a scroll event is received."""
    33863390        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 \
    33893393                        else 10 if event.state==0 else 0
    33903394            if increment!=0:
    3391                 if event.direction==SCROLL_DOWN:
     3395                if event.direction==Gdk.ScrollDirection.DOWN:
    33923396                    increment *= -1
    3393                 self._expectedButton.spin(SPIN_USER_DEFINED, increment)
     3397                self._expectedButton.spin(Gtk.SpinType.USER_DEFINED, increment)
    33943398
    33953399    def _expectedChanged(self, spinButton):
     
    47494753        dialog.hide()
    47504754
    4751         if result==RESPONSETYPE_OK:
     4755        if result==Gtk.ResponseType.OK:
    47524756            self._lastSavePath = dialog.get_filename()
    47534757            self._savePIREP(page)
     
    47684772
    47694773        if error:
    4770             type = MESSAGETYPE_ERROR
     4774            type = Gtk.MessageType.ERROR
    47714775            message = xstr("finish_save_failed")
    47724776            secondary = xstr("finish_save_failed_sec") % (error,)
    47734777        else:
    4774             type = MESSAGETYPE_INFO
     4778            type = Gtk.MessageType.INFO
    47754779            message = xstr("finish_save_done")
    47764780            if automatic:
     
    47824786        dialog = Gtk.MessageDialog(parent = gui.mainWindow,
    47834787                                   type = type, message_format = message)
    4784         dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     4788        dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    47854789        dialog.set_title(WINDOW_TITLE_BASE)
    47864790        if secondary is not None:
     
    47984802            dialog = Gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " +
    47994803                                           xstr("finish_save_title"),
    4800                                            action = FILE_CHOOSER_ACTION_SAVE,
     4804                                           action = Gtk.FileChooserAction.SAVE,
    48014805                                           buttons = (Gtk.STOCK_CANCEL,
    4802                                                       RESPONSETYPE_CANCEL,
    4803                                                       Gtk.STOCK_OK, RESPONSETYPE_OK),
     4806                                                      Gtk.ResponseType.CANCEL,
     4807                                                      Gtk.STOCK_OK, Gtk.ResponseType.OK),
    48044808                                           parent = gui.mainWindow)
    48054809            dialog.set_modal(True)
     
    51445148        if not self._pirepSent and not self._pirepSaved:
    51455149            dialog = Gtk.MessageDialog(parent = gui.mainWindow,
    5146                                        type = MESSAGETYPE_QUESTION,
     5150                                       type = Gtk.MessageType.QUESTION,
    51475151                                       message_format = xstr("finish_newFlight_question"))
    51485152
    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)
    51515155
    51525156            dialog.set_title(WINDOW_TITLE_BASE)
    51535157            result = dialog.run()
    51545158            dialog.hide()
    5155             if result!=RESPONSETYPE_YES:
     5159            if result!=Gtk.ResponseType.YES:
    51565160                return
    51575161
     
    53505354        else:
    53515355            dialog = Gtk.MessageDialog(parent = gui.mainWindow,
    5352                                        type = MESSAGETYPE_ERROR,
     5356                                       type = Gtk.MessageType.ERROR,
    53535357                                       message_format =
    53545358                                       xstr("chkfinish_passedset_failed"))
     
    58825886                                   xstr("login_invalid"))
    58835887                dialog = Gtk.MessageDialog(parent = self.gui.mainWindow,
    5884                                            type = MESSAGETYPE_ERROR,
     5888                                           type = Gtk.MessageType.ERROR,
    58855889                                           message_format = message)
    5886                 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     5890                dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    58875891                dialog.set_title(WINDOW_TITLE_BASE)
    58885892                if isReload:
     
    58995903                      else xstr("login_failconn")
    59005904            dialog = Gtk.MessageDialog(parent = self.gui.mainWindow,
    5901                                        type = MESSAGETYPE_ERROR,
     5905                                       type = Gtk.MessageType.ERROR,
    59025906                                       message_format = message)
    5903             dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     5907            dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    59045908            dialog.set_title(WINDOW_TITLE_BASE)
    59055909            secondary = xstr("reload_failconn_sec") if isReload \
Note: See TracChangeset for help on using the changeset viewer.