added bind event mousewheel to gain sliders

added bind event mousewheel to gain sliders
This commit is contained in:
onyx-and-iris 2022-04-14 20:49:06 +01:00
parent 8f3672029a
commit cd4264be8b
2 changed files with 26 additions and 0 deletions

View File

@ -72,6 +72,18 @@ class Channel(ttk.LabelFrame):
def scale_release(self, *args): def scale_release(self, *args):
_base_vals.in_scale_button_1 = False _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): def scale_callback(self, *args):
"""callback function for scale widget""" """callback function for scale widget"""
self.setter("gain", self.gain.get()) self.setter("gain", self.gain.get())
@ -110,6 +122,7 @@ class Channel(ttk.LabelFrame):
self.scale.bind("<Enter>", self.scale_enter) self.scale.bind("<Enter>", self.scale_enter)
self.scale.bind("<ButtonRelease-1>", self.scale_release) self.scale.bind("<ButtonRelease-1>", self.scale_release)
self.scale.bind("<Leave>", self.scale_leave) self.scale.bind("<Leave>", self.scale_leave)
self.scale.bind("<MouseWheel>", self._on_mousewheel)
# Mute button # Mute button
self.button_mute = ttk.Checkbutton( self.button_mute = ttk.Checkbutton(

View File

@ -61,6 +61,18 @@ class GainLayer(ttk.LabelFrame):
def scale_release(self, *args): def scale_release(self, *args):
_base_vals.in_scale_button_1 = False _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): def scale_callback(self, *args):
"""callback function for scale widget""" """callback function for scale widget"""
self.setter("gain", self.gain.get()) self.setter("gain", self.gain.get())
@ -112,6 +124,7 @@ class GainLayer(ttk.LabelFrame):
self.scale.bind("<Enter>", self.scale_enter) self.scale.bind("<Enter>", self.scale_enter)
self.scale.bind("<ButtonRelease-1>", self.scale_release) self.scale.bind("<ButtonRelease-1>", self.scale_release)
self.scale.bind("<Leave>", self.scale_leave) self.scale.bind("<Leave>", self.scale_leave)
self.scale.bind("<MouseWheel>", self._on_mousewheel)
# On button # On button
self.button_on = ttk.Checkbutton( self.button_on = ttk.Checkbutton(