def __init__(self, window, vehicle): """Initialization Routine @param window The window instance. @param vehicle The vehicle instance.""" ## @var window # The window object instance. self.window = window ## @var elements # The elements dictionary. self.elements = {} for measurement_type in DASHBOARD_MEASUREMENTS: self.elements[Measurement.name_from_class( measurement_type)] = DataPoint(measurement_type) vehicle.listen(measurement_type, self.receive) ## @var started_time # The dashboard start time. self.started_time = datetime.now() ## @var messages_received # Stores the number of stored messages. self.messages_received = 0 curses.use_default_colors() curses.init_pair(1, curses.COLOR_RED, -1) curses.init_pair(2, curses.COLOR_GREEN, -1) curses.init_pair(3, curses.COLOR_YELLOW, -1)
def unregister(self, measurement_class, callback): """Stop notifying ``callback`` of new values of ``measurement_class``. If the callback wasn't previously registered, this method will have no effect. """ self.callbacks[Measurement.name_from_class(measurement_class)].remove( callback)
def unregister(self, measurement_class, callback): """Stop notifying ``callback`` of new values of ``measurement_class``. If the callback wasn't previously registered, this method will have no effect. """ self.callbacks[Measurement.name_from_class(measurement_class) ].remove(callback)
def register(self, measurement_class, callback): """Call the ``callback`` with any new values of ``measurement_class`` received. @param measurement_class The measurement class for this object instance. @param callback the callback function name. """ self.callbacks[Measurement.name_from_class(measurement_class) ].add(callback)
def __init__(self, window, vehicle): self.window = window self.elements = {} for measurement_type in DASHBOARD_MEASUREMENTS: self.elements[Measurement.name_from_class( measurement_type)] = DataPoint(measurement_type) vehicle.listen(measurement_type, self.receive) self.started_time = datetime.now() self.messages_received = 0 curses.use_default_colors() curses.init_pair(1, curses.COLOR_RED, -1) curses.init_pair(2, curses.COLOR_GREEN, -1) curses.init_pair(3, curses.COLOR_YELLOW, -1)
def register(self, measurement_class, callback): """Call the ``callback`` with any new values of ``measurement_class`` received. """ self.callbacks[Measurement.name_from_class(measurement_class)].add( callback)
def register(self, measurement_class, callback): """Call the ``callback`` with any new values of ``measurement_class`` received. """ self.callbacks[Measurement.name_from_class(measurement_class) ].add(callback)