now using event toggles when dragging sliders

patch bump
This commit is contained in:
onyx-and-iris 2022-09-16 09:44:47 +01:00
parent d08299a88d
commit 2c290e2632
9 changed files with 78 additions and 22 deletions

View File

@ -9,11 +9,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [ ] Add support for forest theme (should be coming soon)
## [1.4.0] - 2022-09-03
## [1.5.1] - 2022-09-16
### Added
- 1.5.1 binary to releases
### Changed
- sv_ttk updated to v2.0.
- event toggles used to pause updates when dragging sliders.
### Removed
## [1.4.2] - 2022-09-03
### Added
- tomli/tomllib compatibility layer to support python 3.10
- 1.4.2 binary to releases
## [1.3.0] - 2022-07-14

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "voicemeeter-compact"
version = "1.5.0"
version = "1.5.1"
description = "A Compact Voicemeeter Remote App"
authors = ["onyx-and-iris <code@onyxandiris.online>"]
license = "MIT"

View File

@ -93,11 +93,10 @@ class App(tk.Tk):
def on_update(self, subject):
"""called whenever notified of update"""
if not _base_values.in_scale_button_1:
if subject == "pdirty":
self.after(1, self.subject.notify, "pdirty")
elif subject == "ldirty" and not _base_values.dragging:
self.after(1, self.subject.notify, "ldirty")
if subject == "pdirty" and _base_values.run_update:
self.after(1, self.subject.notify, "pdirty")
elif subject == "ldirty" and not _base_values.dragging:
self.after(1, self.subject.notify, "ldirty")
def _destroy_top_level_frames(self):
"""
@ -118,16 +117,14 @@ class App(tk.Tk):
def dragging(self, event, *args):
if event.widget is self:
if self.drag_id == "":
_base_values.in_scale_button_1 = True
_base_values.dragging = True
else:
self.after_cancel(self.drag_id)
self.drag_id = self.after(100, self.stop_drag)
def stop_drag(self):
_base_values.dragging = False
_base_values.in_scale_button_1 = False
self.drag_id = ""
_base_values.dragging = False
_apps = {kind.name: App.make(kind) for kind in _kinds_all}

View File

@ -41,6 +41,9 @@ class MainFrameBuilder(AbstractBuilder):
sv_ttk.set_theme(_configuration.theme_mode)
print(f"Sunvalley {sv_ttk.get_theme().capitalize()} Theme applied")
self.app.target.event.remove("mdirty")
self.app.target.event.remove("midi")
def create_channelframe(self, type_):
if type_ == "strip":
self.app.strip_frame = _make_channelframe(self.app, type_)

View File

@ -64,15 +64,29 @@ class ChannelLabelFrame(ttk.LabelFrame):
def reset_gain(self, *args):
self.setter("gain", 0)
self.gain.set(0)
self.gainlabel.set(self.gain.get())
def scale_press(self, *args):
_base_values.in_scale_button_1 = True
self.after(1, self.remove_events)
def remove_events(self):
self.parent.target.event.remove("pdirty")
self.parent.target.event.remove("ldirty")
def scale_release(self, *args):
_base_values.in_scale_button_1 = False
_base_values.run_update = False
self.after(1, self.add_events)
def add_events(self):
self.parent.target.event.add("pdirty")
self.parent.target.event.add("ldirty")
self.after(500, self.resume_updates)
def resume_updates(self):
_base_values.run_update = True
def _on_mousewheel(self, event):
_base_values.in_scale_button_1 = True
_base_values.run_update = False
self.gain.set(
self.gain.get()
+ (
@ -86,7 +100,7 @@ class ChannelLabelFrame(ttk.LabelFrame):
elif self.gain.get() < -60:
self.gain.set(-60)
self.setter("gain", self.gain.get())
_base_values.in_scale_button_1 = False
self.after(1, self.resume_updates)
def open_config(self):
if self.conf.get():

View File

@ -37,10 +37,23 @@ class Config(ttk.Frame):
setattr(self.target, param, value)
def scale_press(self, *args):
_base_values.in_scale_button_1 = True
self.after(1, self.remove_events)
def remove_events(self):
self.parent.target.event.remove("pdirty")
self.parent.target.event.remove("ldirty")
def scale_release(self, *args):
_base_values.in_scale_button_1 = False
_base_values.run_update = False
self.after(1, self.add_events)
def add_events(self):
self.parent.target.event.add("pdirty")
self.parent.target.event.add("ldirty")
self.after(350, self.resume_updates)
def resume_updates(self):
_base_values.run_update = True
def scale_enter(self, param, *args):
val = self.slider_vars[self.slider_params.index(param)].get()

View File

@ -45,8 +45,8 @@ class Configurations(metaclass=SingletonMeta):
@dataclass
class BaseValues(metaclass=SingletonMeta):
# are we dragging a scale with mouse 1
in_scale_button_1: bool = False
# pause updates after releasing scale
run_update: bool = True
# are we dragging main window with mouse 1
dragging: bool = False
# a vban connection established

View File

@ -52,7 +52,7 @@ class GainLayer(ttk.LabelFrame):
def reset_gain(self, *args):
self.setter("gain", 0)
self.gain.set(0)
self.gainlabel.set(0)
self.gainlabel.set(self.gain.get())
def scale_callback(self, *args):
"""callback function for scale widget"""
@ -61,12 +61,26 @@ class GainLayer(ttk.LabelFrame):
self.gainlabel.set(round(self.gain.get(), 1))
def scale_press(self, *args):
_base_values.in_scale_button_1 = True
self.after(1, self.remove_events)
def remove_events(self):
self.parent.target.event.remove("pdirty")
self.parent.target.event.remove("ldirty")
def scale_release(self, *args):
_base_values.in_scale_button_1 = False
_base_values.run_update = False
self.after(1, self.add_events)
def add_events(self):
self.parent.target.event.add("pdirty")
self.parent.target.event.add("ldirty")
self.after(500, self.resume_updates)
def resume_updates(self):
_base_values.run_update = True
def _on_mousewheel(self, event):
_base_values.run_update = False
self.gain.set(
self.gain.get()
+ (
@ -80,6 +94,7 @@ class GainLayer(ttk.LabelFrame):
elif self.gain.get() < -60:
self.gain.set(-60)
self.setter("gain", self.gain.get())
self.after(1, self.resume_updates)
def set_on(self):
"""enables a gainlayer. sets its button colour"""

View File

@ -84,4 +84,4 @@ class Navigation(ttk.Frame):
background=f'{"purple" if self.submix.get() else "white"}',
)
self.extend_text.set("REDUCE" if self.extend.get() else "EXTEND")
self.extend_text.set("REDUCE" if self.extend.get() else "EXTEND")