Changeset 36:f79362793664 for src/mlx/gui
- Timestamp:
- 03/04/12 06:27:05 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/gui.py
r35 r36 3 3 from statusicon import StatusIcon 4 4 from statusbar import Statusbar 5 from update import Updater 5 6 from mlx.gui.common import * 6 7 … … 31 32 class GUI(fs.ConnectionListener): 32 33 """The main GUI class.""" 33 def __init__(self ):34 def __init__(self, programDirectory, config): 34 35 """Construct the GUI.""" 35 36 gobject.threads_init() 36 37 38 self._programDirectory = programDirectory 39 self._config = config 37 40 self._connecting = False 38 41 self._connected = False … … 40 43 self._flight = None 41 44 self._simulator = None 45 self._stdioAfterNewLine = True 42 46 43 47 def build(self, iconDirectory): 44 48 """Build the GUI.""" 45 49 46 win = gtk.Window()47 win .set_title("MAVA Logger X " + const.VERSION)48 win .set_icon_from_file("logo.ico")49 win .connect("delete-event",50 lambda a, b: self.hideMainWindow())51 win .connect("window-state-event", self._handleMainWindowState)50 window = gtk.Window() 51 window.set_title("MAVA Logger X " + const.VERSION) 52 window.set_icon_from_file(os.path.join(iconDirectory, "logo.ico")) 53 window.connect("delete-event", 54 lambda a, b: self.hideMainWindow()) 55 window.connect("window-state-event", self._handleMainWindowState) 52 56 53 57 mainVBox = gtk.VBox() 54 win .add(mainVBox)58 window.add(mainVBox) 55 59 56 60 setupFrame = self._buildSetupFrame() … … 71 75 mainVBox.pack_start(self._statusbar, False, False, 0) 72 76 73 win .show_all()74 75 self._mainWindow = win 77 window.show_all() 78 79 self._mainWindow = window 76 80 77 81 self._statusIcon = StatusIcon(iconDirectory, self) … … 79 83 def run(self): 80 84 """Run the GUI.""" 85 if self._config.autoUpdate: 86 self._updater = Updater(self._programDirectory, 87 self._config.updateURL, 88 self._mainWindow) 89 self._updater.start() 90 81 91 gtk.main() 92 82 93 if self._flight is not None: 83 94 simulator = self._flight.simulator … … 173 184 else: 174 185 self.showMainWindow() 186 187 def writeStdIO(self, text): 188 """Write the given text into standard I/O log.""" 189 gobject.idle_add(self._writeStdIO, text) 190 191 def _writeStdIO(self, text): 192 """Perform the real writing.""" 193 lines = text.splitlines() 194 if text[-1]=="\n": 195 text = "" 196 else: 197 text = lines[-1] 198 lines = lines[:-1] 199 200 for line in lines: 201 if self._stdioAfterNewLine: 202 line = "[STDIO] " + line 203 self._writeLog(line + "\n") 204 self._stdioAfterNewLine = True 205 206 if text: 207 if self._stdioAfterNewLine: 208 text = "[STDIO] " + text 209 self._writeLog(text) 210 self._stdioAfterNewLine = False 175 211 176 212 def _connectToggled(self, button):
Note:
See TracChangeset
for help on using the changeset viewer.