power: Sync power state on panel load. Fixes #322
This commit is contained in:
parent
1e5d701631
commit
dd0fd18b25
@ -33,6 +33,14 @@ class PowerPanel(ScreenPanel):
|
|||||||
|
|
||||||
self.content.add(box)
|
self.content.add(box)
|
||||||
|
|
||||||
|
def activate(self):
|
||||||
|
devices = self._screen.printer.get_power_devices()
|
||||||
|
for x in devices:
|
||||||
|
self.devices[x]['switch'].disconnect_by_func(self.on_switch)
|
||||||
|
self.devices[x]['switch'].set_active(True if self._screen.printer.get_power_device_status(x) == "on"
|
||||||
|
else False)
|
||||||
|
self.devices[x]['switch'].connect("notify::active", self.on_switch, x)
|
||||||
|
|
||||||
def add_device(self, device):
|
def add_device(self, device):
|
||||||
frame = Gtk.Frame()
|
frame = Gtk.Frame()
|
||||||
frame.set_property("shadow-type", Gtk.ShadowType.NONE)
|
frame.set_property("shadow-type", Gtk.ShadowType.NONE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user