From cd4264be8b5f7a1b83f013a693153a1c36467aa1 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Thu, 14 Apr 2022 20:49:06 +0100 Subject: [PATCH] added bind event mousewheel to gain sliders added bind event mousewheel to gain sliders --- vmcompact/channels.py | 13 +++++++++++++ vmcompact/gainlayer.py | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/vmcompact/channels.py b/vmcompact/channels.py index 1be6cbb..ade928a 100644 --- a/vmcompact/channels.py +++ b/vmcompact/channels.py @@ -72,6 +72,18 @@ class Channel(ttk.LabelFrame): def scale_release(self, *args): _base_vals.in_scale_button_1 = False + def _on_mousewheel(self, event): + if event.delta > 0: + self.gain.set(self.gain.get() + 3) + else: + self.gain.set(self.gain.get() - 3) + if self.gain.get() > 12: + self.gain.set(12) + elif self.gain.get() < -60: + self.gain.set(-60) + self.setter("gain", self.gain.get()) + self._parent._parent.nav_frame.info_text.set(round(self.gain.get(), 1)) + def scale_callback(self, *args): """callback function for scale widget""" self.setter("gain", self.gain.get()) @@ -110,6 +122,7 @@ class Channel(ttk.LabelFrame): self.scale.bind("", self.scale_enter) self.scale.bind("", self.scale_release) self.scale.bind("", self.scale_leave) + self.scale.bind("", self._on_mousewheel) # Mute button self.button_mute = ttk.Checkbutton( diff --git a/vmcompact/gainlayer.py b/vmcompact/gainlayer.py index 606517c..e051205 100644 --- a/vmcompact/gainlayer.py +++ b/vmcompact/gainlayer.py @@ -61,6 +61,18 @@ class GainLayer(ttk.LabelFrame): def scale_release(self, *args): _base_vals.in_scale_button_1 = False + def _on_mousewheel(self, event): + if event.delta > 0: + self.gain.set(self.gain.get() + 3) + else: + self.gain.set(self.gain.get() - 3) + if self.gain.get() > 12: + self.gain.set(12) + elif self.gain.get() < -60: + self.gain.set(-60) + self.setter("gain", self.gain.get()) + self._parent._parent.nav_frame.info_text.set(round(self.gain.get(), 1)) + def scale_callback(self, *args): """callback function for scale widget""" self.setter("gain", self.gain.get()) @@ -112,6 +124,7 @@ class GainLayer(ttk.LabelFrame): self.scale.bind("", self.scale_enter) self.scale.bind("", self.scale_release) self.scale.bind("", self.scale_leave) + self.scale.bind("", self._on_mousewheel) # On button self.button_on = ttk.Checkbutton(