# Common things for the GUI import os appIndicator = False if os.name=="nt" or "FORCE_PYGTK" in os.environ: print "Using PyGTK" pygobject = False import pygtk import gtk.gdk as gdk import gtk import gobject try: import appindicator appIndicator = True except Exception, e: pass else: print "Using PyGObject" pygobject = True from gi.repository import Gdk as gdk from gi.repository import Gtk as gtk from gi.repository import GObject as gobject from gi.repository import AppIndicator3 as appindicator appIndicator = True import cairo #------------------------------------------------------------------------------ class FlightStatusHandler(object): """Base class for objects that handle the flight status in some way.""" def __init__(self): self._stage = None self._rating = 100 self._noGoReason = None def resetFlightStatus(self): """Reset the flight status.""" self._stage = None self._rating = 100 self._noGoReason = None self._updateFlightStatus() def setStage(self, stage): """Set the stage of the flight.""" if stage!=self._stage: self._stage = stage self._updateFlightStatus() def setRating(self, rating): """Set the rating to the given value.""" if rating!=self._rating: self._rating = rating if self._noGoReason is None: self._updateFlightStatus() def setNoGo(self, reason): """Set a No-Go condition with the given reason.""" if self._noGoReason is None: self._noGoReason = reason self._updateFlightStatus() #------------------------------------------------------------------------------