main temp: load the visibility of items
This commit is contained in:
parent
0d2c1b013b
commit
e140120b44
@ -52,12 +52,23 @@ class MainPanel(MenuPanel):
|
|||||||
if self.graph_update is None:
|
if self.graph_update is None:
|
||||||
# This has a high impact on load
|
# This has a high impact on load
|
||||||
self.graph_update = GLib.timeout_add_seconds(5, self.update_graph)
|
self.graph_update = GLib.timeout_add_seconds(5, self.update_graph)
|
||||||
return
|
for device in self.devices:
|
||||||
|
visible = self._config.get_config().getboolean(f"graph {self._screen.connected_printer}", device, fallback=True)
|
||||||
|
self.devices[device]['visible'] = visible
|
||||||
|
self.labels['da'].set_showing(device, visible)
|
||||||
|
if visible:
|
||||||
|
self.devices[device]['name'].get_style_context().add_class(self.devices[device]['class'])
|
||||||
|
self.devices[device]['name'].get_style_context().remove_class("graph_label_hidden")
|
||||||
|
else:
|
||||||
|
self.devices[device]['name'].get_style_context().add_class("graph_label_hidden")
|
||||||
|
self.devices[device]['name'].get_style_context().remove_class(self.devices[device]['class'])
|
||||||
|
|
||||||
def deactivate(self):
|
def deactivate(self):
|
||||||
if self.graph_update:
|
if self.graph_update:
|
||||||
GLib.source_remove(self.graph_update)
|
GLib.source_remove(self.graph_update)
|
||||||
self.graph_update = None
|
self.graph_update = None
|
||||||
|
if self.active_heater is not None:
|
||||||
|
self.hide_numpad()
|
||||||
|
|
||||||
def add_device(self, device):
|
def add_device(self, device):
|
||||||
|
|
||||||
@ -208,7 +219,7 @@ class MainPanel(MenuPanel):
|
|||||||
|
|
||||||
return box
|
return box
|
||||||
|
|
||||||
def hide_numpad(self, widget):
|
def hide_numpad(self, widget=None):
|
||||||
self.devices[self.active_heater]['name'].get_style_context().remove_class("button_active")
|
self.devices[self.active_heater]['name'].get_style_context().remove_class("button_active")
|
||||||
self.active_heater = None
|
self.active_heater = None
|
||||||
|
|
||||||
|
@ -189,14 +189,25 @@ class TemperaturePanel(ScreenPanel):
|
|||||||
if self.graph_update is None:
|
if self.graph_update is None:
|
||||||
# This has a high impact on load
|
# This has a high impact on load
|
||||||
self.graph_update = GLib.timeout_add_seconds(5, self.update_graph)
|
self.graph_update = GLib.timeout_add_seconds(5, self.update_graph)
|
||||||
|
for device in self.devices:
|
||||||
|
visible = self._config.get_config().getboolean(f"graph {self._screen.connected_printer}", device, fallback=True)
|
||||||
|
self.devices[device]['visible'] = visible
|
||||||
|
self.labels['da'].set_showing(device, visible)
|
||||||
|
if visible:
|
||||||
|
self.devices[device]['name'].get_style_context().add_class(self.devices[device]['class'])
|
||||||
|
self.devices[device]['name'].get_style_context().remove_class("graph_label_hidden")
|
||||||
|
else:
|
||||||
|
self.devices[device]['name'].get_style_context().add_class("graph_label_hidden")
|
||||||
|
self.devices[device]['name'].get_style_context().remove_class(self.devices[device]['class'])
|
||||||
|
|
||||||
def deactivate(self):
|
def deactivate(self):
|
||||||
if self.graph_update is not None:
|
if self.graph_update is not None:
|
||||||
GLib.source_remove(self.graph_update)
|
GLib.source_remove(self.graph_update)
|
||||||
self.graph_update = None
|
self.graph_update = None
|
||||||
|
if self.active_heater is not None:
|
||||||
|
self.hide_numpad()
|
||||||
|
|
||||||
def select_heater(self, widget, device):
|
def select_heater(self, widget, device):
|
||||||
|
|
||||||
if self.devices[device]["can_target"]:
|
if self.devices[device]["can_target"]:
|
||||||
if device in self.active_heaters:
|
if device in self.active_heaters:
|
||||||
self.active_heaters.pop(self.active_heaters.index(device))
|
self.active_heaters.pop(self.active_heaters.index(device))
|
||||||
@ -442,7 +453,7 @@ class TemperaturePanel(ScreenPanel):
|
|||||||
|
|
||||||
return box
|
return box
|
||||||
|
|
||||||
def hide_numpad(self, widget):
|
def hide_numpad(self, widget=None):
|
||||||
self.devices[self.active_heater]['name'].get_style_context().remove_class("button_active")
|
self.devices[self.active_heater]['name'].get_style_context().remove_class("button_active")
|
||||||
self.active_heater = None
|
self.active_heater = None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user