diff --git a/panels/extrude.py b/panels/extrude.py index 9bf03e11..87a63a83 100644 --- a/panels/extrude.py +++ b/panels/extrude.py @@ -77,16 +77,9 @@ class Panel(ScreenPanel): self.labels[f"dist{i}"] = self._gtk.Button(label=i) self.labels[f"dist{i}"].connect("clicked", self.change_distance, int(i)) ctx = self.labels[f"dist{i}"].get_style_context() - if ((self._screen.lang_ltr is True and j == 0) or - (self._screen.lang_ltr is False and j == len(self.distances) - 1)): - ctx.add_class("distbutton_top") - elif ((self._screen.lang_ltr is False and j == 0) or - (self._screen.lang_ltr is True and j == len(self.distances) - 1)): - ctx.add_class("distbutton_bottom") - else: - ctx.add_class("distbutton") + ctx.add_class("horizontal_togglebuttons") if int(i) == self.distance: - ctx.add_class("distbutton_active") + ctx.add_class("horizontal_togglebuttons_active") distgrid.attach(self.labels[f"dist{i}"], j, 0, 1, 1) speedgrid = Gtk.Grid() @@ -94,16 +87,9 @@ class Panel(ScreenPanel): self.labels[f"speed{i}"] = self._gtk.Button(label=i) self.labels[f"speed{i}"].connect("clicked", self.change_speed, int(i)) ctx = self.labels[f"speed{i}"].get_style_context() - if ((self._screen.lang_ltr is True and j == 0) or - (self._screen.lang_ltr is False and j == len(self.speeds) - 1)): - ctx.add_class("distbutton_top") - elif ((self._screen.lang_ltr is False and j == 0) or - (self._screen.lang_ltr is True and j == len(self.speeds) - 1)): - ctx.add_class("distbutton_bottom") - else: - ctx.add_class("distbutton") + ctx.add_class("horizontal_togglebuttons") if int(i) == self.speed: - ctx.add_class("distbutton_active") + ctx.add_class("horizontal_togglebuttons_active") speedgrid.attach(self.labels[f"speed{i}"], j, 0, 1, 1) distbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) @@ -211,8 +197,8 @@ class Panel(ScreenPanel): def change_distance(self, widget, distance): logging.info(f"### Distance {distance}") - self.labels[f"dist{self.distance}"].get_style_context().remove_class("distbutton_active") - self.labels[f"dist{distance}"].get_style_context().add_class("distbutton_active") + self.labels[f"dist{self.distance}"].get_style_context().remove_class("horizontal_togglebuttons_active") + self.labels[f"dist{distance}"].get_style_context().add_class("horizontal_togglebuttons_active") self.distance = distance def change_extruder(self, widget, extruder): @@ -225,8 +211,8 @@ class Panel(ScreenPanel): def change_speed(self, widget, speed): logging.info(f"### Speed {speed}") - self.labels[f"speed{self.speed}"].get_style_context().remove_class("distbutton_active") - self.labels[f"speed{speed}"].get_style_context().add_class("distbutton_active") + self.labels[f"speed{self.speed}"].get_style_context().remove_class("horizontal_togglebuttons_active") + self.labels[f"speed{speed}"].get_style_context().add_class("horizontal_togglebuttons_active") self.speed = speed def extrude(self, widget, direction): diff --git a/panels/fine_tune.py b/panels/fine_tune.py index 34cbbd1e..9f8a4bf7 100644 --- a/panels/fine_tune.py +++ b/panels/fine_tune.py @@ -33,14 +33,9 @@ class Panel(ScreenPanel): self.labels[f"zdelta{i}"] = self._gtk.Button(label=i) self.labels[f"zdelta{i}"].connect("clicked", self.change_percent_delta, "z_offset", float(i)) ctx = self.labels[f"zdelta{i}"].get_style_context() - if j == 0: - ctx.add_class("distbutton_top") - elif j == len(self.z_deltas) - 1: - ctx.add_class("distbutton_bottom") - else: - ctx.add_class("distbutton") + ctx.add_class("horizontal_togglebuttons") if i == self.z_delta: - ctx.add_class("distbutton_active") + ctx.add_class("horizontal_togglebuttons_active") zgrid.attach(self.labels[f"zdelta{i}"], j, 0, 1, 1) spdgrid = Gtk.Grid() @@ -48,14 +43,9 @@ class Panel(ScreenPanel): self.labels[f"sdelta{i}"] = self._gtk.Button(label=f"{i}%") self.labels[f"sdelta{i}"].connect("clicked", self.change_percent_delta, "speed", int(i)) ctx = self.labels[f"sdelta{i}"].get_style_context() - if j == 0: - ctx.add_class("distbutton_top") - elif j == len(self.speed_deltas) - 1: - ctx.add_class("distbutton_bottom") - else: - ctx.add_class("distbutton") + ctx.add_class("horizontal_togglebuttons") if i == self.s_delta: - ctx.add_class("distbutton_active") + ctx.add_class("horizontal_togglebuttons_active") spdgrid.attach(self.labels[f"sdelta{i}"], j, 0, 1, 1) extgrid = Gtk.Grid() @@ -63,14 +53,9 @@ class Panel(ScreenPanel): self.labels[f"edelta{i}"] = self._gtk.Button(label=f"{i}%") self.labels[f"edelta{i}"].connect("clicked", self.change_percent_delta, "extrude", int(i)) ctx = self.labels[f"edelta{i}"].get_style_context() - if j == 0: - ctx.add_class("distbutton_top") - elif j == len(self.extrude_deltas) - 1: - ctx.add_class("distbutton_bottom") - else: - ctx.add_class("distbutton") + ctx.add_class("horizontal_togglebuttons") if i == self.e_delta: - ctx.add_class("distbutton_active") + ctx.add_class("horizontal_togglebuttons_active") extgrid.attach(self.labels[f"edelta{i}"], j, 0, 1, 1) grid = Gtk.Grid(column_homogeneous=True) @@ -179,13 +164,13 @@ class Panel(ScreenPanel): def change_percent_delta(self, widget, array, delta): logging.info(f"### Delta {delta}") - widget.get_style_context().add_class("distbutton_active") + widget.get_style_context().add_class("horizontal_togglebuttons_active") if array == "z_offset": - self.labels[f"zdelta{self.z_delta}"].get_style_context().remove_class("distbutton_active") + self.labels[f"zdelta{self.z_delta}"].get_style_context().remove_class("horizontal_togglebuttons_active") self.z_delta = delta elif array == "speed": - self.labels[f"sdelta{self.s_delta}"].get_style_context().remove_class("distbutton_active") + self.labels[f"sdelta{self.s_delta}"].get_style_context().remove_class("horizontal_togglebuttons_active") self.s_delta = delta elif array == "extrude": - self.labels[f"edelta{self.e_delta}"].get_style_context().remove_class("distbutton_active") + self.labels[f"edelta{self.e_delta}"].get_style_context().remove_class("horizontal_togglebuttons_active") self.e_delta = delta diff --git a/panels/move.py b/panels/move.py index a4f1b788..689d7af5 100644 --- a/panels/move.py +++ b/panels/move.py @@ -86,14 +86,9 @@ class Panel(ScreenPanel): self.labels[i].set_direction(Gtk.TextDirection.LTR) self.labels[i].connect("clicked", self.change_distance, i) ctx = self.labels[i].get_style_context() - if (self._screen.lang_ltr and j == 0) or (not self._screen.lang_ltr and j == len(self.distances) - 1): - ctx.add_class("distbutton_top") - elif (not self._screen.lang_ltr and j == 0) or (self._screen.lang_ltr and j == len(self.distances) - 1): - ctx.add_class("distbutton_bottom") - else: - ctx.add_class("distbutton") + ctx.add_class("horizontal_togglebuttons") if i == self.distance: - ctx.add_class("distbutton_active") + ctx.add_class("horizontal_togglebuttons_active") distgrid.attach(self.labels[i], j, 0, 1, 1) for p in ('pos_x', 'pos_y', 'pos_z'): @@ -174,8 +169,8 @@ class Panel(ScreenPanel): def change_distance(self, widget, distance): logging.info(f"### Distance {distance}") - self.labels[f"{self.distance}"].get_style_context().remove_class("distbutton_active") - self.labels[f"{distance}"].get_style_context().add_class("distbutton_active") + self.labels[f"{self.distance}"].get_style_context().remove_class("horizontal_togglebuttons_active") + self.labels[f"{distance}"].get_style_context().add_class("horizontal_togglebuttons_active") self.distance = distance def move(self, widget, axis, direction): diff --git a/panels/temperature.py b/panels/temperature.py index c476e01e..76dbb5ab 100644 --- a/panels/temperature.py +++ b/panels/temperature.py @@ -103,14 +103,9 @@ class Panel(ScreenPanel): self.labels[f'deg{i}'] = self._gtk.Button(label=i) self.labels[f'deg{i}'].connect("clicked", self.change_temp_delta, i) ctx = self.labels[f'deg{i}'].get_style_context() - if j == 0: - ctx.add_class("distbutton_top") - elif j == len(self.tempdeltas) - 1: - ctx.add_class("distbutton_bottom") - else: - ctx.add_class("distbutton") + ctx.add_class("horizontal_togglebuttons") if i == self.tempdelta: - ctx.add_class("distbutton_active") + ctx.add_class("horizontal_togglebuttons_active") tempgrid.attach(self.labels[f'deg{i}'], j, 0, 1, 1) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) @@ -125,8 +120,8 @@ class Panel(ScreenPanel): def change_temp_delta(self, widget, tempdelta): logging.info(f"### tempdelta {tempdelta}") - self.labels[f"deg{self.tempdelta}"].get_style_context().remove_class("distbutton_active") - self.labels[f"deg{tempdelta}"].get_style_context().add_class("distbutton_active") + self.labels[f"deg{self.tempdelta}"].get_style_context().remove_class("horizontal_togglebuttons_active") + self.labels[f"deg{tempdelta}"].get_style_context().add_class("horizontal_togglebuttons_active") self.tempdelta = tempdelta def change_target_temp_incremental(self, widget, direction): diff --git a/panels/zcalibrate.py b/panels/zcalibrate.py index ad4030c6..efcc9d65 100644 --- a/panels/zcalibrate.py +++ b/panels/zcalibrate.py @@ -78,14 +78,9 @@ class Panel(ScreenPanel): self.widgets[i].set_direction(Gtk.TextDirection.LTR) self.widgets[i].connect("clicked", self.change_distance, i) ctx = self.widgets[i].get_style_context() - if (self._screen.lang_ltr and j == 0) or (not self._screen.lang_ltr and j == len(self.distances) - 1): - ctx.add_class("distbutton_top") - elif (not self._screen.lang_ltr and j == 0) or (self._screen.lang_ltr and j == len(self.distances) - 1): - ctx.add_class("distbutton_bottom") - else: - ctx.add_class("distbutton") + ctx.add_class("horizontal_togglebuttons") if i == self.distance: - ctx.add_class("distbutton_active") + ctx.add_class("horizontal_togglebuttons_active") distgrid.attach(self.widgets[i], j, 0, 1, 1) self.widgets['move_dist'] = Gtk.Label(_("Move Distance (mm)")) @@ -247,8 +242,8 @@ class Panel(ScreenPanel): def change_distance(self, widget, distance): logging.info(f"### Distance {distance}") - self.widgets[f"{self.distance}"].get_style_context().remove_class("distbutton_active") - self.widgets[f"{distance}"].get_style_context().add_class("distbutton_active") + self.widgets[f"{self.distance}"].get_style_context().remove_class("horizontal_togglebuttons_active") + self.widgets[f"{distance}"].get_style_context().add_class("horizontal_togglebuttons_active") self.distance = distance def move(self, widget, direction): diff --git a/styles/base.css b/styles/base.css index 4fb6d6a5..82eba04a 100644 --- a/styles/base.css +++ b/styles/base.css @@ -291,36 +291,32 @@ trough { margin-top: 1em; } -.distbutton_active { +.horizontal_togglebuttons_active { background-color: @active; font-weight: 600; } -.distbutton_top { - border: .15em solid @lines; - border-right: 0; +.horizontal_togglebuttons { + border-style: solid; + border-color: @lines; + border-width: .15em; + border-right-width: 0; + margin-left: 0; + margin-right: 0; + min-height: 3em; +} + +.horizontal_togglebuttons:first-child { border-top-left-radius: .75em; border-bottom-left-radius: .75em; - margin-right: 0; - min-height: 3em; + margin-left: .25em; } -.distbutton { - border: .15em solid @lines; - border-left: .15em solid @lines; - border-right: 0; - margin-left: 0; - margin-right: 0; - min-height: 3em; -} - -.distbutton_bottom { - border: .15em solid @lines; - border-left: .15em solid @lines; - border-top-right-radius: .7em; - border-bottom-right-radius: .7em; - margin-left: 0; - min-height: 3em; +.horizontal_togglebuttons:last-child { + border-top-right-radius: .75em; + border-bottom-right-radius: .75em; + border-right-width: .15em; + margin-right: .25em; } .fan_slider { @@ -512,30 +508,6 @@ trough { font-size: 0.95em; } -.tempbutton_top { - border: .15em solid @lines; - border-bottom: 0; - border-top-left-radius: .75em; - border-top-right-radius: .75em; - margin-bottom: 0; -} - -.tempbutton { - border: .15em solid @lines; - border-top: .15em solid @lines; - border-bottom: 0; - margin-top: 0; - margin-bottom: 0; -} - -.tempbutton_bottom { - border: .15em solid @lines; - border-top: .15em solid @lines; - border-bottom-left-radius: .7em; - border-bottom-right-radius: .7em; - margin-top: 0; -} - .updater-item { min-height: 3em; padding: .2em; diff --git a/styles/colorized/style.css b/styles/colorized/style.css index a17e0b8c..a5b222d1 100644 --- a/styles/colorized/style.css +++ b/styles/colorized/style.css @@ -175,17 +175,12 @@ textview .time { border-radius: .75em; } -.tempbutton_top, -.tempbutton, -.tempbutton_bottom, -.distbutton_top, -.distbutton, -.distbutton_bottom { +.horizontal_togglebuttons { border-color: @solarized-base03; background-color: @solarized-base02; } -.distbutton_active { +.horizontal_togglebuttons_active { background-color: @solarized-orange; } diff --git a/styles/material-dark/style.css b/styles/material-dark/style.css index 8f079682..667cad5b 100644 --- a/styles/material-dark/style.css +++ b/styles/material-dark/style.css @@ -157,18 +157,13 @@ textview .time { border-radius: .75em; } -.tempbutton_top, -.tempbutton, -.tempbutton_bottom, -.distbutton_top, -.distbutton, -.distbutton_bottom { +.horizontal_togglebuttons { border-color: @bg; background-color: @buttons-bg; } button:active, -.distbutton_active, +.horizontal_togglebuttons_active, button.active { background-color: @active; } diff --git a/styles/material-darker/style.css b/styles/material-darker/style.css index 33934d29..c6c9af08 100644 --- a/styles/material-darker/style.css +++ b/styles/material-darker/style.css @@ -30,10 +30,6 @@ window { background-color: #121212; } -.active_device { - background-color: #1c1c1c; -} - button { background-color: #121212; } @@ -142,6 +138,10 @@ textview .time { color: #9E9E9E; } +.active_device { + background-color: #1c1c1c; +} + .dialog { border: 0; background-color: #121212; @@ -152,18 +152,38 @@ textview .time { border-radius: .25em; } -.tempbutton_top, -.tempbutton, -.tempbutton_bottom, -.distbutton_top, -.distbutton, -.distbutton_bottom { + +.dialog-error { + border-bottom-color: #CF6679; +} + +.dialog-warning { + border-bottom-color: #f9b274; +} + +.dialog-info { + border-bottom-color: @color4; +} + +.dialog-default { + border-bottom-color: @color3; +} + +.dialog-secondary { + border-bottom-color: @color2; +} + +.dialog-primary { + border-bottom-color: @color1; +} + +.horizontal_togglebuttons { border-color: #545454; border-width: .1em; background-color: #252525; } -.distbutton_active { +.horizontal_togglebuttons_active { background-color: #545454; } @@ -218,38 +238,6 @@ textview .time { color: #121212; } -.warning { - background-color: #f9b274; -} - -.error { - background-color: #CF6679; -} - .keyboard_pad { background-color: #090909; -} - -.dialog-error { - border-bottom-color: #CF6679; -} - -.dialog-warning { - border-bottom-color: #f9b274; -} - -.dialog-info { - border-bottom-color: @color4; -} - -.dialog-default { - border-bottom-color: @color3; -} - -.dialog-secondary { - border-bottom-color: @color2; -} - -.dialog-primary { - border-bottom-color: @color1; -} +} \ No newline at end of file diff --git a/styles/material-light/style.css b/styles/material-light/style.css index 92f4433e..161c2f4c 100644 --- a/styles/material-light/style.css +++ b/styles/material-light/style.css @@ -134,10 +134,6 @@ entry { background-color: @bg; } -.frame-item { - border-bottom-color: @border; -} - label { color: @text; } @@ -195,26 +191,16 @@ textview .time { color: @border; } -.dialog { - border: @border; - background-color: @bg; -} - -.tempbutton_top, -.tempbutton, -.tempbutton_bottom, -.distbutton_top, -.distbutton, -.distbutton_bottom { +.horizontal_togglebuttons { border-color: @border; background-color: @bg; } -.distbutton_active { +.horizontal_togglebuttons_active { background-color: @active; } -.distbutton_active label { +.horizontal_togglebuttons_active label { color: @text; } @@ -222,6 +208,10 @@ textview .time { color: @bg; } +.frame-item { + border-bottom-color: @border; +} + .message_popup { border-bottom-color: @border; } @@ -281,6 +271,11 @@ textview .time { background-color: @border; } +.dialog { + border: @border; + background-color: @bg; +} + .dialog button { border-radius: .75em; } diff --git a/styles/z-bolt/style.css b/styles/z-bolt/style.css index 5c4c1f4f..042d19e2 100644 --- a/styles/z-bolt/style.css +++ b/styles/z-bolt/style.css @@ -134,15 +134,13 @@ textview .time { background-color: @bg; } -.distbutton_active { +.horizontal_togglebuttons_active { background-color: @active; border-color: @color1; - box-shadow: 0 0 0 .2em @text inset; + box-shadow: 0 0 0 .2em @lines inset; } -.distbutton_top, -.distbutton, -.distbutton_bottom { +.horizontal_togglebuttons { border-color: @lines; } @@ -158,16 +156,6 @@ textview .time { border-color: @lines; } -.tempbutton_top { - border-color: @lines; -} - -.tempbutton, -.tempbutton_bottom { - border-color: @lines; - border-top-color: @lines; -} - .message { border-color: @error; color: @text;