From 1f2bd4cf72f0350cc62f0ba556d3ec3be29e12a8 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Sat, 6 Jul 2024 16:14:35 -0300 Subject: [PATCH] refactor(dialogs): make button padding smaller and hexpand prompt buttons --- ks_includes/widgets/prompts.py | 8 ++++---- panels/gcodes.py | 6 +++--- styles/base.css | 2 +- styles/colorized/style.css | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ks_includes/widgets/prompts.py b/ks_includes/widgets/prompts.py index 8cbf5b3b..9d4daf08 100644 --- a/ks_includes/widgets/prompts.py +++ b/ks_includes/widgets/prompts.py @@ -16,7 +16,6 @@ class Prompt: self.prompt = None self.scroll_box = Gtk.Box( orientation=Gtk.Orientation.VERTICAL, - halign=Gtk.Align.CENTER ) self.groups = [] @@ -68,9 +67,6 @@ class Prompt: Gtk.FlowBox( selection_mode=Gtk.SelectionMode.NONE, orientation=Gtk.Orientation.HORIZONTAL, - halign=Gtk.Align.CENTER, - min_children_per_line=4, - max_children_per_line=4, ) ) elif data == 'prompt_button_group_end': @@ -84,6 +80,10 @@ class Prompt: button.connect("clicked", self.screen._send_action, "printer.gcode.script", {'script': gcode}) if self.groups: self.groups[-1].add(button) + # Workaround to expand the buttons horizontally + max_childs = len(self.groups[-1].get_children()) + self.groups[-1].set_max_children_per_line(min(4, max_childs)) + self.groups[-1].set_min_children_per_line(min(4, max_childs)) else: self.scroll_box.add(button) diff --git a/panels/gcodes.py b/panels/gcodes.py index 75efe15e..dc5d2202 100644 --- a/panels/gcodes.py +++ b/panels/gcodes.py @@ -318,9 +318,9 @@ class Panel(ScreenPanel): action = _("Print") if self._printer.extrudercount > 0 else _("Start") buttons = [ - {"name": _("Delete"), "response": Gtk.ResponseType.REJECT, "style": 'dialog-warning'}, - {"name": action, "response": Gtk.ResponseType.OK}, - {"name": _("Cancel"), "response": Gtk.ResponseType.CANCEL, "style": 'dialog-error'} + {"name": _("Delete"), "response": Gtk.ResponseType.REJECT, "style": 'dialog-error'}, + {"name": action, "response": Gtk.ResponseType.OK, "style": 'dialog-primary'}, + {"name": _("Cancel"), "response": Gtk.ResponseType.CANCEL, "style": 'dialog-secondary'} ] label = Gtk.Label(hexpand=True, vexpand=True, wrap=True, wrap_mode=Pango.WrapMode.WORD_CHAR) diff --git a/styles/base.css b/styles/base.css index f7627a5e..7253f02e 100644 --- a/styles/base.css +++ b/styles/base.css @@ -295,7 +295,7 @@ trough { } .dialog button { - padding: 1.5em; + padding: 1.5em 0.2em; margin-top: 1em; } diff --git a/styles/colorized/style.css b/styles/colorized/style.css index 8bb99130..3abddcff 100644 --- a/styles/colorized/style.css +++ b/styles/colorized/style.css @@ -252,7 +252,7 @@ textview .time { } .dialog-warning { - border-bottom-color: @solarized-yellow; + border-bottom-color: @solarized-orange; } .dialog-info { @@ -260,7 +260,7 @@ textview .time { } .dialog-default { - border-bottom-color: @solarized-green; + border-bottom-color: @solarized-blue; } .dialog-secondary { @@ -268,5 +268,5 @@ textview .time { } .dialog-primary { - border-bottom-color: @solarized-orange; + border-bottom-color: @solarized-green; } \ No newline at end of file