def __init__(self, visitor, obj=None, config=None): self.visitor = visitor window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.set_default_size(1,1) window.show() window.connect("delete_event", self.delete_event) darea = gtk.DrawingArea() darea.show() hbox = gtk.HBox() hbox.show() window.add(hbox) hbox.pack_start(darea, False, False, 0) vbox = gtk.VBox() vbox.show() hbox.pack_start(vbox, False, False, 0) up = gtk.Button("Up") up.show() up.connect("clicked", self.button_up) down = gtk.Button("Down") down.show() down.connect("clicked", self.button_down) vbox.pack_start(up, True, True, 0) vbox.pack_start(down, True, True, 0) self.window = window LCDDisplay.__init__(self, darea, obj=obj, config=config) self.layout_timeout = 0
HIGH_SOUND=600 HIGH_LIGHT=70 HIGH_AIR=30 FIRE_TEMPERATURE=30 FIRE_AIR=70 ############################################## ############################################## #Sub-systems Configuation ############################################## #Display lcdDisplay=LCDDisplay(LCDDISPLAY_ADDRESS, LCDDISPLAY_RGBADDRESS,LCDDISPLAY_REFRESH_PERIOD) # Sensors temperatureSensor = TemperatureSensor(TEMPERATURE_SENSOR_A_PIN,TEMPERATURE_SENSOR_UNIT) buttonSensor = ButtonSensor(BUTTON_SENSOR_D_PIN) lightSensor = LightSensor(LIGHT_SENSOR_A_PIN) soundSensor = SoundSensor(SOUND_SENSOR_A_PIN) airSensor=AirSensor(AIR_SENSOR_A_PIN) # SensorProxies (Initialize with sensor) temperatureSensorProxy = SensorProxy(temperatureSensor,TEMPERATURE_SENSOR_REFRESH_PERIOD,TEMPERATURE_SENSOR_PRECISION,TEMPERATURE_SENSOR_AVERAGE_SAMPLES) buttonSensorProxy = SensorProxy(buttonSensor, BUTTON_SENSOR_REFRESH_PERIOD) lightSensorProxy = SensorProxy(lightSensor,LIGHT_SENSOR_REFRESH_PERIOD) soundSensorProxy = SensorProxy(soundSensor,SOUND_SENSOR_REFRESH_PERIOD,SOUND_SENSOR_PRECISION,SOUND_SENSOR_AVERAGE_SAMPLES,3) airSensorProxy = SensorProxy(airSensor,AIR_SENSOR_REFRESH_PERIOD,AIR_SENSOR_PRECISION,AIR_SENSOR_AVERAGE_SAMPLES)