From fb0d0bb90964ca0439772eb29793b81ba11dabac Mon Sep 17 00:00:00 2001 From: alfrix Date: Mon, 14 Aug 2023 13:54:21 -0300 Subject: [PATCH] css: simplify graph_labels --- panels/main_menu.py | 11 ++++------- panels/temperature.py | 11 ++++------- styles/base.css | 18 +----------------- 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/panels/main_menu.py b/panels/main_menu.py index 12ee9ec8..549e5797 100644 --- a/panels/main_menu.py +++ b/panels/main_menu.py @@ -60,11 +60,9 @@ class Panel(MenuPanel): self.labels['da'].set_showing(device, visible) if visible: count += 1 - 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") + self.devices[device]['name'].get_style_context().add_class("graph_label") 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']) + self.devices[device]['name'].get_style_context().remove_class("graph_label") if count > 0: if self.labels['da'] not in self.left_panel: self.left_panel.add(self.labels['da']) @@ -148,11 +146,10 @@ class Panel(MenuPanel): name = self._gtk.Button(image, self.prettify(devname), None, self.bts, Gtk.PositionType.LEFT, 1) name.connect("clicked", self.toggle_visibility, device) name.set_alignment(0, .5) + name.get_style_context().add_class(class_name) visible = self._config.get_config().getboolean(f"graph {self._screen.connected_printer}", device, fallback=True) if visible: - name.get_style_context().add_class(class_name) - else: - name.get_style_context().add_class("graph_label_hidden") + name.get_style_context().add_class("graph_label") self.labels['da'].set_showing(device, visible) temp = self._gtk.Button(label="", lines=1) diff --git a/panels/temperature.py b/panels/temperature.py index accef86a..3fd1d765 100644 --- a/panels/temperature.py +++ b/panels/temperature.py @@ -173,11 +173,9 @@ class Panel(ScreenPanel): self.labels['da'].set_showing(device, visible) if visible: count += 1 - 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") + self.devices[device]['name'].get_style_context().add_class("graph_label") 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']) + self.devices[device]['name'].get_style_context().remove_class("graph_label") if count > 0: if self.labels['da'] not in self.left_panel: self.left_panel.add(self.labels['da']) @@ -324,11 +322,10 @@ class Panel(ScreenPanel): name = self._gtk.Button(image, self.prettify(devname), None, self.bts, Gtk.PositionType.LEFT, 1) name.set_alignment(0, .5) + name.get_style_context().add_class(class_name) visible = self._config.get_config().getboolean(f"graph {self._screen.connected_printer}", device, fallback=True) if visible: - name.get_style_context().add_class(class_name) - else: - name.get_style_context().add_class("graph_label_hidden") + name.get_style_context().add_class("graph_label") can_target = self._printer.device_has_target(device) self.labels['da'].add_object(device, "temperatures", rgb, False, True) diff --git a/styles/base.css b/styles/base.css index b00539a2..979ead25 100644 --- a/styles/base.css +++ b/styles/base.css @@ -566,20 +566,4 @@ popover button { padding-bottom: 0; } -/* Hardcoded values until creation of dynamic CSS updates */ -.graph_label_hidden {padding-left: .9em;} /* .4em on top of normal button padding */ -.graph_label_extruder {border-left-width: .4em; border-left-style: solid;} -.graph_label_extruder1 {border-left-width: .4em; border-left-style: solid;} -.graph_label_extruder2 {border-left-width: .4em; border-left-style: solid;} -.graph_label_extruder3 {border-left-width: .4em; border-left-style: solid;} -.graph_label_extruder4 {border-left-width: .4em; border-left-style: solid;} -.graph_label_heater_bed {border-left-width: .4em; border-left-style: solid;} -.graph_label_fan_1 {border-left-width: .4em; border-left-style: solid;} -.graph_label_fan_2 {border-left-width: .4em; border-left-style: solid;} -.graph_label_fan_3 {border-left-width: .4em; border-left-style: solid;} -.graph_label_fan_4 {border-left-width: .4em; border-left-style: solid;} -.graph_label_sensor_1 {border-left-width: .4em; border-left-style: solid;} -.graph_label_sensor_2 {border-left-width: .4em; border-left-style: solid;} -.graph_label_sensor_3 {border-left-width: .4em; border-left-style: solid;} -.graph_label_sensor_4 {border-left-width: .4em; border-left-style: solid;} -.graph_label_sensor_5 {border-left-width: .4em; border-left-style: solid;} +.graph_label {border-left-width: .4em; border-left-style: solid;}