remove scale enter/leave binds, use hasattr, fix bug in on_mousewheel

remove redundant scale_enter, scale_leave functions.

use hasattr over in dir()

fix bug in on_mousewheel

patch bump
This commit is contained in:
onyx-and-iris 2022-05-14 17:24:33 +01:00
parent a7f23ef544
commit 823c138a5f
5 changed files with 9 additions and 25 deletions

View File

@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setuptools.setup(
name="vmcompact",
version="1.2.3",
version="1.2.4",
author="Onyx and Iris",
author_email="code@onyxandiris.online",
description="Compact Tkinter Voicemeeter Remote App",

View File

@ -235,9 +235,7 @@ class ChannelLabelFrameBuilder(AbstractBuilder):
self.scale.grid(column=1, row=0)
self.scale.bind("<Double-Button-1>", self.labelframe.reset_gain)
self.scale.bind("<Button-1>", self.labelframe.scale_press)
self.scale.bind("<Enter>", self.labelframe.scale_enter)
self.scale.bind("<ButtonRelease-1>", self.labelframe.scale_release)
self.scale.bind("<Leave>", self.labelframe.scale_leave)
self.scale.bind("<MouseWheel>", self.labelframe._on_mousewheel)
def add_gain_label(self):

View File

@ -39,11 +39,11 @@ class ChannelLabelFrame(ttk.LabelFrame):
return self.parent.target
def getter(self, param):
if param in dir(self.target):
if hasattr(self.target, param):
return getattr(self.target, param)
def setter(self, param, value):
if param in dir(self.target):
if hasattr(self.target, param):
setattr(self.target, param, value)
def scale_callback(self, *args):
@ -64,12 +64,6 @@ class ChannelLabelFrame(ttk.LabelFrame):
self.setter("gain", 0)
self.gain.set(0)
def scale_enter(self, *args):
pass
def scale_leave(self, *args):
pass
def scale_press(self, *args):
_base_values.in_scale_button_1 = True
@ -90,7 +84,6 @@ class ChannelLabelFrame(ttk.LabelFrame):
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 open_config(self):
if self.conf.get():

View File

@ -29,11 +29,11 @@ class Config(ttk.Frame):
return self.parent.target
def getter(self, param):
if param in dir(self.target):
if hasattr(self.target, param):
return getattr(self.target, param)
def setter(self, param, value):
if param in dir(self.target):
if hasattr(self.target, param):
setattr(self.target, param, value)
def scale_press(self, *args):

View File

@ -41,11 +41,11 @@ class GainLayer(ttk.LabelFrame):
return "gainlayer"
def getter(self, param):
if param in dir(self.target):
if hasattr(self.target, param):
return getattr(self.target, param)
def setter(self, param, value):
if param in dir(self.target):
if hasattr(self.target, param):
setattr(self.target, param, value)
def reset_gain(self, *args):
@ -65,19 +65,13 @@ class GainLayer(ttk.LabelFrame):
def scale_release(self, *args):
_base_values.in_scale_button_1 = False
def scale_enter(self, *args):
pass
def scale_leave(self, *args):
pass
def _on_mousewheel(self, event):
self.gain.set(
self.gain.get()
+ (
_base_values.mwscroll_step
_configuration.mwscroll_step
if event.delta > 0
else -_base_values.mwscroll_step
else -_configuration.mwscroll_step
)
)
if self.gain.get() > 12:
@ -85,7 +79,6 @@ class GainLayer(ttk.LabelFrame):
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 set_on(self):
"""enables a gainlayer. sets its button colour"""