diff --git a/panels/limits.py b/panels/limits.py index 7ff6dabe..859dcae0 100644 --- a/panels/limits.py +++ b/panels/limits.py @@ -69,6 +69,8 @@ class LimitsPanel(ScreenPanel): self.limits[option]['scale'].get_style_context().add_class("option_slider_max") else: self.limits[option]['scale'].get_style_context().remove_class("option_slider_max") + # Infinite scale + self.limits[option]['adjustment'].set_upper(self.values[option] * 1.5) self.limits[option]['scale'].connect("button-release-event", self.set_opt_value, option) def add_option(self, option, optname, units, value): @@ -83,8 +85,9 @@ class LimitsPanel(ScreenPanel): name.set_line_wrap(True) name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR) - scale = Gtk.Scale.new_with_range(orientation=Gtk.Orientation.HORIZONTAL, min=0, max=value * 1.5, step=1) - scale.set_value(value) + # adj (value, lower, upper, step_increment, page_increment, page_size) + adj = Gtk.Adjustment(value, 1, (value * 1.5), 1, 5, 0) + scale = Gtk.Scale.new(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj) scale.set_digits(0) scale.set_hexpand(True) scale.set_has_origin(True) @@ -108,6 +111,7 @@ class LimitsPanel(ScreenPanel): self.limits[option] = { "row": frame, "scale": scale, + "adjustment": adj, } limits = sorted(self.limits) diff --git a/panels/retraction.py b/panels/retraction.py index 09c30d66..1a6e46c4 100644 --- a/panels/retraction.py +++ b/panels/retraction.py @@ -102,6 +102,14 @@ class FWRetractionPanel(ScreenPanel): self.list[option]['scale'].disconnect_by_func(self.set_opt_value) self.list[option]['scale'].set_value(self.values[option]) self.list[option]['scale'].connect("button-release-event", self.set_opt_value, option) + # Infinite scale + for opt in self.options: + if opt['option'] == option: + if self.values[option] > opt["maxval"] * .75: + self.list[option]['adjustment'].set_upper(self.values[option] * 1.5) + else: + self.list[option]['adjustment'].set_upper(opt["maxval"]) + break def add_option(self, option, optname, units, value, digits, maxval): logging.info(f"Adding option: {option}") @@ -116,8 +124,9 @@ class FWRetractionPanel(ScreenPanel): name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR) minimum = 1 if option in ["retract_speed", "unretract_speed"] else 0 self.values[option] = value - scale = Gtk.Scale.new_with_range(orientation=Gtk.Orientation.HORIZONTAL, min=minimum, max=maxval, step=1) - scale.set_value(self.values[option]) + # adj (value, lower, upper, step_increment, page_increment, page_size) + adj = Gtk.Adjustment(value, minimum, maxval, 1, 5, 0) + scale = Gtk.Scale.new(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj) scale.set_digits(digits) scale.set_hexpand(True) scale.set_has_origin(True) @@ -140,6 +149,7 @@ class FWRetractionPanel(ScreenPanel): self.list[option] = { "row": frame, "scale": scale, + "adjustment": adj, } pos = sorted(self.list).index(option)