Apply slider value on release (#430)

Scale will do the action when released instead of many times for every step while sliding.
This commit is contained in:
Randell Hodges
2022-02-13 13:15:39 -06:00
committed by GitHub
parent bf67129528
commit 926773f4f3
3 changed files with 8 additions and 8 deletions

View File

@@ -162,8 +162,8 @@ class SettingsPanel(ScreenPanel):
scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj)
scale.set_hexpand(True)
scale.set_digits(0)
scale.connect("button-release-event", self.scale_moved, option['section'], opt_name)
scale.set_property("width-request", round(self._screen.width/2.2))
scale.connect("value-changed", self.scale_moved, option['section'], opt_name)
dev.add(scale)
elif option['type'] == "printer":
logging.debug("Option: %s" % option)
@@ -230,7 +230,7 @@ class SettingsPanel(ScreenPanel):
if callback is not None:
callback(value)
def scale_moved(self, widget, section, option):
def scale_moved(self, widget, event, section, option):
logging.debug("[%s] %s changed to %s" % (section, option, widget.get_value()))
if section not in self._config.get_config().sections():
self._config.get_config().add_section(section)