source: src/mlx/gui/common.py@ 42:f23f648550e9

Last change on this file since 42:f23f648550e9 was 42:f23f648550e9, checked in by István Váradi <ivaradi@…>, 12 years ago

Started the flight wizard and it is now possible to log in

File size: 1.9 KB
Line 
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
11 import gtk.gdk as gdk
12 import gtk
13 import gobject
14 try:
15 import appindicator
16 appIndicator = True
17 except Exception, e:
18 pass
19
20 MESSAGETYPE_ERROR = gtk.MESSAGE_ERROR
21 BUTTONSTYPE_OK = gtk.BUTTONS_OK
22else:
23 print "Using PyGObject"
24 pygobject = True
25 from gi.repository import Gdk as gdk
26 from gi.repository import Gtk as gtk
27 from gi.repository import GObject as gobject
28 from gi.repository import AppIndicator3 as appindicator
29 appIndicator = True
30
31 MESSAGETYPE_ERROR = gtk.MessageType.ERROR
32 BUTTONSTYPE_OK = gtk.ButtonsType.OK
33
34import cairo
35
36#------------------------------------------------------------------------------
37
38class FlightStatusHandler(object):
39 """Base class for objects that handle the flight status in some way."""
40 def __init__(self):
41 self._stage = None
42 self._rating = 100
43 self._noGoReason = None
44
45 def resetFlightStatus(self):
46 """Reset the flight status."""
47 self._stage = None
48 self._rating = 100
49 self._noGoReason = None
50 self._updateFlightStatus()
51
52 def setStage(self, stage):
53 """Set the stage of the flight."""
54 if stage!=self._stage:
55 self._stage = stage
56 self._updateFlightStatus()
57
58 def setRating(self, rating):
59 """Set the rating to the given value."""
60 if rating!=self._rating:
61 self._rating = rating
62 if self._noGoReason is None:
63 self._updateFlightStatus()
64
65 def setNoGo(self, reason):
66 """Set a No-Go condition with the given reason."""
67 if self._noGoReason is None:
68 self._noGoReason = reason
69 self._updateFlightStatus()
70
71#------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.