def __init__(self, **opts): HilgaObject.__init__(self, **opts) self.screen = pygame.display.get_surface() self.clock = pygame.time.Clock() self.ticks = 0 fiface = FuelIface(**opts) self.fuel = FuelWidget(fiface, (660, 360), **opts) self.obd = obd = ObdIface(**opts) #port="/dev/pts/3", **opts) self.gps = gps = GpsIface(**opts) self.speed = GpsSpeedWidget(gps, (274, 20)) # self.rspeed = RpmSpeedWidget(obd, (359, 340)) self.rpm = RpmWidget(obd, (10, 120), **opts) self.coolant = CoolantWidget(obd, (580, 360), **opts) self.bat = BatteryWidget(obd, (580, 260), **opts) # Use GPS for time, system clock is unreliable self.clk = ClockWidget(obd, (580, 300), timefun=gps.time, **opts) self.gps.add_hook('gotclock', self.clk.set_system_time) # high beam / oil presure / brake self.hbeam = HighBeamWidget((94, 376), **opts) self.oil = OilWidget((654, 500), **opts) self.brk = BreakWidget((654, 540), **opts) d100iface = D100Iface(**opts) self.d100 = D100Widget(d100iface, (600, 100)) odoiface = OdoIface(gps, **opts) self.odo = OdoWidget(odoiface, (340, 340), **opts) self.pool.spawn_n(self.loop_ticks)
def createGridLayout(self): self.horizontalGroupBox = QGroupBox("Grid") layout = QGridLayout() layout.addWidget(ClockWidget(), 0, 3, 3, 3) layout.addWidget(WeatherWidget(), 1, 0, 2, 3) layout.addWidget(BusStopWidget(), 2, 0, 2, 2) self.horizontalGroupBox.setLayout(layout)
def __init__(self, mqttc, cfg, backlight_cb=None, **kwargs): super(SmartPanelWidget, self).__init__(**kwargs) self.backlight_cb = backlight_cb self.cfg = cfg self.mqtt = mqttc # Initialize the things self.things = [] for sec in filter(lambda s: s.startswith("Thing:"), self.cfg.sections()): section = sec[6:] pos_x = int(self.cfg.get("Thing:" + section, "posX")) pos_y = int(self.cfg.get("Thing:" + section, "posY")) t = Thing(section, self.cfg, self.mqtt, self, pos=(pos_x, pos_y)) self.things.append(t) self.add_widget(t) self.IMGDIR = "resources/nixie/" clock_pos = (0, 220) self.clock = ClockWidget(self.cfg, self.IMGDIR, pos=clock_pos, touch_cb=None) self.add_widget(self.clock) self.player = PlayerWidget(self.cfg, self.mqtt, pos=(330, 0)) self.add_widget(self.player) self.fav = FavButtonWidget(self.cfg, self.mqtt, pos=(700, 220)) self.add_widget(self.fav) self.environment = EnvironmentWidget(self.cfg, self.mqtt, pos=(330, 220)) self.add_widget(self.environment) if "WifiRepeater" in self.cfg.sections(): self.wifi_repeater = WifiRepeater(self.cfg, self.mqtt, pos=(700, 380)) self.add_widget(self.wifi_repeater)
def setup_clock(self): """ Construct the clock widget and add it to the overlay, but only actually show it if we're a) Not running a plug-in, and b) The user wants it via preferences. Initially invisible, regardless - its visibility is controlled via its own positioning timer. """ self.clock_widget = ClockWidget(self.screen, self.away_message, utils.get_mouse_monitor()) self.add_child_widget(self.clock_widget) self.floaters.append(self.clock_widget) if not settings.should_show_plugin() and settings.get_show_clock(): self.clock_widget.start_positioning()