source: src/mlx/gui/common.py@ 45:0938977d6603

Last change on this file since 45:0938977d6603 was 44:5d48f6c9f140, checked in by István Váradi <locvais@…>, 13 years ago

The basics of the basic framework for the flight wizard work

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