Changeset 105:d1c3dd71da77 for src/mlx


Ignore:
Timestamp:
04/22/12 14:21:23 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

The dialogs now have a proper parent window and title

Location:
src/mlx/gui
Files:
4 edited

Legend:

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

    r97 r105  
    11# Common things for the GUI
     2
     3import mlx.const as _const
    24
    35import os
     
    148150
    149151#------------------------------------------------------------------------------
     152
     153WINDOW_TITLE_BASE = "MAVA Logger X " + _const.VERSION
     154
     155#------------------------------------------------------------------------------
  • src/mlx/gui/flight.py

    r102 r105  
    289289                self._wizard.nextPage()
    290290            else:
    291                 dialog = gtk.MessageDialog(type = MESSAGETYPE_ERROR,
     291                dialog = gtk.MessageDialog(parent = self._wizard.gui.mainWindow,
     292                                           type = MESSAGETYPE_ERROR,
    292293                                           buttons = BUTTONSTYPE_OK,
    293294                                           message_format =
    294295                                           "Invalid pilot's ID or password.")
     296                dialog.set_title(WINDOW_TITLE_BASE)
    295297                dialog.format_secondary_markup("Check the ID and try to reenter"
    296298                                               " the password.")
     
    298300                dialog.hide()
    299301        else:
    300             dialog = gtk.MessageDialog(type = MESSAGETYPE_ERROR,
     302            dialog = gtk.MessageDialog(parent = self._wizard.gui.mainWindow,
     303                                       type = MESSAGETYPE_ERROR,
    301304                                       buttons = BUTTONSTYPE_OK,
    302305                                       message_format =
    303306                                       "Failed to connect to the MAVA website.")
     307            dialog.set_title(WINDOW_TITLE_BASE)
    304308            dialog.format_secondary_markup("Try again in a few minutes.")
    305309            dialog.run()
     
    516520            self._wizard.nextPage()
    517521        else:
    518             dialog = gtk.MessageDialog(type = MESSAGETYPE_ERROR,
     522            dialog = gtk.MessageDialog(parent = self._wizard.gui.mainWindow,
     523                                       type = MESSAGETYPE_ERROR,
    519524                                       buttons = BUTTONSTYPE_OK,
    520525                                       message_format = "Gate conflict detected again")
     526            dialog.set_title(WINDOW_TITLE_BASE)
    521527            dialog.format_secondary_markup("Try to select a different gate.")
    522528            dialog.run()
     
    18921898                type = MESSAGETYPE_INFO
    18931899                messageFormat = "The PIREP was sent successfully."
    1894                 secondaryMarkup = "Await the thorough scrutiny from our PIREP correctors! :)"
     1900                secondaryMarkup = "Await the thorough scrutiny by our fearless PIREP correctors! :)"
    18951901            elif result.alreadyFlown:
    18961902                messageFormat = "The PIREP for this flight has already been sent!"
     
    19081914                              "see the debug log for more information."
    19091915       
    1910         dialog = gtk.MessageDialog(type = type, buttons = BUTTONSTYPE_OK,
     1916        dialog = gtk.MessageDialog(parent = self._wizard.gui.mainWindow,
     1917                                   type = type, buttons = BUTTONSTYPE_OK,
    19111918                                   message_format = messageFormat)
     1919        dialog.set_title(WINDOW_TITLE_BASE)
    19121920        if secondaryMarkup is not None:
    19131921            dialog.format_secondary_markup(secondaryMarkup)
     
    21632171            self._fleet = None
    21642172
    2165             dialog = gtk.MessageDialog(type = MESSAGETYPE_ERROR,
     2173            dialog = gtk.MessageDialog(parent = self.gui.mainWindow,
     2174                                       type = MESSAGETYPE_ERROR,
    21662175                                       buttons = BUTTONSTYPE_OK,
    21672176                                       message_format =
    21682177                                       "Failed to retrieve the information on "
    21692178                                       "the fleet.")
     2179            dialog.set_title(WINDOW_TITLE_BASE)
    21702180            dialog.run()
    21712181            dialog.hide()
     
    21922202            success = None
    21932203
    2194             dialog = gtk.MessageDialog(type = MESSAGETYPE_ERROR,
     2204            dialog = gtk.MessageDialog(parent = self.gui.mainWindow,
     2205                                       type = MESSAGETYPE_ERROR,
    21952206                                       buttons = BUTTONSTYPE_OK,
    21962207                                       message_format =
    21972208                                       "Failed to update the statuis of "
    21982209                                       "the airplane.")
     2210            dialog.set_title(WINDOW_TITLE_BASE)
    21992211            dialog.run()
    22002212            dialog.hide()
  • src/mlx/gui/gui.py

    r99 r105  
    5757       
    5858        window = gtk.Window()
    59         window.set_title("MAVA Logger X " + const.VERSION)
     59        window.set_title(WINDOW_TITLE_BASE)
    6060        window.set_icon_from_file(os.path.join(iconDirectory, "logo.ico"))
    6161        window.connect("delete-event",
     
    119119                                      else gdk.WATCH)
    120120
     121    @property
     122    def mainWindow(self):
     123        """Get the main window of the GUI."""
     124        return self._mainWindow
     125       
    121126    @property
    122127    def logger(self):
     
    286291        self._statusbar.updateConnection(self._connecting, self._connected)
    287292
    288         dialog = gtk.MessageDialog(type = MESSAGETYPE_ERROR,
     293        dialog = gtk.MessageDialog(parent = self._mainWindow,
     294                                   type = MESSAGETYPE_ERROR,
    289295                                   message_format =
    290                                    "Cannot connect to the simulator.",
    291                                    parent = self._mainWindow)
     296                                   "Cannot connect to the simulator.")
     297        dialog.set_title(WINDOW_TITLE_BASE)
    292298        dialog.format_secondary_markup("Rectify the situation, and press <b>Try again</b> "
    293299                                       "to try the connection again, "
     
    321327                                   "The connection to the simulator failed unexpectedly.",
    322328                                   parent = self._mainWindow)
     329        dialog.set_title(WINDOW_TITLE_BASE)
    323330        dialog.format_secondary_markup("If the simulator has crashed, restart it "
    324331                                       "and restore your flight as much as possible "
    325                                        "to the state it was in before the crash.\n"
     332                                       "to the state it was in before the crash. "
    326333                                       "Then press <b>Reconnect</b> to reconnect.\n\n"
    327334                                       "If you want to cancel the flight, press <b>Cancel</b>.")
     
    674681            result=RESPONSETYPE_YES
    675682        else:
    676             dialog = gtk.MessageDialog(type = MESSAGETYPE_QUESTION,
     683            dialog = gtk.MessageDialog(parent = self._mainWindow,
     684                                       type = MESSAGETYPE_QUESTION,
    677685                                       buttons = BUTTONSTYPE_YES_NO,
    678686                                       message_format =
    679687                                       "Are you sure to quit the logger?")
     688            dialog.set_title(WINDOW_TITLE_BASE)
    680689            result = dialog.run()
    681690            dialog.hide()
  • src/mlx/gui/update.py

    r38 r105  
    3939
    4040        Updater._progressWindow = window = gtk.Window()
    41         window.set_title("MAVA Logger X " + const.VERSION + " Update")
     41        window.set_title(WINDOW_TITLE_BASE + " Update")
    4242        window.set_transient_for(parentWindow)
    4343        #win.set_icon_from_file(os.path.join(iconDirectory, "logo.ico"))
     
    7272
    7373        Updater._sudoDialog = sudoDialog = \
    74             gtk.Dialog("MAVA Logger X " + const.VERSION + " Update",
     74            gtk.Dialog(WINDOW_TITLE_BASE + " Update",
    7575                       parentWindow,
    7676                       gtk.DialogFlags.MODAL if pygobject else gtk.DIALOG_MODAL,
Note: See TracChangeset for help on using the changeset viewer.