Ignore:
Timestamp:
02/26/12 13:11:33 (13 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Hiding after minimizing seems to work now

Location:
src/mlx/gui
Files:
2 edited

Legend:

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

    r32 r35  
    4747        win.set_title("MAVA Logger X " + const.VERSION)
    4848        win.set_icon_from_file("logo.ico")
    49         win.connect("delete-event", lambda a, b: self.hideMainWindow())
     49        win.connect("delete-event",
     50                    lambda a, b: self.hideMainWindow())
    5051        win.connect("window-state-event", self._handleMainWindowState)
    5152
     
    143144                    else gdk.WINDOW_STATE_ICONIFIED
    144145        if (event.changed_mask&iconified)!=0 and (event.new_window_state&iconified)!=0:
    145             self.hideMainWindow()
    146 
    147     def hideMainWindow(self):
     146            self.hideMainWindow(savePosition = False)
     147
     148    def hideMainWindow(self, savePosition = True):
    148149        """Hide the main window and save its position."""
    149         (self._mainWindowX, self._mainWindowY) = \
    150             self._mainWindow.get_window().get_root_origin()
     150        if savePosition:
     151            (self._mainWindowX, self._mainWindowY) = \
     152                 self._mainWindow.get_window().get_root_origin()
     153        else:
     154            self._mainWindowX = self._mainWindowY = None
    151155        self._mainWindow.hide()
    152156        self._statusIcon.mainWindowHidden()
     
    155159    def showMainWindow(self):
    156160        """Show the main window at its former position."""
    157         self._mainWindow.move(self._mainWindowX, self._mainWindowY)
     161        if self._mainWindowX is not None and self._mainWindowY is not None:
     162            self._mainWindow.move(self._mainWindowX, self._mainWindowY)
     163
     164        self._mainWindow.show()
    158165        self._mainWindow.deiconify()
    159         self._mainWindow.show()
     166           
    160167        self._statusIcon.mainWindowShown()
    161168
  • src/mlx/gui/statusicon.py

    r32 r35  
    1616
    1717        self._gui = gui
     18        self._selfToggling = False
    1819
    1920        menu = gtk.Menu()
     
    7273    def mainWindowHidden(self):
    7374        """Called when the main window is hidden."""
    74         self._showHideMenuItem.set_active(False)
     75        if self._showHideMenuItem.get_active():
     76            self._selfToggling = True
     77            self._showHideMenuItem.set_active(False)
    7578
    7679    def mainWindowShown(self):
    7780        """Called when the main window is shown."""
    78         self._showHideMenuItem.set_active(True)
     81        if not self._showHideMenuItem.get_active():
     82            self._selfToggling = True
     83            self._showHideMenuItem.set_active(True)
    7984
    8085    def _showHideToggled(self, menuitem):
    8186        """Called when the show/hide menu item is toggled."""
    82         if self._showHideMenuItem.get_active():
     87        if self._selfToggling:
     88            self._selfToggling = False
     89        elif self._showHideMenuItem.get_active():
    8390            self._gui.showMainWindow()
    8491        else:
Note: See TracChangeset for help on using the changeset viewer.