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(