diff --git a/panels/console.py b/panels/console.py index 666a8d39..91ad53c5 100644 --- a/panels/console.py +++ b/panels/console.py @@ -29,39 +29,25 @@ class ConsolePanel(ScreenPanel): self.autoscroll = True self.hidetemps = True - o1_lbl = Gtk.Label(_("Auto-scroll")) - o1_switch = Gtk.Switch() - o1_switch.set_active(self.autoscroll) - o1_switch.connect("notify::active", self.set_autoscroll) + o1_button = self._gtk.Button("arrow-down", _("Auto-scroll") + " ", None, self.bts, Gtk.PositionType.RIGHT, 1) + o1_button.get_style_context().add_class("button_active") + o1_button.get_style_context().add_class("buttons_slim") + o1_button.connect("clicked", self.set_autoscroll) - o2_lbl = Gtk.Label(_("Hide temp.")) - o2_switch = Gtk.Switch() - o2_switch.set_active(self.hidetemps) - o2_switch.connect("notify::active", self.hide_temps) + o2_button = self._gtk.Button("heat-up", _("Hide temp.") + " ", None, self.bts, Gtk.PositionType.RIGHT, 1) + o2_button.get_style_context().add_class("button_active") + o2_button.get_style_context().add_class("buttons_slim") + o2_button.connect("clicked", self.hide_temps) - if self._screen.vertical_mode: - o1_lbl.set_halign(Gtk.Align.CENTER) - o2_lbl.set_halign(Gtk.Align.CENTER) - else: - o1_lbl.set_halign(Gtk.Align.END) - o2_lbl.set_halign(Gtk.Align.END) o3_button = self._gtk.Button("refresh", _('Clear') + " ", None, self.bts, Gtk.PositionType.RIGHT, 1) + o3_button.get_style_context().add_class("buttons_slim") o3_button.connect("clicked", self.clear) options = Gtk.Grid() options.set_vexpand(False) - if self._screen.vertical_mode: - options.attach(o1_lbl, 0, 0, 1, 1) - options.attach(o1_switch, 0, 1, 1, 1) - options.attach(o2_lbl, 1, 0, 1, 1) - options.attach(o2_switch, 1, 1, 1, 1) - options.attach(o3_button, 3, 0, 1, 2) - else: - options.attach(o1_lbl, 0, 0, 1, 1) - options.attach(o1_switch, 1, 0, 1, 1) - options.attach(o2_lbl, 2, 0, 1, 1) - options.attach(o2_switch, 3, 0, 1, 1) - options.attach(o3_button, 4, 0, 1, 1) + options.attach(o1_button, 0, 0, 1, 1) + options.attach(o2_button, 1, 0, 1, 1) + options.attach(o3_button, 2, 0, 1, 1) sw = Gtk.ScrolledWindow() sw.set_hexpand(True) @@ -90,6 +76,8 @@ class ConsolePanel(ScreenPanel): entry.grab_focus_without_selecting() enter = self._gtk.Button("resume", " " + _('Send') + " ", None, .66, Gtk.PositionType.RIGHT, 1) + enter.get_style_context().add_class("buttons_slim") + enter.set_hexpand(False) enter.connect("clicked", self._send_command) @@ -150,11 +138,20 @@ class ConsolePanel(ScreenPanel): if action == "notify_gcode_response": self.add_gcode("response", time.time(), data) - def hide_temps(self, *args): + def hide_temps(self, widget): self.hidetemps ^= True + self.toggle_active_class(widget, self.hidetemps) - def set_autoscroll(self, *args): + def set_autoscroll(self, widget): self.autoscroll ^= True + self.toggle_active_class(widget, self.autoscroll) + + @staticmethod + def toggle_active_class(widget, cond): + if cond: + widget.get_style_context().add_class("button_active") + else: + widget.get_style_context().remove_class("button_active") def _autoscroll(self, *args): if self.autoscroll: diff --git a/panels/gcode_macros.py b/panels/gcode_macros.py index f3efc391..fef44644 100644 --- a/panels/gcode_macros.py +++ b/panels/gcode_macros.py @@ -19,11 +19,13 @@ class MacroPanel(ScreenPanel): self.sort_btn = self._gtk.Button("arrow-up", _("Name"), "color1", self.bts, Gtk.PositionType.RIGHT, 1) self.sort_btn.connect("clicked", self.change_sort) self.sort_btn.set_hexpand(True) + self.sort_btn.get_style_context().add_class("buttons_slim") self.options = {} self.macros = {} self.menu = ['macros_menu'] adjust = self._gtk.Button("settings", " " + _("Settings"), "color2", self.bts, Gtk.PositionType.LEFT, 1) + adjust.get_style_context().add_class("buttons_slim") adjust.connect("clicked", self.load_menu, 'options', _("Settings")) adjust.set_hexpand(False) diff --git a/panels/print.py b/panels/print.py index b8c81a1e..715257c9 100644 --- a/panels/print.py +++ b/panels/print.py @@ -45,12 +45,14 @@ class PrintPanel(ScreenPanel): sbox.set_vexpand(False) for i, (name, val) in enumerate(self.sort_items.items(), start=1): s = self._gtk.Button(None, val, f"color{i % 4}", .5, Gtk.PositionType.RIGHT, 1) + s.get_style_context().add_class("buttons_slim") if name == self.sort_current[0]: s.set_image(self._gtk.Image(self.sort_icon[self.sort_current[1]], self._gtk.img_scale * self.bts)) s.connect("clicked", self.change_sort, name) self.labels[f'sort_{name}'] = s sbox.add(s) refresh = self._gtk.Button("refresh", style="color4", scale=self.bts) + refresh.get_style_context().add_class("buttons_slim") refresh.connect('clicked', self._refresh_files) sbox.add(refresh) sbox.set_hexpand(True) diff --git a/styles/base.css b/styles/base.css index e73c3f50..cfa290bc 100644 --- a/styles/base.css +++ b/styles/base.css @@ -159,8 +159,14 @@ trough progress.left { border: 0px; } +scale { + margin-bottom: 0; + margin-top: 0; + padding-bottom: 0; + padding-top: 0; +} + scale mark { - margin-top: 1em; color: white; } @@ -549,6 +555,13 @@ popover button { background-color: darkred; } +.buttons_slim, .buttons_slim label { + margin-top: 0; + margin-bottom: 0; + padding-top: 0; + 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;}