From 000b18b6ec008a36bb39dff7d7b813fcf7dac6f1 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Sun, 17 Apr 2022 11:50:44 +0100 Subject: [PATCH] mousewheel scroll step now settable size of mousewheel scroll step now settable add _base_vals.mwscroll_step to data. added [mwscroll_step] to app.toml --- vmcompact/app.py | 6 +++++- vmcompact/channels.py | 12 ++++++++---- vmcompact/configs/app.toml | 18 ++++++++++++++++++ vmcompact/configs/vban.toml | 12 ++++++++++++ vmcompact/data.py | 2 ++ vmcompact/gainlayer.py | 15 +++++++++------ 6 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 vmcompact/configs/app.toml create mode 100644 vmcompact/configs/vban.toml diff --git a/vmcompact/app.py b/vmcompact/app.py index f151201..c8748db 100644 --- a/vmcompact/app.py +++ b/vmcompact/app.py @@ -1,7 +1,6 @@ import tkinter as tk from tkinter import ttk from typing import NamedTuple -from functools import partial from pathlib import Path from .errors import VMCompactErrors @@ -47,6 +46,9 @@ class App(tk.Tk): "width": 80, "height": 130, }, + "mwscroll_step": { + "size": 3, + }, "submixes": { "default": 0, }, @@ -60,6 +62,8 @@ class App(tk.Tk): "extends_horizontal" ] _base_vals.submixes = self.configuration["submixes"]["default"] + _base_vals.mwscroll_step = self.configuration["mwscroll_step"]["size"] + # create menus self.menus = Menus(self, vmr) self.styletable = ttk.Style() diff --git a/vmcompact/channels.py b/vmcompact/channels.py index afc9438..a8fd929 100644 --- a/vmcompact/channels.py +++ b/vmcompact/channels.py @@ -73,10 +73,14 @@ class Channel(ttk.LabelFrame): _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) + self.gain.set( + self.gain.get() + + ( + _base_vals.mwscroll_step + if event.delta > 0 + else -_base_vals.mwscroll_step + ) + ) if self.gain.get() > 12: self.gain.set(12) elif self.gain.get() < -60: diff --git a/vmcompact/configs/app.toml b/vmcompact/configs/app.toml new file mode 100644 index 0000000..a824228 --- /dev/null +++ b/vmcompact/configs/app.toml @@ -0,0 +1,18 @@ +# load with themes enabled? set the default mode +[theme] +enabled=true +mode="light" +# load in extended mode? if so which orientation +[extends] +extended=true +extends_horizontal=true +# default dimensions for channel label frames +[channel] +width=80 +height=130 +# size of a single mouse wheen scroll step +[mwscroll_step] +size=3 +# default submix bus +[submixes] +default=6 diff --git a/vmcompact/configs/vban.toml b/vmcompact/configs/vban.toml new file mode 100644 index 0000000..231acf1 --- /dev/null +++ b/vmcompact/configs/vban.toml @@ -0,0 +1,12 @@ +# example connections +[connection-1] +kind = 'banana' +ip = '' +streamname = 'Command1' +port = 6990 + +[connection-2] +kind = 'potato' +ip = '' +streamname = 'Command1' +port = 6990 diff --git a/vmcompact/data.py b/vmcompact/data.py index d68044b..7b5c9f0 100644 --- a/vmcompact/data.py +++ b/vmcompact/data.py @@ -29,6 +29,8 @@ class BaseValues: strip_level_array_size: int = None # size of bus level array for a kind bus_level_array_size: int = None + # size of mousewheel scroll step + mwscroll_step: int = 3 _base_vals = BaseValues() diff --git a/vmcompact/gainlayer.py b/vmcompact/gainlayer.py index e051205..bd7b974 100644 --- a/vmcompact/gainlayer.py +++ b/vmcompact/gainlayer.py @@ -1,6 +1,5 @@ import tkinter as tk -from tkinter import ttk, messagebox as msg -from functools import partial +from tkinter import ttk from math import log from .data import _base_vals @@ -62,10 +61,14 @@ class GainLayer(ttk.LabelFrame): _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) + self.gain.set( + self.gain.get() + + ( + _base_vals.mwscroll_step + if event.delta > 0 + else -_base_vals.mwscroll_step + ) + ) if self.gain.get() > 12: self.gain.set(12) elif self.gain.get() < -60: