Changeset 38:08f7e6592452 for src/mlx/gui/gui.py
- Timestamp:
- 03/04/12 09:35:01 (12 years ago)
- Branch:
- default
- hg-Phase:
- (<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/gui.py
r36 r38 13 13 14 14 import time 15 import threading 16 import sys 15 17 16 18 acftTypes = [ ("Boeing 737-600", const.AIRCRAFT_B736), … … 43 45 self._flight = None 44 46 self._simulator = None 47 48 self._stdioLock = threading.Lock() 49 self._stdioText = "" 45 50 self._stdioAfterNewLine = True 51 52 self.toRestart = False 46 53 47 54 def build(self, iconDirectory): … … 84 91 """Run the GUI.""" 85 92 if self._config.autoUpdate: 86 self._updater = Updater(self._programDirectory, 93 self._updater = Updater(self, 94 self._programDirectory, 87 95 self._config.updateURL, 88 96 self._mainWindow) … … 185 193 self.showMainWindow() 186 194 195 def restart(self): 196 """Quit and restart the application.""" 197 self.toRestart = True 198 self._quit() 199 200 def flushStdIO(self): 201 """Flush any text to the standard error that could not be logged.""" 202 if self._stdioText: 203 sys.__stderr__.write(self._stdioText) 204 187 205 def writeStdIO(self, text): 188 206 """Write the given text into standard I/O log.""" 189 gobject.idle_add(self._writeStdIO, text) 190 191 def _writeStdIO(self, text): 207 with self._stdioLock: 208 self._stdioText += text 209 210 gobject.idle_add(self._writeStdIO) 211 212 def _writeStdIO(self): 192 213 """Perform the real writing.""" 214 with self._stdioLock: 215 text = self._stdioText 216 self._stdioText = "" 217 if not text: return 218 193 219 lines = text.splitlines() 194 220 if text[-1]=="\n": … … 335 361 self._quitButton.set_tooltip_text("Quit the program.") 336 362 337 self._quitButton.connect("clicked", gtk.main_quit)363 self._quitButton.connect("clicked", self._quit) 338 364 339 365 setupBox.pack_start(self._quitButton, False, False, 0) … … 660 686 self._logView.scroll_mark_onscreen(buffer.get_insert()) 661 687 688 def _quit(self, what = None): 689 """Quit from the application.""" 690 self._statusIcon.destroy() 691 return gtk.main_quit() 692 662 693 class TrackerStatusIcon(gtk.StatusIcon): 663 694 def __init__(self):
Note:
See TracChangeset
for help on using the changeset viewer.