Ignore:
Timestamp:
05/15/12 15:01:07 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

If the program is started in several instances, the ones after the first one just show the window of the running instance

File:
1 edited

Legend:

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

    r178 r182  
    1919import mlx.acft as acft
    2020import mlx.web as web
     21import mlx.singleton as singleton
    2122from  mlx.i18n import xstr
    2223from mlx.pirep import PIREP
     
    306307                                    self._mainWindow)
    307308            self._updater.start()
    308 
     309       
     310        singleton.raiseCallback = self.raiseCallback
    309311        gtk.main()
     312        singleton.raiseCallback = None
    310313
    311314        self._disconnect()
     
    499502           (event.new_window_state&iconified)!=0:
    500503            self.hideMainWindow(savePosition = False)
     504
     505    def raiseCallback(self):
     506        """Callback for the singleton handling code."""
     507        gobject.idle_add(self.raiseMainWindow)
     508
     509    def raiseMainWindow(self):
     510        """SHow the main window if invisible, and raise it."""
     511        if not self._mainWindow.get_visible():
     512            self.showMainWindow()
     513        self._mainWindow.present()
    501514
    502515    def hideMainWindow(self, savePosition = True):
Note: See TracChangeset for help on using the changeset viewer.