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/gui.py

    r997 r999  
    502502
    503503        dialog = Gtk.MessageDialog(parent = self._mainWindow,
    504                                    type = MESSAGETYPE_ERROR,
     504                                   type = Gtk.MessageType.ERROR,
    505505                                   message_format = xstr("conn_failed"))
    506506
     
    533533        self._statusbar.updateConnection(self._connecting, self._connected)
    534534
    535         dialog = Gtk.MessageDialog(type = MESSAGETYPE_ERROR,
     535        dialog = Gtk.MessageDialog(type = Gtk.MessageType.ERROR,
    536536                                   message_format = xstr("conn_broken"),
    537537                                   parent = self._mainWindow)
     
    592592        """Cancel the current file, if the user confirms it."""
    593593        dialog = Gtk.MessageDialog(parent = self._mainWindow,
    594                                    type = MESSAGETYPE_QUESTION,
     594                                   type = Gtk.MessageType.QUESTION,
    595595                                   message_format = xstr("cancelFlight_question"))
    596596
    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)
    599599
    600600        dialog.set_title(WINDOW_TITLE_BASE)
     
    602602        dialog.hide()
    603603
    604         if result==RESPONSETYPE_YES:
     604        if result==Gtk.ResponseType.YES:
    605605            self.reset()
    606606
     
    741741        iconified = Gdk.WindowState.ICONIFIED
    742742
    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:
    745745                self._statusIcon.mainWindowHidden()
    746746            else:
    747747                self._statusIcon.mainWindowShown()
    748748
    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:
    751751            self._mainWindow.present()
    752752
     
    931931
    932932            dialog = Gtk.MessageDialog(parent = self.mainWindow,
    933                                        type = MESSAGETYPE_ERROR,
     933                                       type = Gtk.MessageType.ERROR,
    934934                                       message_format = xstr("fleet_failed"))
    935             dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     935            dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    936936            dialog.set_title(WINDOW_TITLE_BASE)
    937937            dialog.run()
     
    976976        else:
    977977            dialog = Gtk.MessageDialog(parent = self.mainWindow,
    978                                        type = MESSAGETYPE_ERROR,
     978                                       type = Gtk.MessageType.ERROR,
    979979                                       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)
    981981            dialog.set_title(WINDOW_TITLE_BASE)
    982982            dialog.run()
     
    10771077        loadPIREPMenuItem.add_accelerator("activate", accelGroup,
    10781078                                          ord(xstr("menu_file_loadPIREP_key")),
    1079                                           CONTROL_MASK, ACCEL_VISIBLE)
     1079                                          Gdk.ModifierType.CONTROL_MASK,
     1080                                          Gtk.AccelFlags.VISIBLE)
    10801081        loadPIREPMenuItem.connect("activate", self._loadPIREP)
    10811082        fileMenu.append(loadPIREPMenuItem)
     
    10881089        quitMenuItem.add_accelerator("activate", accelGroup,
    10891090                                     ord(xstr("menu_file_quit_key")),
    1090                                      CONTROL_MASK, ACCEL_VISIBLE)
     1091                                     Gdk.ModifierType.CONTROL_MASK,
     1092                                     Gtk.AccelFlags.VISIBLE)
    10911093        quitMenuItem.connect("activate", self._quit)
    10921094        fileMenu.append(quitMenuItem)
     
    11031105        timetableMenuItem.add_accelerator("activate", accelGroup,
    11041106                                          ord(xstr("menu_tools_timetable_key")),
    1105                                           CONTROL_MASK, ACCEL_VISIBLE)
     1107                                          Gdk.ModifierType.CONTROL_MASK,
     1108                                          Gtk.AccelFlags.VISIBLE)
    11061109        timetableMenuItem.connect("activate", self.showTimetable)
    11071110        self._timetableMenuItem.set_sensitive(False)
     
    11141117        flightsMenuItem.add_accelerator("activate", accelGroup,
    11151118                                        ord(xstr("menu_tools_flights_key")),
    1116                                         CONTROL_MASK, ACCEL_VISIBLE)
     1119                                        Gdk.ModifierType.CONTROL_MASK,
     1120                                        Gtk.AccelFlags.VISIBLE)
    11171121        flightsMenuItem.connect("activate", self.showFlights)
    11181122        self._flightsMenuItem.set_sensitive(False)
     
    11241128        checklistMenuItem.add_accelerator("activate", accelGroup,
    11251129                                          ord(xstr("menu_tools_chklst_key")),
    1126                                           CONTROL_MASK, ACCEL_VISIBLE)
     1130                                          Gdk.ModifierType.CONTROL_MASK,
     1131                                          Gtk.AccelFlags.VISIBLE)
    11271132        checklistMenuItem.connect("activate", self._editChecklist)
    11281133        toolsMenu.append(checklistMenuItem)
     
    11331138        approachCalloutsMenuItem.add_accelerator("activate", accelGroup,
    11341139                                                 ord(xstr("menu_tools_callouts_key")),
    1135                                                  CONTROL_MASK, ACCEL_VISIBLE)
     1140                                                 Gdk.ModifierType.CONTROL_MASK,
     1141                                                 Gtk.AccelFlags.VISIBLE)
    11361142        approachCalloutsMenuItem.connect("activate", self._editApproachCallouts)
    11371143        toolsMenu.append(approachCalloutsMenuItem)
     
    11421148        prefsMenuItem.add_accelerator("activate", accelGroup,
    11431149                                      ord(xstr("menu_tools_prefs_key")),
    1144                                       CONTROL_MASK, ACCEL_VISIBLE)
     1150                                      Gdk.ModifierType.CONTROL_MASK,
     1151                                      Gtk.AccelFlags.VISIBLE)
    11451152        prefsMenuItem.connect("activate", self._editPreferences)
    11461153        toolsMenu.append(prefsMenuItem)
     
    11531160        bugReportMenuItem.add_accelerator("activate", accelGroup,
    11541161                                          ord(xstr("menu_tools_bugreport_key")),
    1155                                           CONTROL_MASK, ACCEL_VISIBLE)
     1162                                          Gdk.ModifierType.CONTROL_MASK,
     1163                                          Gtk.AccelFlags.VISIBLE)
    11561164        bugReportMenuItem.connect("activate", self._reportBug)
    11571165        toolsMenu.append(bugReportMenuItem)
     
    11681176        self._showMonitorMenuItem.add_accelerator("activate", accelGroup,
    11691177                                                  ord(xstr("menu_view_monitor_key")),
    1170                                                   CONTROL_MASK, ACCEL_VISIBLE)
     1178                                                  Gdk.ModifierType.CONTROL_MASK,
     1179                                                  Gtk.AccelFlags.VISIBLE)
    11711180        self._showMonitorMenuItem.connect("toggled", self._toggleMonitorWindow)
    11721181        viewMenu.append(self._showMonitorMenuItem)
     
    11781187        showDebugMenuItem.add_accelerator("activate", accelGroup,
    11791188                                          ord(xstr("menu_view_debug_key")),
    1180                                           CONTROL_MASK, ACCEL_VISIBLE)
     1189                                          Gdk.ModifierType.CONTROL_MASK,
     1190                                          Gtk.AccelFlags.VISIBLE)
    11811191        showDebugMenuItem.connect("toggled", self._toggleDebugLog)
    11821192        viewMenu.append(showDebugMenuItem)
     
    11921202        manualMenuItem.add_accelerator("activate", accelGroup,
    11931203                                       ord(xstr("menu_help_manual_key")),
    1194                                        CONTROL_MASK, ACCEL_VISIBLE)
     1204                                       Gdk.ModifierType.CONTROL_MASK,
     1205                                       Gtk.AccelFlags.VISIBLE)
    11951206        manualMenuItem.connect("activate", self._showManual)
    11961207        helpMenu.append(manualMenuItem)
     
    12031214        aboutMenuItem.add_accelerator("activate", accelGroup,
    12041215                                      ord(xstr("menu_help_about_key")),
    1205                                       CONTROL_MASK, ACCEL_VISIBLE)
     1216                                      Gdk.ModifierType.CONTROL_MASK,
     1217                                      Gtk.AccelFlags.VISIBLE)
    12061218        aboutMenuItem.connect("activate", self._showAbout)
    12071219        helpMenu.append(aboutMenuItem)
     
    12541266        """Quit from the application."""
    12551267        if force:
    1256             result=RESPONSETYPE_YES
     1268            result=Gtk.ResponseType.YES
    12571269        else:
    12581270            dialog = Gtk.MessageDialog(parent = self._mainWindow,
    1259                                        type = MESSAGETYPE_QUESTION,
     1271                                       type = Gtk.MessageType.QUESTION,
    12601272                                       message_format = xstr("quit_question"))
    12611273
    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)
    12641276
    12651277            dialog.set_title(WINDOW_TITLE_BASE)
     
    12671279            dialog.hide()
    12681280
    1269         if result==RESPONSETYPE_YES:
     1281        if result==Gtk.ResponseType.YES:
    12701282            self._statusIcon.destroy()
    12711283            return Gtk.main_quit()
     
    13241336        else:
    13251337            dialog = Gtk.MessageDialog(parent = self.mainWindow,
    1326                                        type = MESSAGETYPE_ERROR,
     1338                                       type = Gtk.MessageType.ERROR,
    13271339                                       message_format = xstr("timetable_failed"))
    1328             dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     1340            dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    13291341            dialog.set_title(WINDOW_TITLE_BASE)
    13301342            dialog.run()
     
    13541366        else:
    13551367            dialog = Gtk.MessageDialog(parent = self.mainWindow,
    1356                                        type = MESSAGETYPE_ERROR,
     1368                                       type = Gtk.MessageType.ERROR,
    13571369                                       message_format = xstr("acceptedflt_failed"))
    1358             dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     1370            dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    13591371            dialog.set_title(WINDOW_TITLE_BASE)
    13601372            dialog.run()
     
    14191431        self._pirepEditor.setPIREP(pirep)
    14201432        self._pirepEditor.show_all()
    1421         if self._pirepEditor.run()==RESPONSETYPE_OK:
     1433        if self._pirepEditor.run()==Gtk.ResponseType.OK:
    14221434            self.beginBusy(xstr("pirepEdit_save_busy"))
    14231435            self.webHandler.sendPIREP(self._pirepUpdatedCallback, pirep,
     
    14341446        self.endBusy()
    14351447        secondaryMarkup = None
    1436         type = MESSAGETYPE_ERROR
     1448        type = Gtk.MessageType.ERROR
    14371449        if returned:
    14381450            if result.success:
     
    14541466            dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow,
    14551467                                       type = type, message_format = messageFormat)
    1456             dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     1468            dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    14571469            dialog.set_title(WINDOW_TITLE_BASE)
    14581470            if secondaryMarkup is not None:
     
    14781490        dialog.hide()
    14791491
    1480         if result==RESPONSETYPE_OK:
     1492        if result==Gtk.ResponseType.OK:
    14811493            self._lastLoadedPIREP = dialog.get_filename()
    14821494
     
    14841496            if pirep is None:
    14851497                dialog = Gtk.MessageDialog(parent = self._mainWindow,
    1486                                            type = MESSAGETYPE_ERROR,
     1498                                           type = Gtk.MessageType.ERROR,
    14871499                                           message_format = xstr("loadPIREP_failed"))
    1488                 dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     1500                dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    14891501                dialog.set_title(WINDOW_TITLE_BASE)
    14901502                dialog.format_secondary_markup(xstr("loadPIREP_failed_sec"))
     
    14971509                    result = dialog.run()
    14981510
    1499                     if result==RESPONSETYPE_OK:
     1511                    if result==Gtk.ResponseType.OK:
    15001512                        self.sendPIREP(pirep)
    15011513                    elif result==1:
     
    15131525            dialog = Gtk.FileChooserDialog(title = WINDOW_TITLE_BASE + " - " +
    15141526                                           xstr("loadPIREP_browser_title"),
    1515                                            action = FILE_CHOOSER_ACTION_OPEN,
     1527                                           action = Gtk.FileChooserAction.OPEN,
    15161528                                           buttons = (Gtk.STOCK_CANCEL,
    1517                                                       RESPONSETYPE_CANCEL,
    1518                                                       Gtk.STOCK_OK, RESPONSETYPE_OK),
     1529                                                      Gtk.ResponseType.CANCEL,
     1530                                                      Gtk.STOCK_OK, Gtk.ResponseType.OK),
    15191531                                           parent = self._mainWindow)
    15201532            dialog.set_modal(True)
     
    15411553                            xstr("loadPIREP_send_title"),
    15421554                            parent = self._mainWindow,
    1543                             flags = DIALOG_MODAL)
     1555                            flags = Gtk.DialogFlags.MODAL)
    15441556
    15451557        contentArea = dialog.get_content_area()
     
    16361648        table.attach(labelAlignment, 1, 2, 4, 5)
    16371649
    1638         dialog.add_button(xstr("button_cancel"), RESPONSETYPE_REJECT)
     1650        dialog.add_button(xstr("button_cancel"), Gtk.ResponseType.REJECT)
    16391651        dialog.add_button(xstr("viewPIREP"), 1)
    1640         dialog.add_button(xstr("sendPIREP"), RESPONSETYPE_OK)
     1652        dialog.add_button(xstr("sendPIREP"), Gtk.ResponseType.OK)
    16411653
    16421654        return dialog
     
    16561668        self.endBusy()
    16571669        secondaryMarkup = None
    1658         type = MESSAGETYPE_ERROR
     1670        type = Gtk.MessageType.ERROR
    16591671        if returned:
    16601672            if result.success:
    1661                 type = MESSAGETYPE_INFO
     1673                type = Gtk.MessageType.INFO
    16621674                messageFormat = xstr("sendPIREP_success")
    16631675                secondaryMarkup = xstr("sendPIREP_success_sec")
     
    16771689        dialog = Gtk.MessageDialog(parent = self._wizard.gui.mainWindow,
    16781690                                   type = type, message_format = messageFormat)
    1679         dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     1691        dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    16801692        dialog.set_title(WINDOW_TITLE_BASE)
    16811693        if secondaryMarkup is not None:
     
    17231735        self.endBusy()
    17241736        secondaryMarkup = None
    1725         type = MESSAGETYPE_ERROR
     1737        type = Gtk.MessageType.ERROR
    17261738        if returned:
    17271739            if result.success:
    1728                 type = MESSAGETYPE_INFO
     1740                type = Gtk.MessageType.INFO
    17291741                messageFormat = xstr("sendBugReport_success") % (result.ticketID,)
    17301742                secondaryMarkup = xstr("sendBugReport_success_sec")
     
    17381750        dialog = Gtk.MessageDialog(parent = self._wizard.gui._bugReportDialog,
    17391751                                   type = type, message_format = messageFormat)
    1740         dialog.add_button(xstr("button_ok"), RESPONSETYPE_OK)
     1752        dialog.add_button(xstr("button_ok"), Gtk.ResponseType.OK)
    17411753        dialog.set_title(WINDOW_TITLE_BASE)
    17421754        if secondaryMarkup is not None:
     
    18151827
    18161828            logoPath = os.path.join(self._programDirectory, "logo.png")
    1817             logo = pixbuf_new_from_file(logoPath)
     1829            logo = GdkPixbuf.Pixbuf.new_from_file(logoPath)
    18181830            dialog.set_logo(logo)
    18191831
     
    18871899            response = dialog.run()
    18881900
    1889             if response==RESPONSETYPE_OK:
     1901            if response==Gtk.ResponseType.OK:
    18901902                self._credentialsUserName = dialog.userName
    18911903                self._credentialsPassword = dialog.password
     
    19151927        if not self.config.pilotID and not self.config.password:
    19161928            dialog = Gtk.MessageDialog(parent = self._mainWindow,
    1917                                        type = MESSAGETYPE_QUESTION,
     1929                                       type = Gtk.MessageType.QUESTION,
    19181930                                       message_format = xstr("register_ask"))
    19191931
Note: See TracChangeset for help on using the changeset viewer.