Changeset 76:f5b2b0022cdf for src/mlx


Ignore:
Timestamp:
04/14/12 05:24:38 (13 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added a Quit option to the status icon's menu and a confirmation dialog.

Location:
src/mlx/gui
Files:
1 added
4 edited

Legend:

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

    r44 r76  
    2020
    2121    MESSAGETYPE_ERROR = gtk.MESSAGE_ERROR
     22    MESSAGETYPE_QUESTION = gtk.MESSAGE_QUESTION
    2223    BUTTONSTYPE_OK = gtk.BUTTONS_OK
     24    BUTTONSTYPE_YES_NO = gtk.BUTTONS_YES_NO
     25    RESPONSETYPE_YES = gtk.RESPONSE_YES
    2326else:
    2427    print "Using PyGObject"
     
    3033    from gi.repository import Pango as pango
    3134    appIndicator = True
    32 
     35   
    3336    MESSAGETYPE_ERROR = gtk.MessageType.ERROR
     37    MESSAGETYPE_QUESTION = gtk.MessageType.QUESTION
    3438    BUTTONSTYPE_OK = gtk.ButtonsType.OK
     39    BUTTONSTYPE_YES_NO = gtk.ButtonsType.YES_NO
     40    RESPONSETYPE_YES = gtk.ResponseType.YES
    3541
    3642import cairo
  • src/mlx/gui/flight.py

    r75 r76  
    13461346        self._starButton = gtk.CheckButton()
    13471347        self._starButton.connect("clicked", self._starButtonClicked)
    1348         self._starButton.set_active(True)
    13491348        table.attach(self._starButton, 0, 1, 0, 1)
    13501349
     
    13641363        self._transitionButton = gtk.CheckButton()
    13651364        self._transitionButton.connect("clicked", self._transitionButtonClicked)
    1366         self._transitionButton.set_active(True)
    13671365        table.attach(self._transitionButton, 0, 1, 1, 2)
    13681366
     
    14001398        self._approachType.set_width_chars(10)
    14011399        self._approachType.set_tooltip_text("The type of the approach, e.g. ILS or VISUAL.")
    1402         self._runway.connect("changed", self._updateForwardButton)
     1400        self._approachType.connect("changed", self._updateForwardButton)
    14031401        table.attach(self._approachType, 2, 3, 3, 4)
    14041402        label.set_mnemonic_widget(self._approachType)
     
    14281426        self._button.set_use_stock(True)
    14291427        self._button.connect("clicked", self._forwardClicked)
     1428
     1429        # These are needed for correct size calculations
     1430        self._starButton.set_active(True)
     1431        self._transitionButton.set_active(True)
    14301432
    14311433    def activate(self):
  • src/mlx/gui/gui.py

    r71 r76  
    843843    def _quit(self, what = None):
    844844        """Quit from the application."""
    845         self._statusIcon.destroy()
    846         return gtk.main_quit()
     845        dialog = gtk.MessageDialog(type = MESSAGETYPE_QUESTION,
     846                                   buttons = BUTTONSTYPE_YES_NO,
     847                                   message_format =
     848                                   "Are you sure to quit the logger?")
     849        result = dialog.run()
     850        dialog.hide()
     851       
     852        if result==RESPONSETYPE_YES:
     853            self._statusIcon.destroy()
     854            return gtk.main_quit()
    847855
    848856    def _notebookPageSwitch(self, notebook, page, page_num):
  • src/mlx/gui/statusicon.py

    r38 r76  
    3939        self._showHideMenuItem.show() 
    4040        menu.append(self._showHideMenuItem) 
     41
     42        self._quitMenuItem = gtk.MenuItem() 
     43        self._quitMenuItem.set_label("Quit") 
     44        self._quitMenuItem.show() 
     45        self._quitMenuItem.connect("activate", self._gui._quit)
     46        menu.append(self._quitMenuItem) 
    4147
    4248        menu.show() 
Note: See TracChangeset for help on using the changeset viewer.