source: src/mlx/gui/common.py@ 36:f79362793664

Last change on this file since 36:f79362793664 was 32:46c1a12f72d1, checked in by István Váradi <ivaradi@…>, 12 years ago

Implemented the status bar.

File size: 1.8 KB
RevLine 
[28]1# Common things for the GUI
2
3import os
4
5appIndicator = False
6
7if os.name=="nt" or "FORCE_PYGTK" in os.environ:
8 print "Using PyGTK"
9 pygobject = False
10 import pygtk
[29]11 import gtk.gdk as gdk
[28]12 import gtk
13 import gobject
14 try:
15 import appindicator
16 appIndicator = True
17 except Exception, e:
18 pass
19else:
20 print "Using PyGObject"
21 pygobject = True
[29]22 from gi.repository import Gdk as gdk
[28]23 from gi.repository import Gtk as gtk
24 from gi.repository import GObject as gobject
25 from gi.repository import AppIndicator3 as appindicator
26 appIndicator = True
27
28import cairo
29
[32]30#------------------------------------------------------------------------------
31
32class FlightStatusHandler(object):
33 """Base class for objects that handle the flight status in some way."""
34 def __init__(self):
35 self._stage = None
36 self._rating = 100
37 self._noGoReason = None
38
39 def resetFlightStatus(self):
40 """Reset the flight status."""
41 self._stage = None
42 self._rating = 100
43 self._noGoReason = None
44 self._updateFlightStatus()
45
46 def setStage(self, stage):
47 """Set the stage of the flight."""
48 if stage!=self._stage:
49 self._stage = stage
50 self._updateFlightStatus()
51
52 def setRating(self, rating):
53 """Set the rating to the given value."""
54 if rating!=self._rating:
55 self._rating = rating
56 if self._noGoReason is None:
57 self._updateFlightStatus()
58
59 def setNoGo(self, reason):
60 """Set a No-Go condition with the given reason."""
61 if self._noGoReason is None:
62 self._noGoReason = reason
63 self._updateFlightStatus()
64
65#------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.