Changeset 35:d32890325137
- Timestamp:
- 02/26/12 13:11:33 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/gui.py
r32 r35 47 47 win.set_title("MAVA Logger X " + const.VERSION) 48 48 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()) 50 51 win.connect("window-state-event", self._handleMainWindowState) 51 52 … … 143 144 else gdk.WINDOW_STATE_ICONIFIED 144 145 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): 148 149 """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 151 155 self._mainWindow.hide() 152 156 self._statusIcon.mainWindowHidden() … … 155 159 def showMainWindow(self): 156 160 """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() 158 165 self._mainWindow.deiconify() 159 self._mainWindow.show()166 160 167 self._statusIcon.mainWindowShown() 161 168 -
src/mlx/gui/statusicon.py
r32 r35 16 16 17 17 self._gui = gui 18 self._selfToggling = False 18 19 19 20 menu = gtk.Menu() … … 72 73 def mainWindowHidden(self): 73 74 """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) 75 78 76 79 def mainWindowShown(self): 77 80 """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) 79 84 80 85 def _showHideToggled(self, menuitem): 81 86 """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(): 83 90 self._gui.showMainWindow() 84 91 else:
Note:
See TracChangeset
for help on using the changeset viewer.