36 Commits

Author SHA1 Message Date
b809bcb28f 1.9.0 section added to changelog
minor version bump
2023-07-11 08:36:19 +01:00
a0b9a92a2a added healthcheck_step
checks connection to Voicemeeter.
2023-07-11 08:35:23 +01:00
9faf8ae10c easier to read 2023-07-11 01:27:05 +01:00
82cf0e914b wrap button callbacks with {cls}.pause_updates() 2023-07-11 01:26:46 +01:00
3e68488231 bump deps 2023-07-08 18:19:06 +01:00
6d46d9a9a5 userconfigs now returns target.configs
patch bump
2023-07-08 00:22:07 +01:00
e4068277f7 ensure we don't attempt to delete a menu key twice
patch bump
2023-07-07 03:37:06 +01:00
674999a461 remove callbacks instead
patch bump
2023-06-30 04:27:10 +01:00
e5975f0772 fixes bug where old configs may not have new keys
patch bump
2023-06-29 19:13:06 +01:00
59d2a95ec4 1.8.0 section added to changelog
minor bump
2023-06-29 18:24:54 +01:00
4bae1e1d15 set greace period if gui was launched by the api 2023-06-29 18:14:38 +01:00
1e3751b19f channel_xpadding and navigation_show added to data.
app.toml example now includes channel padding and nav show

[channel] xpadding and [navigation] show added to app.toml

delay parameter updates if gui needed launching
2023-06-29 17:15:03 +01:00
2ec1c74b7d navigation_menu added, toggles the nav frame.
may be configured through app.toml
2023-06-29 15:51:17 +01:00
0a19e28370 xpadding on channels
may be configured through app.toml
2023-06-29 15:50:39 +01:00
5ab1fd7102 add loader to handle userprofiles in vm-compact
ensure we reload user profiles into memory
when rebuilding the config menu

patch bump
2023-06-26 16:08:58 +01:00
d896193ade md fix 2023-06-26 14:18:23 +01:00
8c0c31dc0d 1.7.0 section added 2023-06-26 14:17:24 +01:00
c8b3e9fc33 dependencies updated.
minor version bump
2023-06-26 13:58:22 +01:00
d4358bf7d3 update comp, gate, eq settings in example.toml 2023-06-26 13:57:39 +01:00
194b95d67b use subject class to notify of busmix update
update messageboxes
2023-06-26 13:57:08 +01:00
0f734e87b7 upd docstring 2023-06-26 13:56:06 +01:00
944ef9ca1c updates to events, callbacks 2023-06-26 13:55:50 +01:00
fc20bb0c1e configpaths added to configurations 2023-06-26 13:53:38 +01:00
5ccc2a6dab error class renamed
doc string expanded
2023-06-26 13:52:42 +01:00
cfc1279f6c module level loggers added 2023-06-26 13:52:24 +01:00
d4df11f62d optimizations to reduce the number of api calls
comp, gate, eq parameter calls updated.
2023-06-26 13:51:21 +01:00
onyx-and-iris
3b6e1f61a4 patch ver bump 2022-10-19 14:54:25 +01:00
onyx-and-iris
3f306ddf62 now using event property setters. 2022-10-19 14:54:00 +01:00
onyx-and-iris
732368a65b fix math error in level updates 2022-10-05 23:39:51 +01:00
onyx-and-iris
d7df79b798 upd vban-cmd ver
patch bump
2022-10-05 23:12:25 +01:00
onyx-and-iris
0906f3343b upd dependencies
patch bump
2022-10-05 23:03:46 +01:00
onyx-and-iris
294dfe7d03 changes to progressbar level udpates 2022-10-05 23:03:27 +01:00
onyx-and-iris
4db7be172b bump dep versions
minor version bump
2022-10-04 16:06:47 +01:00
onyx-and-iris
35775f5024 logger.info logs added
voicemeeter-api, vban-cmd dependency ver updated

changelog updated to reflect changes

minor version bump
2022-09-29 13:45:06 +01:00
onyx-and-iris
d4b2b90fc0 run vban.logout() to cleanup threads/sockets.
bump vban-cmd dependency ver.

patch bump
2022-09-24 08:04:59 +01:00
onyx-and-iris
6de79977cc show messagebox on connection timeout
patch bump
2022-09-23 20:23:55 +01:00
21 changed files with 615 additions and 263 deletions

4
.gitignore vendored
View File

@@ -1,5 +1,5 @@
# quick test # quick test
z_*.py quick.py
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
@@ -131,3 +131,5 @@ dmypy.json
# Pyre type checker # Pyre type checker
.pyre/ .pyre/
.vscode/

View File

@@ -7,7 +7,65 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
- [ ] Add support for forest theme (should be coming soon) - [ ] Add support for forest theme (if rbende adds it to pypi)
## [1.9.0] - 2023-07-10
### Added
- Should the voicemeeter-compact app lose communication with Voicemeeter GUI a popup will show asking to restart the GUI.
- If yes is selected the app's mainframe will redraw, there will be a grace period before updates start again due to Voicemeeter engine startup.
### Fixed
- From the menu, Voicemeeter->Shutdown now closes both the compact app and the main Voicemeeter GUI.
## [1.8.0] - 2023-06-29
### Added
- Ability to toggle the navigation frame. This may also be set in app.toml, check example config.
### Changed
- xpadding added to channel labelframes. This may also be configured through app.toml.
- During startup of the app there is now a twelve second grace period before parameter updates begin if the GUI was not previously launched. This is aimed at removing the stutter (due to VM engine startup) on initial launch. Be mindful of this if changing settings on the base Voicemeeter app. After the grace period all updates continue as normal.
- dependency updates:
- sv_ttk updated to v2.5.1.
- voicemeeter-api updated to v2.0.2.
## [1.7.0] - 2023-06-26
### Changed
- There are changes to how some parameters must be set in user toml configs.
- use `comp.knob` to set a strip comp slider.
- use `gate.knob` to set a strip gate slider.
- use `eq.on` to set a bus eq.on button.
- use `eq.ab` to set a bus eq.ab button.
Check example configs.
- `configs` directory may now be located in one of the following locations:
- \<current working directory>/configs/
- \<user home directory>/.configs/vm-compact/configs/
- \<user home directory>/Documents/Voicemeeter/configs/
- dependency updates:
- sv_ttk updated to v2.4.5.
- voicemeeter-api updated to v2.0.1.
- vban-cmd updated to v2.0.0.
### Fixed
- A number of changes that reduce the amount of api calls being made.
## [1.6.0] - 2022-09-29
### Added
- Logging module used in place of print statements across the interface.
## [1.5.1] - 2022-09-16 ## [1.5.1] - 2022-09-16
@@ -20,8 +78,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- sv_ttk updated to v2.0. - sv_ttk updated to v2.0.
- event toggles used to pause updates when dragging sliders. - event toggles used to pause updates when dragging sliders.
### Removed
## [1.4.2] - 2022-09-03 ## [1.4.2] - 2022-09-03
### Added ### Added

View File

@@ -34,16 +34,16 @@ import vmcompact
def main(): def main():
# pass the kind_id and the vm object to the app # choose the kind of Voicemeeter (Local connection)
with voicemeeterlib.api(kind_id) as vm: KIND_ID = "banana"
app = vmcompact.connect(kind_id, vm)
# pass the KIND_ID and the vm object to the app
with voicemeeterlib.api(KIND_ID) as vm:
app = vmcompact.connect(KIND_ID, vm)
app.mainloop() app.mainloop()
if __name__ == "__main__": if __name__ == "__main__":
# choose the kind of Voicemeeter (Local connection)
kind_id = "banana"
main() main()
``` ```
@@ -53,9 +53,9 @@ It's important to know that only labelled strips and buses will appear in the Ch
If the GUI looks like the above when you first load it, then no channels are labelled. From the menu, `Configs->Load config` you may load an example config. Save your current Voicemeeter settings first :). If the GUI looks like the above when you first load it, then no channels are labelled. From the menu, `Configs->Load config` you may load an example config. Save your current Voicemeeter settings first :).
### kind_id ### KIND_ID
Set the kind of Voicemeeter, kind_id may be: Set the kind of Voicemeeter, KIND_ID may be:
- `basic` - `basic`
- `banana` - `banana`

View File

@@ -4,12 +4,12 @@ import vmcompact
def main(): def main():
with voicemeeterlib.api(kind_id) as vmr: KIND_ID = "banana"
app = vmcompact.connect(kind_id, vmr)
with voicemeeterlib.api(KIND_ID) as vmr:
app = vmcompact.connect(KIND_ID, vmr)
app.mainloop() app.mainloop()
if __name__ == "__main__": if __name__ == "__main__":
kind_id = "banana"
main() main()

View File

@@ -3,19 +3,23 @@
# config="example" # config="example"
# load with themes enabled? set the default mode # load with themes enabled? set the default mode
[theme] [theme]
enabled=true enabled = true
mode="light" mode = "light"
# load in extended mode? if so which orientation # load in extended mode? if so which orientation
[extends] [extends]
extended=true extended = true
extends_horizontal=true extends_horizontal = true
# default dimensions for channel label frames # default dimensions for channel label frames
[channel] [channel]
width=80 width = 80
height=130 height = 130
xpadding = 2
# size of a single mouse wheel scroll step # size of a single mouse wheel scroll step
[mwscroll_step] [mwscroll_step]
size=3 size = 3
# default submix bus # default submix bus
[submixes] [submixes]
default=0 default = 0
# show the navigation frame?
[navigation]
show = true

View File

@@ -2,12 +2,12 @@
label = "PhysStrip0" label = "PhysStrip0"
A1 = true A1 = true
gain = -8.8 gain = -8.8
comp = 3.2 comp.knob = 3.2
[strip-1] [strip-1]
label = "PhysStrip1" label = "PhysStrip1"
B1 = true B1 = true
gate = 4.1 gate.knob = 4.1
[strip-2] [strip-2]
label = "PhysStrip2" label = "PhysStrip2"
@@ -34,12 +34,12 @@ mono = true
[bus-2] [bus-2]
label = "PhysBus2" label = "PhysBus2"
eq = true eq.on = true
mode = "composite" mode = "composite"
[bus-3] [bus-3]
label = "VirtBus0" label = "VirtBus0"
eq_ab = true eq.ab = true
mode = "upmix61" mode = "upmix61"
[bus-4] [bus-4]

View File

@@ -2,12 +2,12 @@
label = "PhysStrip0" label = "PhysStrip0"
A1 = true A1 = true
gain = -8.8 gain = -8.8
comp = 3.2 comp.knob = 3.2
[strip-1] [strip-1]
label = "PhysStrip1" label = "PhysStrip1"
B1 = true B1 = true
gate = 4.1 gate.knob = 4.1
[strip-2] [strip-2]
label = "PhysStrip2" label = "PhysStrip2"
@@ -50,7 +50,7 @@ mono = true
[bus-2] [bus-2]
label = "PhysBus2" label = "PhysBus2"
eq = true eq.on = true
[bus-3] [bus-3]
label = "PhysBus3" label = "PhysBus3"
@@ -62,7 +62,7 @@ mode = "composite"
[bus-5] [bus-5]
label = "VirtBus0" label = "VirtBus0"
eq_ab = true eq.ab = true
[bus-6] [bus-6]
label = "VirtBus1" label = "VirtBus1"

View File

@@ -4,10 +4,10 @@
# kind = 'banana' # kind = 'banana'
# ip = '<ip address 1>' # ip = '<ip address 1>'
# streamname = 'Command1' # streamname = 'Command1'
# port = 6990 # port = 6980
# [connection-2] # [connection-2]
# kind = 'potato' # kind = 'potato'
# ip = '<ip address 2>' # ip = '<ip address 2>'
# streamname = 'Command1' # streamname = 'Command1'
# port = 6990 # port = 6980

144
poetry.lock generated
View File

@@ -1,10 +1,25 @@
# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand.
[[package]] [[package]]
name = "black" name = "black"
version = "22.8.0" version = "22.12.0"
description = "The uncompromising code formatter." description = "The uncompromising code formatter."
category = "dev"
optional = false optional = false
python-versions = ">=3.6.2" python-versions = ">=3.7"
files = [
{file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"},
{file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"},
{file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"},
{file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"},
{file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"},
{file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"},
{file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"},
{file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"},
{file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"},
{file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"},
{file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"},
{file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"},
]
[package.dependencies] [package.dependencies]
click = ">=8.0.0" click = ">=8.0.0"
@@ -23,115 +38,132 @@ uvloop = ["uvloop (>=0.15.2)"]
name = "click" name = "click"
version = "8.1.3" version = "8.1.3"
description = "Composable command line interface toolkit" description = "Composable command line interface toolkit"
category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [
{file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"},
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
]
[package.dependencies] [package.dependencies]
colorama = {version = "*", markers = "platform_system == \"Windows\""} colorama = {version = "*", markers = "platform_system == \"Windows\""}
[[package]] [[package]]
name = "colorama" name = "colorama"
version = "0.4.5" version = "0.4.6"
description = "Cross-platform colored terminal text." description = "Cross-platform colored terminal text."
category = "dev"
optional = false optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
files = [
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
]
[[package]]
name = "isort"
version = "5.12.0"
description = "A Python utility / library to sort Python imports."
optional = false
python-versions = ">=3.8.0"
files = [
{file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"},
{file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"},
]
[package.extras]
colors = ["colorama (>=0.4.3)"]
pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"]
plugins = ["setuptools"]
requirements-deprecated-finder = ["pip-api", "pipreqs"]
[[package]] [[package]]
name = "mypy-extensions" name = "mypy-extensions"
version = "0.4.3" version = "1.0.0"
description = "Experimental type system extensions for programs checked with the mypy typechecker." description = "Type system extensions for programs checked with the mypy type checker."
category = "dev"
optional = false optional = false
python-versions = "*" python-versions = ">=3.5"
files = [
{file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"},
{file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"},
]
[[package]] [[package]]
name = "pathspec" name = "pathspec"
version = "0.10.1" version = "0.11.1"
description = "Utility library for gitignore style pattern matching of file paths." description = "Utility library for gitignore style pattern matching of file paths."
category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [
{file = "pathspec-0.11.1-py3-none-any.whl", hash = "sha256:d8af70af76652554bd134c22b3e8a1cc46ed7d91edcdd721ef1a0c51a84a5293"},
{file = "pathspec-0.11.1.tar.gz", hash = "sha256:2798de800fa92780e33acca925945e9a19a133b715067cf165b8866c15a31687"},
]
[[package]] [[package]]
name = "platformdirs" name = "platformdirs"
version = "2.5.2" version = "3.8.0"
description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [
{file = "platformdirs-3.8.0-py3-none-any.whl", hash = "sha256:ca9ed98ce73076ba72e092b23d3c93ea6c4e186b3f1c3dad6edd98ff6ffcca2e"},
{file = "platformdirs-3.8.0.tar.gz", hash = "sha256:b0cabcb11063d21a0b261d557acb0a9d2126350e63b70cdf7db6347baea456dc"},
]
[package.extras] [package.extras]
docs = ["furo (>=2021.7.5b38)", "proselint (>=0.10.2)", "sphinx-autodoc-typehints (>=1.12)", "sphinx (>=4)"] docs = ["furo (>=2023.5.20)", "proselint (>=0.13)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"]
test = ["appdirs (==1.4.4)", "pytest-cov (>=2.7)", "pytest-mock (>=3.6)", "pytest (>=6)"] test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)"]
[[package]] [[package]]
name = "sv-ttk" name = "sv-ttk"
version = "2.0" version = "2.5.1"
description = "A gorgeous theme for Tkinter that looks like Windows 11" description = "A gorgeous theme for Tkinter, based on Windows 11's UI"
category = "main"
optional = false optional = false
python-versions = ">=3.4" python-versions = ">=3.7"
files = [
{file = "sv_ttk-2.5.1-py3-none-any.whl", hash = "sha256:c7388741e14316b4e9c3b9fd135e1e2e5b501f1b30c89b7af1e26286b38f2ccc"},
{file = "sv_ttk-2.5.1.tar.gz", hash = "sha256:e32d60587db7debe4d7d7438f66257ffcd9db5b8efbcb52151697fa8a662a4f5"},
]
[[package]] [[package]]
name = "tomli" name = "tomli"
version = "2.0.1" version = "2.0.1"
description = "A lil' TOML parser" description = "A lil' TOML parser"
category = "main"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
]
[[package]] [[package]]
name = "vban-cmd" name = "vban-cmd"
version = "1.4.2" version = "2.2.0"
description = "Python interface for the VBAN RT Packet Service (Sendtext)" description = "Python interface for the VBAN RT Packet Service (Sendtext)"
category = "main"
optional = false optional = false
python-versions = ">=3.10,<4.0" python-versions = ">=3.10,<4.0"
files = [
{file = "vban_cmd-2.2.0-py3-none-any.whl", hash = "sha256:ad0bd848b5412004c4c14976e8a9a18d0fc727599e343db0fb67f9427c8541fa"},
{file = "vban_cmd-2.2.0.tar.gz", hash = "sha256:7bad6001504fd052df3192c7d817e604703353f57efa7648c1f1d6e425665006"},
]
[package.dependencies] [package.dependencies]
tomli = {version = ">=2.0.1,<3.0.0", markers = "python_version < \"3.11\""} tomli = {version = ">=2.0.1,<3.0.0", markers = "python_version < \"3.11\""}
[[package]] [[package]]
name = "voicemeeter-api" name = "voicemeeter-api"
version = "0.7.0" version = "2.1.2"
description = "A Python wrapper for the Voiceemeter API" description = "A Python wrapper for the Voiceemeter API"
category = "main"
optional = false optional = false
python-versions = ">=3.10,<4.0" python-versions = ">=3.10,<4.0"
files = [
{file = "voicemeeter_api-2.1.2-py3-none-any.whl", hash = "sha256:43a6e36282a89f2701b58f627bdd21c5e17f9f9044bf3337059d89e91f25fc09"},
{file = "voicemeeter_api-2.1.2.tar.gz", hash = "sha256:c24c643e868535786860420fe5775a10e2ace6f79ec4905a172a1c64712f3d6b"},
]
[package.dependencies] [package.dependencies]
tomli = {version = ">=2.0.1,<3.0.0", markers = "python_version < \"3.11\""} tomli = {version = ">=2.0.1,<3.0.0", markers = "python_version < \"3.11\""}
[metadata] [metadata]
lock-version = "1.1" lock-version = "2.0"
python-versions = "^3.10" python-versions = "^3.10"
content-hash = "738f40473a635574dc00427d128af1c3bf45f4290aca9b4d8ae78b6992a486c7" content-hash = "3a59de3a76e4c0ca11c0166750fa1af7d7c887750f855b48c45359068ef04798"
[metadata.files]
black = []
click = [
{file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"},
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"},
]
colorama = [
{file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"},
{file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"},
]
mypy-extensions = [
{file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"},
{file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"},
]
pathspec = []
platformdirs = [
{file = "platformdirs-2.5.2-py3-none-any.whl", hash = "sha256:027d8e83a2d7de06bbac4e5ef7e023c02b863d7ea5d079477e722bb41ab25788"},
{file = "platformdirs-2.5.2.tar.gz", hash = "sha256:58c8abb07dcb441e6ee4b11d8df0ac856038f944ab98b7be6b27b2a3c7feef19"},
]
sv-ttk = []
tomli = [
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
]
vban-cmd = []
voicemeeter-api = []

View File

@@ -1,26 +1,25 @@
[tool.poetry] [tool.poetry]
name = "voicemeeter-compact" name = "voicemeeter-compact"
version = "1.5.1" version = "1.9.0"
description = "A Compact Voicemeeter Remote App" description = "A Compact Voicemeeter Remote App"
authors = ["onyx-and-iris <code@onyxandiris.online>"] authors = ["onyx-and-iris <code@onyxandiris.online>"]
license = "MIT" license = "MIT"
readme = "README.md" readme = "README.md"
repository = "https://github.com/onyx-and-iris/voicemeeter-compact" repository = "https://github.com/onyx-and-iris/voicemeeter-compact"
packages = [ packages = [{ include = "vmcompact" }]
{ include = "vmcompact" },
]
include = ["vmcompact/img/cat.ico"] include = ["vmcompact/img/cat.ico"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.10" python = "^3.10"
sv-ttk = "^2.0" sv-ttk = "^2.5.1"
tomli = { version = "^2.0.1", python = "<3.11" } tomli = { version = "^2.0.1", python = "<3.11" }
voicemeeter-api = "^0.7.0" voicemeeter-api = "^2.1.2"
vban-cmd = "^1.4.2" vban-cmd = "^2.2.0"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
black = {version = "^22.6.0", allow-prereleases = true} black = { version = "^22.6.0", allow-prereleases = true }
isort = "^5.12.0"
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.0.0"]

View File

@@ -1,14 +1,21 @@
import logging
import tkinter as tk import tkinter as tk
from functools import cached_property
from pathlib import Path from pathlib import Path
from tkinter import ttk from tkinter import messagebox, ttk
from typing import NamedTuple from typing import NamedTuple
import voicemeeterlib
from .builders import MainFrameBuilder from .builders import MainFrameBuilder
from .data import _base_values, _configuration, _kinds_all from .configurations import loader
from .errors import VMCompactErrors from .data import _base_values, _configuration, _kinds_all, get_configuration
from .errors import VMCompactError
from .menu import Menus from .menu import Menus
from .subject import Subject from .subject import Subject
logger = logging.getLogger(__name__)
class App(tk.Tk): class App(tk.Tk):
"""App mainframe""" """App mainframe"""
@@ -32,15 +39,18 @@ class App(tk.Tk):
def __init__(self, vmr): def __init__(self, vmr):
super().__init__() super().__init__()
self.logger = logger.getChild(self.__class__.__name__)
self._vmr = vmr self._vmr = vmr
self._vmr.event.add("ldirty") self._vmr.event.add(["pdirty", "ldirty"])
self.after(12000 if self._vmr.gui.launched_by_api else 1, self.start_updates)
self._vmr.init_thread()
icon_path = Path(__file__).parent.resolve() / "img" / "cat.ico" icon_path = Path(__file__).parent.resolve() / "img" / "cat.ico"
if icon_path.is_file(): if icon_path.is_file():
self.iconbitmap(str(icon_path)) self.iconbitmap(str(icon_path))
self.minsize(275, False) self.minsize(275, False)
self.subject = Subject() self.subject = Subject()
self["menu"] = Menus(self, vmr) self._configs = None
self.menu = self["menu"] = Menus(self, vmr)
self.styletable = ttk.Style() self.styletable = ttk.Style()
if _configuration.config: if _configuration.config:
vmr.apply_config(_configuration.config) vmr.apply_config(_configuration.config)
@@ -50,6 +60,11 @@ class App(tk.Tk):
self.drag_id = "" self.drag_id = ""
self.bind("<Configure>", self.dragging) self.bind("<Configure>", self.dragging)
self.after(1, self.healthcheck_step)
def __str__(self):
return f"{type(self).__name__}App"
@property @property
def target(self): def target(self):
"""returns the current interface""" """returns the current interface"""
@@ -74,8 +89,8 @@ class App(tk.Tk):
if kind: if kind:
self.kind = kind self.kind = kind
# register app as observer # register event callbacks
self.target.subject.add(self) self.target.subject.add([self.on_pdirty, self.on_ldirty])
self.bus_frame = None self.bus_frame = None
self.submix_frame = None self.submix_frame = None
@@ -90,12 +105,12 @@ class App(tk.Tk):
if self.kind.name == "potato": if self.kind.name == "potato":
self.builder.create_banner() self.builder.create_banner()
def on_update(self, subject): def on_pdirty(self):
"""called whenever notified of update""" if _base_values.run_update:
if subject == "pdirty" and _base_values.run_update:
self.after(1, self.subject.notify, "pdirty") self.after(1, self.subject.notify, "pdirty")
elif subject == "ldirty" and not _base_values.dragging:
def on_ldirty(self):
if not _base_values.dragging:
self.after(1, self.subject.notify, "ldirty") self.after(1, self.subject.notify, "ldirty")
def _destroy_top_level_frames(self): def _destroy_top_level_frames(self):
@@ -106,7 +121,7 @@ class App(tk.Tk):
Destroy all top level frames. Destroy all top level frames.
""" """
self.target.subject.remove(self) self.target.subject.remove([self.on_pdirty, self.on_ldirty])
self.subject.clear() self.subject.clear()
[ [
frame.destroy() frame.destroy()
@@ -126,6 +141,47 @@ class App(tk.Tk):
self.drag_id = "" self.drag_id = ""
_base_values.dragging = False _base_values.dragging = False
@cached_property
def userconfigs(self):
self._configs = loader(self.kind.name, self.target)
return self._configs
def start_updates(self):
self.logger.debug("updates started")
_base_values.run_update = True
if self._vmr.gui.launched_by_api:
self.on_pdirty()
def healthcheck_step(self):
if not _base_values.vban_connected:
try:
self._vmr.pdirty
except voicemeeterlib.error.CAPIError:
resp = messagebox.askyesno(message="Restart Voicemeeter GUI?")
if resp:
self.logger.debug(
"healthcheck failed, rebuilding the app after GUI restart."
)
self._vmr.end_thread()
self._vmr.run_voicemeeter(self._vmr.kind.name)
_base_values.run_update = False
self._vmr.init_thread()
self.after(8000, self.start_updates)
self._destroy_top_level_frames()
self.build_app(self._vmr.kind)
vban_config = get_configuration("vban")
for i, _ in enumerate(vban_config):
target = getattr(self.menu, f"menu_vban_{i+1}")
target.entryconfig(0, state="normal")
target.entryconfig(1, state="disabled")
[
self.menu.menu_vban.entryconfig(j, state="normal")
for j, _ in enumerate(self.menu.menu_vban.winfo_children())
]
else:
self.destroy()
self.after(250, self.healthcheck_step)
_apps = {kind.name: App.make(kind) for kind in _kinds_all} _apps = {kind.name: App.make(kind) for kind in _kinds_all}
@@ -136,5 +192,5 @@ def connect(kind_id: str, vmr) -> App:
try: try:
VMMIN_cls = _apps[kind_id] VMMIN_cls = _apps[kind_id]
except KeyError: except KeyError:
raise VMCompactErrors(f"Invalid kind: {kind_id}") raise VMCompactError(f"Invalid kind: {kind_id}")
return VMMIN_cls(vmr) return VMMIN_cls(vmr)

View File

@@ -1,15 +1,19 @@
import logging
import tkinter as tk import tkinter as tk
from tkinter import ttk from tkinter import ttk
from .data import _base_values, _configuration from .data import _base_values, _configuration
logger = logging.getLogger(__name__)
class Banner(ttk.Frame): class Banner(ttk.Frame):
def __init__(self, parent): def __init__(self, parent):
super().__init__() super().__init__()
self.parent = parent self.parent = parent
self.submix = tk.StringVar() self.parent.subject.add(self)
self.submix.set(self.target.bus[_configuration.submixes].label) self.logger = logger.getChild(self.__class__.__name__)
self.submix = tk.StringVar(value=self.target.bus[_configuration.submixes].label)
self.label = ttk.Label( self.label = ttk.Label(
self, self,
@@ -17,19 +21,15 @@ class Banner(ttk.Frame):
) )
self.label.grid(column=0, row=0, sticky=(tk.N, tk.S, tk.W, tk.E)) self.label.grid(column=0, row=0, sticky=(tk.N, tk.S, tk.W, tk.E))
self.upd_submix()
@property @property
def target(self): def target(self):
"""returns the current interface""" """returns the current interface"""
return self.parent.target return self.parent.target
def upd_submix(self): def on_update(self, subject):
self.after(1, self.upd_submix_step) if subject == "submix":
if not _base_values.dragging:
def upd_submix_step(self): self.logger.debug("checking submix for banner")
if not _base_values.dragging: self.submix.set(self.target.bus[_configuration.submixes].label)
self.submix.set(self.target.bus[_configuration.submixes].label) self.label["text"] = f"SUBMIX: {self.submix.get().upper()}"
self.label["text"] = f"SUBMIX: {self.submix.get().upper()}"
self.after(100, self.upd_submix_step)

View File

@@ -1,4 +1,5 @@
import abc import abc
import logging
import tkinter as tk import tkinter as tk
from functools import partial from functools import partial
from tkinter import ttk from tkinter import ttk
@@ -11,6 +12,8 @@ from .config import BusConfig, StripConfig
from .data import _base_values, _configuration from .data import _base_values, _configuration
from .navigation import Navigation from .navigation import Navigation
logger = logging.getLogger(__name__)
class AbstractBuilder(abc.ABC): class AbstractBuilder(abc.ABC):
@abc.abstractmethod @abc.abstractmethod
@@ -30,6 +33,7 @@ class MainFrameBuilder(AbstractBuilder):
def __init__(self, app): def __init__(self, app):
self.kind = app.kind self.kind = app.kind
self.app = app self.app = app
self.logger = logger.getChild(self.__class__.__name__)
def setup(self): def setup(self):
self.app.title( self.app.title(
@@ -39,24 +43,26 @@ class MainFrameBuilder(AbstractBuilder):
if _configuration.themes_enabled: if _configuration.themes_enabled:
if sv_ttk.get_theme() not in ("light", "dark"): if sv_ttk.get_theme() not in ("light", "dark"):
sv_ttk.set_theme(_configuration.theme_mode) sv_ttk.set_theme(_configuration.theme_mode)
print(f"Sunvalley {sv_ttk.get_theme().capitalize()} Theme applied") self.logger.info(
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_): def create_channelframe(self, type_):
if type_ == "strip": if type_ == "strip":
self.app.strip_frame = _make_channelframe(self.app, type_) self.app.strip_frame = _make_channelframe(self.app, type_)
else: else:
self.app.bus_frame = _make_channelframe(self.app, type_) self.app.bus_frame = _make_channelframe(self.app, type_)
self.logger.info(f"Finished building channelframe type {type_}")
def create_separator(self): def create_separator(self):
self.app.sep = ttk.Separator(self.app, orient="vertical") self.app.sep = ttk.Separator(self.app, orient="vertical")
self.app.sep.grid(row=0, column=1, sticky=(tk.N, tk.S)) self.app.sep.grid(row=0, column=1, sticky=(tk.N, tk.S))
self.app.columnconfigure(1, minsize=15) self.app.columnconfigure(1, minsize=15)
self.logger.info(f"Finished building separator")
def create_navframe(self): def create_navframe(self):
self.app.nav_frame = Navigation(self.app) self.app.nav_frame = Navigation(self.app)
self.logger.info(f"Finished building navframe")
def create_configframe(self, type_, index, id): def create_configframe(self, type_, index, id):
if type_ == "strip": if type_ == "strip":
@@ -102,6 +108,7 @@ class MainFrameBuilder(AbstractBuilder):
) )
for _, frame in enumerate(self.app.bus_frame.labelframes) for _, frame in enumerate(self.app.bus_frame.labelframes)
] ]
self.logger.info(f"Finished building configframe for {type_}[{index}]")
self.app.after(5, self.reset_config_frames) self.app.after(5, self.reset_config_frames)
def reset_config_frames(self): def reset_config_frames(self):
@@ -114,6 +121,7 @@ class MainFrameBuilder(AbstractBuilder):
def create_banner(self): def create_banner(self):
self.app.banner = Banner(self.app) self.app.banner = Banner(self.app)
self.app.banner.grid(row=4, column=0, columnspan=3) self.app.banner.grid(row=4, column=0, columnspan=3)
self.logger.info(f"Finished building banner")
def teardown(self): def teardown(self):
pass pass
@@ -187,9 +195,9 @@ class NavigationFrameBuilder(AbstractBuilder):
if isinstance(child, ttk.Checkbutton) if isinstance(child, ttk.Checkbutton)
] ]
if _configuration.themes_enabled: if _configuration.themes_enabled:
self.navframe.rowconfigure(1, minsize=_configuration.level_height) self.navframe.rowconfigure(1, minsize=_configuration.channel_height)
else: else:
self.navframe.rowconfigure(1, minsize=_configuration.level_height + 10) self.navframe.rowconfigure(1, minsize=_configuration.channel_height + 10)
def teardown(self): def teardown(self):
pass pass
@@ -219,7 +227,7 @@ class ChannelLabelFrameBuilder(AbstractBuilder):
"""Adds a progress bar widget to a single label frame""" """Adds a progress bar widget to a single label frame"""
self.labelframe.pb = ttk.Progressbar( self.labelframe.pb = ttk.Progressbar(
self.labelframe, self.labelframe,
maximum=100, maximum=72,
orient="vertical", orient="vertical",
mode="determinate", mode="determinate",
variable=self.labelframe.level, variable=self.labelframe.level,
@@ -235,13 +243,19 @@ class ChannelLabelFrameBuilder(AbstractBuilder):
orient="vertical", orient="vertical",
variable=self.labelframe.gain, variable=self.labelframe.gain,
command=self.labelframe.scale_callback, command=self.labelframe.scale_callback,
length=_configuration.level_height, length=_configuration.channel_height,
) )
self.scale.grid(column=1, row=0) self.scale.grid(column=1, row=0)
self.scale.bind("<Double-Button-1>", self.labelframe.reset_gain) self.scale.bind("<Double-Button-1>", self.labelframe.reset_gain)
self.scale.bind("<Button-1>", self.labelframe.scale_press) self.scale.bind("<Button-1>", self.labelframe.scale_press)
self.scale.bind("<ButtonRelease-1>", self.labelframe.scale_release) self.scale.bind("<ButtonRelease-1>", self.labelframe.scale_release)
self.scale.bind("<MouseWheel>", self.labelframe._on_mousewheel) self.scale.bind(
"<MouseWheel>",
partial(
self.labelframe.pause_updates,
self.labelframe._on_mousewheel,
),
)
def add_gain_label(self): def add_gain_label(self):
self.labelframe.gain_label = ttk.Label( self.labelframe.gain_label = ttk.Label(
@@ -255,7 +269,7 @@ class ChannelLabelFrameBuilder(AbstractBuilder):
self.button_mute = ttk.Checkbutton( self.button_mute = ttk.Checkbutton(
self.labelframe, self.labelframe,
text="MUTE", text="MUTE",
command=partial(self.labelframe.toggle_mute, "mute"), command=partial(self.labelframe.pause_updates, self.labelframe.toggle_mute),
style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{self.identifier}Mute{self.index}.TButton'}", style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{self.identifier}Mute{self.index}.TButton'}",
variable=self.labelframe.mute, variable=self.labelframe.mute,
) )
@@ -275,7 +289,7 @@ class ChannelLabelFrameBuilder(AbstractBuilder):
self.button_on = ttk.Checkbutton( self.button_on = ttk.Checkbutton(
self.labelframe, self.labelframe,
text="ON", text="ON",
command=self.labelframe.set_on, command=partial(self.labelframe.pause_updates, self.labelframe.set_on),
style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{self.identifier}On{self.index}.TButton'}", style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{self.identifier}On{self.index}.TButton'}",
variable=self.labelframe.on, variable=self.labelframe.on,
) )
@@ -316,7 +330,7 @@ class ChannelConfigFrameBuilder(AbstractBuilder):
] ]
self.configframe.grid(sticky=(tk.W)) self.configframe.grid(sticky=(tk.W))
[ [
self.configframe.columnconfigure(i, minsize=_configuration.level_width) self.configframe.columnconfigure(i, minsize=_configuration.channel_width)
for i in range(self.configframe.phys_out + self.configframe.virt_out) for i in range(self.configframe.phys_out + self.configframe.virt_out)
] ]
@@ -329,7 +343,7 @@ class StripConfigFrameBuilder(ChannelConfigFrameBuilder):
self.configframe.slider_params = ("audibility",) self.configframe.slider_params = ("audibility",)
self.configframe.slider_vars = (tk.DoubleVar(),) self.configframe.slider_vars = (tk.DoubleVar(),)
else: else:
self.configframe.slider_params = ("comp", "gate", "limit") self.configframe.slider_params = ("comp.knob", "gate.knob", "limit")
self.configframe.slider_vars = [ self.configframe.slider_vars = [
tk.DoubleVar() for _ in self.configframe.slider_params tk.DoubleVar() for _ in self.configframe.slider_params
] ]
@@ -384,18 +398,18 @@ class StripConfigFrameBuilder(ChannelConfigFrameBuilder):
from_=0.0, from_=0.0,
to=10.0, to=10.0,
orient="horizontal", orient="horizontal",
length=_configuration.level_width, length=_configuration.channel_width,
variable=self.configframe.slider_vars[ variable=self.configframe.slider_vars[
self.configframe.slider_params.index("comp") self.configframe.slider_params.index("comp.knob")
], ],
command=partial(self.configframe.scale_callback, "comp"), command=partial(self.configframe.scale_callback, "comp.knob"),
) )
comp_scale.bind( comp_scale.bind(
"<Double-Button-1>", partial(self.configframe.reset_scale, "comp", 0) "<Double-Button-1>", partial(self.configframe.reset_scale, "comp.knob", 0)
) )
comp_scale.bind("<Button-1>", self.configframe.scale_press) comp_scale.bind("<Button-1>", self.configframe.scale_press)
comp_scale.bind("<ButtonRelease-1>", self.configframe.scale_release) comp_scale.bind("<ButtonRelease-1>", self.configframe.scale_release)
comp_scale.bind("<Enter>", partial(self.configframe.scale_enter, "comp")) comp_scale.bind("<Enter>", partial(self.configframe.scale_enter, "comp.knob"))
comp_scale.bind("<Leave>", self.configframe.scale_leave) comp_scale.bind("<Leave>", self.configframe.scale_leave)
comp_label.grid(column=0, row=0) comp_label.grid(column=0, row=0)
@@ -408,18 +422,18 @@ class StripConfigFrameBuilder(ChannelConfigFrameBuilder):
from_=0.0, from_=0.0,
to=10.0, to=10.0,
orient="horizontal", orient="horizontal",
length=_configuration.level_width, length=_configuration.channel_width,
variable=self.configframe.slider_vars[ variable=self.configframe.slider_vars[
self.configframe.slider_params.index("gate") self.configframe.slider_params.index("gate.knob")
], ],
command=partial(self.configframe.scale_callback, "gate"), command=partial(self.configframe.scale_callback, "gate.knob"),
) )
gate_scale.bind( gate_scale.bind(
"<Double-Button-1>", partial(self.configframe.reset_scale, "gate", 0) "<Double-Button-1>", partial(self.configframe.reset_scale, "gate.knob", 0)
) )
gate_scale.bind("<Button-1>", self.configframe.scale_press) gate_scale.bind("<Button-1>", self.configframe.scale_press)
gate_scale.bind("<ButtonRelease-1>", self.configframe.scale_release) gate_scale.bind("<ButtonRelease-1>", self.configframe.scale_release)
gate_scale.bind("<Enter>", partial(self.configframe.scale_enter, "gate")) gate_scale.bind("<Enter>", partial(self.configframe.scale_enter, "gate.knob"))
gate_scale.bind("<Leave>", self.configframe.scale_leave) gate_scale.bind("<Leave>", self.configframe.scale_leave)
gate_label.grid(column=2, row=0) gate_label.grid(column=2, row=0)
@@ -432,7 +446,7 @@ class StripConfigFrameBuilder(ChannelConfigFrameBuilder):
from_=-40, from_=-40,
to=12, to=12,
orient="horizontal", orient="horizontal",
length=_configuration.level_width, length=_configuration.channel_width,
variable=self.configframe.slider_vars[ variable=self.configframe.slider_vars[
self.configframe.slider_params.index("limit") self.configframe.slider_params.index("limit")
], ],
@@ -456,7 +470,7 @@ class StripConfigFrameBuilder(ChannelConfigFrameBuilder):
from_=0.0, from_=0.0,
to=10.0, to=10.0,
orient="horizontal", orient="horizontal",
length=_configuration.level_width, length=_configuration.channel_width,
variable=self.configframe.slider_vars[ variable=self.configframe.slider_vars[
self.configframe.slider_params.index("audibility") self.configframe.slider_params.index("audibility")
], ],
@@ -478,7 +492,9 @@ class StripConfigFrameBuilder(ChannelConfigFrameBuilder):
ttk.Checkbutton( ttk.Checkbutton(
self.configframe, self.configframe,
text=param, text=param,
command=partial(self.configframe.toggle_a, param), command=partial(
self.configframe.pause_updates, self.configframe.toggle_a, param
),
style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{param}.TButton'}", style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{param}.TButton'}",
variable=self.configframe.phys_out_params_vars[ variable=self.configframe.phys_out_params_vars[
self.configframe.phys_out_params.index(param) self.configframe.phys_out_params.index(param)
@@ -499,7 +515,9 @@ class StripConfigFrameBuilder(ChannelConfigFrameBuilder):
ttk.Checkbutton( ttk.Checkbutton(
self.configframe, self.configframe,
text=param, text=param,
command=partial(self.configframe.toggle_b, param), command=partial(
self.configframe.pause_updates, self.configframe.toggle_b, param
),
style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{param}.TButton'}", style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{param}.TButton'}",
variable=self.configframe.virt_out_params_vars[ variable=self.configframe.virt_out_params_vars[
self.configframe.virt_out_params.index(param) self.configframe.virt_out_params.index(param)
@@ -520,7 +538,9 @@ class StripConfigFrameBuilder(ChannelConfigFrameBuilder):
ttk.Checkbutton( ttk.Checkbutton(
self.configframe, self.configframe,
text=param, text=param,
command=partial(self.configframe.toggle_p, param), command=partial(
self.configframe.pause_updates, self.configframe.toggle_p, param
),
style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{param}.TButton'}", style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{param}.TButton'}",
variable=self.configframe.param_vars[i], variable=self.configframe.param_vars[i],
) )
@@ -556,7 +576,7 @@ class BusConfigFrameBuilder(ChannelConfigFrameBuilder):
} }
self.configframe.bus_modes = list(self.configframe.bus_mode_map.keys()) self.configframe.bus_modes = list(self.configframe.bus_mode_map.keys())
# fmt: on # fmt: on
self.configframe.params = ("mono", "eq", "eq_ab") self.configframe.params = ("mono", "eq.on", "eq.ab")
self.configframe.param_vars = [tk.BooleanVar() for _ in self.configframe.params] self.configframe.param_vars = [tk.BooleanVar() for _ in self.configframe.params]
self.configframe.bus_mode_label_text = tk.StringVar( self.configframe.bus_mode_label_text = tk.StringVar(
value=self.configframe.bus_mode_map[self.configframe.current_bus_mode()] value=self.configframe.bus_mode_map[self.configframe.current_bus_mode()]
@@ -570,10 +590,16 @@ class BusConfigFrameBuilder(ChannelConfigFrameBuilder):
column=0, row=0, columnspan=2, sticky=(tk.W) column=0, row=0, columnspan=2, sticky=(tk.W)
) )
self.configframe.busmode_button.bind( self.configframe.busmode_button.bind(
"<Button-1>", self.configframe.rotate_bus_modes_right "<Button-1>",
partial(
self.configframe.pause_updates, self.configframe.rotate_bus_modes_right
),
) )
self.configframe.busmode_button.bind( self.configframe.busmode_button.bind(
"<Button-3>", self.configframe.rotate_bus_modes_left "<Button-3>",
partial(
self.configframe.pause_updates, self.configframe.rotate_bus_modes_left
),
) )
def create_param_buttons(self): def create_param_buttons(self):
@@ -581,7 +607,9 @@ class BusConfigFrameBuilder(ChannelConfigFrameBuilder):
ttk.Checkbutton( ttk.Checkbutton(
self.configframe, self.configframe,
text=param, text=param,
command=partial(self.configframe.toggle_p, param), command=partial(
self.configframe.pause_updates, self.configframe.toggle_p, param
),
style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{param}.TButton'}", style=f"{'Toggle.TButton' if _configuration.themes_enabled else f'{param}.TButton'}",
variable=self.configframe.param_vars[i], variable=self.configframe.param_vars[i],
) )

View File

@@ -1,10 +1,12 @@
import logging
import tkinter as tk import tkinter as tk
from math import log
from tkinter import ttk from tkinter import ttk
from . import builders from . import builders
from .data import _base_values, _configuration from .data import _base_values, _configuration
logger = logging.getLogger(__name__)
class ChannelLabelFrame(ttk.LabelFrame): class ChannelLabelFrame(ttk.LabelFrame):
"""Base class for a single channel""" """Base class for a single channel"""
@@ -14,6 +16,7 @@ class ChannelLabelFrame(ttk.LabelFrame):
self.parent = parent self.parent = parent
self.index = index self.index = index
self.id = id self.id = id
self.logger = logger.getChild(self.__class__.__name__)
self.styletable = self.parent.parent.styletable self.styletable = self.parent.parent.styletable
self.builder = builders.ChannelLabelFrameBuilder(self, index, id) self.builder = builders.ChannelLabelFrameBuilder(self, index, id)
@@ -40,18 +43,21 @@ class ChannelLabelFrame(ttk.LabelFrame):
return self.parent.target return self.parent.target
def getter(self, param): def getter(self, param):
if hasattr(self.target, param): try:
return getattr(self.target, param) return getattr(self.target, param)
except AttributeError as e:
self.logger(f"{type(e).__name__}: {e}")
def setter(self, param, value): def setter(self, param, value):
if hasattr(self.target, param): if param in dir(self.target): # avoid calling getattr (with hasattr)
setattr(self.target, param, value) setattr(self.target, param, value)
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()) val = round(self.gain.get(), 1)
self.gainlabel.set(round(self.gain.get(), 1)) self.setter("gain", val)
self.gainlabel.set(val)
def toggle_mute(self, *args): def toggle_mute(self, *args):
self.target.mute = self.mute.get() self.target.mute = self.mute.get()
@@ -82,17 +88,27 @@ class ChannelLabelFrame(ttk.LabelFrame):
self.parent.target.event.add("ldirty") self.parent.target.event.add("ldirty")
self.after(500, self.resume_updates) self.after(500, self.resume_updates)
def pause_updates(self, func, *args):
"""function wrapper, adds a 50ms delay on updates"""
_base_values.run_update = False
func(*args)
self.after(50, self.resume_updates)
def resume_updates(self): def resume_updates(self):
_base_values.run_update = True _base_values.run_update = True
def _on_mousewheel(self, event): def _on_mousewheel(self, event):
_base_values.run_update = False
self.gain.set( self.gain.set(
self.gain.get() round(
+ ( self.gain.get()
_configuration.mwscroll_step + (
if event.delta > 0 _configuration.mwscroll_step
else -_configuration.mwscroll_step if event.delta > 0
else -_configuration.mwscroll_step
),
1,
) )
) )
if self.gain.get() > 12: if self.gain.get() > 12:
@@ -100,7 +116,7 @@ class ChannelLabelFrame(ttk.LabelFrame):
elif self.gain.get() < -60: elif self.gain.get() < -60:
self.gain.set(-60) self.gain.set(-60)
self.setter("gain", self.gain.get()) self.setter("gain", self.gain.get())
self.after(1, self.resume_updates) self.gainlabel.set(round(self.gain.get(), 1))
def open_config(self): def open_config(self):
if self.conf.get(): if self.conf.get():
@@ -148,7 +164,7 @@ class ChannelLabelFrame(ttk.LabelFrame):
self.configure(text=retval) self.configure(text=retval)
def grid_configure(self): def grid_configure(self):
self.grid(sticky=(tk.N, tk.S)) self.grid(padx=_configuration.channel_xpadding, sticky=(tk.N, tk.S))
[ [
child.grid_configure(padx=1, pady=1, sticky=(tk.W, tk.E)) child.grid_configure(padx=1, pady=1, sticky=(tk.W, tk.E))
for child in self.winfo_children() for child in self.winfo_children()
@@ -186,7 +202,7 @@ class Strip(ChannelLabelFrame):
if self.target.levels.is_updated: if self.target.levels.is_updated:
val = max(self.target.levels.prefader) val = max(self.target.levels.prefader)
self.level.set( self.level.set(
(0 if self.mute.get() else 100 + val - 18 + self.gain.get()) (0 if self.mute.get() else 72 + val - 12 + self.gain.get())
) )
@@ -208,7 +224,7 @@ class Bus(ChannelLabelFrame):
if self.index < self.parent.parent.kind.num_bus: if self.index < self.parent.parent.kind.num_bus:
if self.target.levels.is_updated or self.level.get() != -118: if self.target.levels.is_updated or self.level.get() != -118:
val = max(self.target.levels.all) val = max(self.target.levels.all)
self.level.set((0 if self.mute.get() else 100 + val - 18)) self.level.set((0 if self.mute.get() else 72 + val - 12))
class ChannelFrame(ttk.Frame): class ChannelFrame(ttk.Frame):
@@ -252,7 +268,7 @@ class ChannelFrame(ttk.Frame):
def grid_configure(self): def grid_configure(self):
[ [
self.columnconfigure(i, minsize=_configuration.level_width) self.columnconfigure(i, minsize=_configuration.channel_width)
for i, _ in enumerate(self.labelframes) for i, _ in enumerate(self.labelframes)
] ]
[self.rowconfigure(0, minsize=100) for i, _ in enumerate(self.labelframes)] [self.rowconfigure(0, minsize=100) for i, _ in enumerate(self.labelframes)]

View File

@@ -1,10 +1,11 @@
import tkinter as tk import logging
from functools import partial
from tkinter import ttk from tkinter import ttk
from . import builders from . import builders
from .data import _base_values, _configuration from .data import _base_values, _configuration
logger = logging.getLogger(__name__)
class Config(ttk.Frame): class Config(ttk.Frame):
def __init__(self, parent, index, _id): def __init__(self, parent, index, _id):
@@ -12,6 +13,7 @@ class Config(ttk.Frame):
self.parent = parent self.parent = parent
self.index = index self.index = index
self.id = _id self.id = _id
self.logger = logger.getChild(self.__class__.__name__)
self.styletable = parent.styletable self.styletable = parent.styletable
self.phys_in, self.virt_in = parent.kind.ins self.phys_in, self.virt_in = parent.kind.ins
self.phys_out, self.virt_out = parent.kind.outs self.phys_out, self.virt_out = parent.kind.outs
@@ -29,12 +31,26 @@ class Config(ttk.Frame):
return self.parent.target return self.parent.target
def getter(self, param): def getter(self, param):
if hasattr(self.target, param): param = param.split(".")
return getattr(self.target, param) try:
if len(param) == 2:
target = getattr(self.target, param[0])
return getattr(target, param[1])
else:
return getattr(self.target, param[0])
except AttributeError as e:
self.logger.error(f"{type(e).__name__}: {e}")
def setter(self, param, value): def setter(self, param, value):
if hasattr(self.target, param): param = param.split(".")
setattr(self.target, param, value) try:
if len(param) == 2:
target = getattr(self.target, param[0])
setattr(target, param[1], value)
else:
setattr(self.target, param[0], value)
except AttributeError as e:
self.logger(f"{type(e).__name__}: {e}")
def scale_press(self, *args): def scale_press(self, *args):
self.after(1, self.remove_events) self.after(1, self.remove_events)
@@ -52,6 +68,14 @@ class Config(ttk.Frame):
self.parent.target.event.add("ldirty") self.parent.target.event.add("ldirty")
self.after(350, self.resume_updates) self.after(350, self.resume_updates)
def pause_updates(self, func, *args):
"""function wrapper, adds a 50ms delay on updates"""
_base_values.run_update = False
func(*args)
self.after(50, self.resume_updates)
def resume_updates(self): def resume_updates(self):
_base_values.run_update = True _base_values.run_update = True
@@ -66,7 +90,7 @@ class Config(ttk.Frame):
"""callback function for scale widget""" """callback function for scale widget"""
val = self.slider_vars[self.slider_params.index(param)].get() val = self.slider_vars[self.slider_params.index(param)].get()
self.setter(param, val) self.setter(param, round(val, 1))
self.parent.nav_frame.info_text.set(round(val, 1)) self.parent.nav_frame.info_text.set(round(val, 1))
def reset_scale(self, param, val, *args): def reset_scale(self, param, val, *args):
@@ -98,6 +122,7 @@ class StripConfig(Config):
self.make_row_2() self.make_row_2()
self.builder.grid_configure() self.builder.grid_configure()
self.parent.target.clear_dirty()
self.sync() self.sync()
@property @property
@@ -155,6 +180,12 @@ class StripConfig(Config):
self.param_vars[i].set(self.getter(param)) self.param_vars[i].set(self.getter(param))
for i, param in enumerate(self.params) for i, param in enumerate(self.params)
] ]
if not _base_values.vban_connected: # slider vars not defined in RT Packet
[
self.slider_vars[i].set(self.getter(param))
for i, param in enumerate(self.slider_params)
if self.index < self.phys_in
]
if not _configuration.themes_enabled: if not _configuration.themes_enabled:
[ [
@@ -193,6 +224,7 @@ class BusConfig(Config):
self.make_row_1() self.make_row_1()
self.builder.grid_configure() self.builder.grid_configure()
self.parent.target.clear_dirty()
self.sync() self.sync()
@property @property

View File

@@ -1,3 +1,4 @@
import logging
from pathlib import Path from pathlib import Path
try: try:
@@ -5,24 +6,36 @@ try:
except ModuleNotFoundError: except ModuleNotFoundError:
import tomli as tomllib import tomli as tomllib
logger = logging.getLogger(__name__)
configuration = {} configuration = {}
config_path = [Path.cwd() / "configs"]
for path in config_path:
if path.is_dir():
filenames = list(path.glob("*.toml"))
configs = {}
for filename in filenames:
name = filename.with_suffix("").stem
try:
with open(filename, "rb") as f:
configs[name] = tomllib.load(f)
except tomllib.TOMLDecodeError:
print(f"Invalid TOML config: configs/{filename.stem}")
for name, cfg in configs.items(): def get_configpath():
print(f"Loaded configuration configs/{name}") configpaths = [
configuration[name] = cfg Path.cwd() / "configs",
Path.home() / ".config" / "vm-compact" / "configs",
Path.home() / "Documents" / "Voicemeeter" / "configs",
]
for configpath in configpaths:
if configpath.exists():
return configpath
if configpath := get_configpath():
filepaths = list(configpath.glob("*.toml"))
if any(f.stem in ("app", "vban") for f in filepaths):
configs = {}
for filepath in filepaths:
filename = filepath.with_suffix("").stem
if filename in ("app", "vban"):
try:
with open(filepath, "rb") as f:
configs[filename] = tomllib.load(f)
logger.info(f"configuration: {filename} loaded into memory")
except tomllib.TOMLDecodeError:
logger.error(f"Invalid TOML config: configs/{filename.stem}")
configuration |= configs
_defaults = { _defaults = {
"configs": { "configs": {
@@ -39,6 +52,7 @@ _defaults = {
"channel": { "channel": {
"width": 80, "width": 80,
"height": 130, "height": 130,
"xpadding": 3,
}, },
"mwscroll_step": { "mwscroll_step": {
"size": 3, "size": 3,
@@ -46,10 +60,16 @@ _defaults = {
"submixes": { "submixes": {
"default": 0, "default": 0,
}, },
"navigation": {"show": True},
} }
if "app" in configuration: if "app" in configuration:
configuration["app"] = _defaults | configuration["app"] for key in _defaults:
if key in configuration["app"]:
configuration["app"][key] = _defaults[key] | configuration["app"][key]
else:
configuration["app"][key] = _defaults[key]
else: else:
configuration["app"] = _defaults configuration["app"] = _defaults
@@ -57,3 +77,22 @@ else:
def get_configuration(key): def get_configuration(key):
if key in configuration: if key in configuration:
return configuration[key] return configuration[key]
def loader(kind_id, target):
configs = {"reset": target.configs["reset"]}
if configpath := get_configpath():
userconfigpath = configpath / kind_id
if userconfigpath.exists():
filepaths = list(userconfigpath.glob("*.toml"))
for filepath in filepaths:
identifier = filepath.with_suffix("").stem
try:
with open(filepath, "rb") as f:
configs[identifier] = tomllib.load(f)
logger.info(f"loader: {identifier} loaded into memory")
except tomllib.TOMLDecodeError:
logger.error(f"Invalid TOML config: configs/{filename.stem}")
target.configs = configs
return target.configs

View File

@@ -32,10 +32,15 @@ class Configurations(metaclass=SingletonMeta):
# bus assigned as current submix # bus assigned as current submix
submixes: int = configuration["submixes"]["default"] submixes: int = configuration["submixes"]["default"]
# width of a single labelframe # width of a single channel labelframe
level_width: int = configuration["channel"]["width"] channel_width: int = configuration["channel"]["width"]
# height of a single labelframe # height of a single channel labelframe
level_height: int = configuration["channel"]["height"] channel_height: int = configuration["channel"]["height"]
# xpadding for a single channel labelframe
channel_xpadding: int = configuration["channel"]["xpadding"]
# do we grid the navigation frame?
navigation_show: bool = configuration["navigation"]["show"]
@property @property
def config(self): def config(self):
@@ -46,7 +51,7 @@ class Configurations(metaclass=SingletonMeta):
@dataclass @dataclass
class BaseValues(metaclass=SingletonMeta): class BaseValues(metaclass=SingletonMeta):
# pause updates after releasing scale # pause updates after releasing scale
run_update: bool = True run_update: bool = False
# are we dragging main window with mouse 1 # are we dragging main window with mouse 1
dragging: bool = False dragging: bool = False
# a vban connection established # a vban connection established

View File

@@ -1,4 +1,2 @@
class VMCompactErrors(Exception): class VMCompactError(Exception):
"""Base classs for VMCompact Errors""" """Exception raised when general errors occur"""
pass

View File

@@ -1,5 +1,4 @@
import tkinter as tk import tkinter as tk
from math import log
from tkinter import ttk from tkinter import ttk
from . import builders from . import builders
@@ -42,11 +41,13 @@ class GainLayer(ttk.LabelFrame):
return "gainlayer" return "gainlayer"
def getter(self, param): def getter(self, param):
if hasattr(self.target, param): try:
return getattr(self.target, param) return getattr(self.target, param)
except AttributeError as e:
self.logger(f"{type(e).__name__}: {e}")
def setter(self, param, value): def setter(self, param, value):
if hasattr(self.target, param): if param in dir(self.target): # avoid calling getattr (with hasattr)
setattr(self.target, param, value) setattr(self.target, param, value)
def reset_gain(self, *args): def reset_gain(self, *args):
@@ -57,8 +58,9 @@ class GainLayer(ttk.LabelFrame):
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()) val = round(self.gain.get(), 1)
self.gainlabel.set(round(self.gain.get(), 1)) self.setter("gain", val)
self.gainlabel.set(val)
def scale_press(self, *args): def scale_press(self, *args):
self.after(1, self.remove_events) self.after(1, self.remove_events)
@@ -76,6 +78,14 @@ class GainLayer(ttk.LabelFrame):
self.parent.target.event.add("ldirty") self.parent.target.event.add("ldirty")
self.after(500, self.resume_updates) self.after(500, self.resume_updates)
def pause_updates(self, func, *args):
"""function wrapper, adds a 50ms delay on updates"""
_base_values.run_update = False
func(*args)
self.after(50, self.resume_updates)
def resume_updates(self): def resume_updates(self):
_base_values.run_update = True _base_values.run_update = True
@@ -157,12 +167,14 @@ class GainLayer(ttk.LabelFrame):
self.level.set( self.level.set(
( (
0 0
if self.parent.target.strip[self.index].mute or not self.on.get() if self.parent.parent.strip_frame.strips[self.index].mute.get()
else 100 + val - 18 + self.gain.get() or not self.on.get()
else 72 + val - 12 + self.gain.get()
) )
) )
def grid_configure(self): def grid_configure(self):
self.grid(padx=_configuration.channel_xpadding, sticky=(tk.N, tk.S))
[ [
child.grid_configure(padx=1, pady=1, sticky=(tk.N, tk.S, tk.W, tk.E)) child.grid_configure(padx=1, pady=1, sticky=(tk.N, tk.S, tk.W, tk.E))
for child in self.winfo_children() for child in self.winfo_children()
@@ -250,11 +262,11 @@ class SubMixFrame(ttk.Frame):
def grid_configure(self): def grid_configure(self):
[ [
self.columnconfigure(i, minsize=_configuration.level_width) self.columnconfigure(i, minsize=_configuration.channel_width)
for i, _ in enumerate(self.labelframes) for i, _ in enumerate(self.labelframes)
] ]
[ [
self.rowconfigure(0, minsize=_configuration.level_height) self.rowconfigure(0, minsize=_configuration.channel_height)
for i, _ in enumerate(self.labelframes) for i, _ in enumerate(self.labelframes)
] ]

View File

@@ -1,24 +1,31 @@
import logging
import tkinter as tk import tkinter as tk
import webbrowser import webbrowser
from functools import partial from functools import partial
from tkinter import messagebox, ttk from tkinter import messagebox
import sv_ttk import sv_ttk
import vban_cmd import vban_cmd
from vban_cmd.error import VBANCMDConnectionError
from .data import _base_values, _configuration, get_configuration, kind_get from .data import _base_values, _configuration, get_configuration, kind_get
logger = logging.getLogger(__name__)
class Menus(tk.Menu): class Menus(tk.Menu):
def __init__(self, parent, vmr): def __init__(self, parent, vmr):
super().__init__() super().__init__()
self.parent = parent self.parent = parent
self.vmr = vmr self.vmr = vmr
self.logger = logger.getChild(self.__class__.__name__)
self.vban_config = get_configuration("vban") self.vban_config = get_configuration("vban")
self.app_config = get_configuration("app") self.app_config = get_configuration("app")
self._is_topmost = tk.BooleanVar() self._is_topmost = tk.BooleanVar()
self._lock = tk.BooleanVar() self._lock = tk.BooleanVar()
self._unlock = tk.BooleanVar() self._unlock = tk.BooleanVar()
self._navigation_show = tk.BooleanVar(value=_configuration.navigation_show)
self._navigation_hide = tk.BooleanVar(value=not _configuration.navigation_show)
self._selected_bus = list(tk.BooleanVar() for _ in range(8)) self._selected_bus = list(tk.BooleanVar() for _ in range(8))
# voicemeeter menu # voicemeeter menu
@@ -78,14 +85,14 @@ class Menus(tk.Menu):
self.menu_configs_load = tk.Menu(self.menu_configs, tearoff=0) self.menu_configs_load = tk.Menu(self.menu_configs, tearoff=0)
self.menu_configs.add_cascade(menu=self.menu_configs_load, label="Load config") self.menu_configs.add_cascade(menu=self.menu_configs_load, label="Load config")
self.config_defaults = {"reset"} self.config_defaults = {"reset"}
if len(self.target.configs) > len(self.config_defaults) and all( if len(self.parent.userconfigs) > len(self.config_defaults) and all(
key in self.target.configs for key in self.config_defaults key in self.parent.userconfigs for key in self.config_defaults
): ):
[ [
self.menu_configs_load.add_command( self.menu_configs_load.add_command(
label=profile, command=partial(self.load_profile, profile) label=profile, command=partial(self.load_profile, profile)
) )
for profile in self.target.configs.keys() for profile in self.parent.userconfigs.keys()
if profile not in self.config_defaults if profile not in self.config_defaults
] ]
else: else:
@@ -149,6 +156,23 @@ class Menus(tk.Menu):
) )
if not _configuration.themes_enabled: if not _configuration.themes_enabled:
self.menu_layout.entryconfig(2, state="disabled") self.menu_layout.entryconfig(2, state="disabled")
# layout/navigation
self.menu_navigation = tk.Menu(self.menu_layout, tearoff=0)
self.menu_layout.add_cascade(menu=self.menu_navigation, label="Navigation")
self.menu_navigation.add_checkbutton(
label="show",
onvalue=1,
offvalue=0,
variable=self._navigation_show,
command=partial(self.toggle_navigation, "show"),
)
self.menu_navigation.add_checkbutton(
label="hide",
onvalue=1,
offvalue=0,
variable=self._navigation_hide,
command=partial(self.toggle_navigation, "hide"),
)
# vban connect menu # vban connect menu
self.menu_vban = tk.Menu(self, tearoff=0) self.menu_vban = tk.Menu(self, tearoff=0)
@@ -200,7 +224,10 @@ class Menus(tk.Menu):
] ]
def action_invoke_voicemeeter(self, cmd): def action_invoke_voicemeeter(self, cmd):
getattr(self.target.command, cmd)() if fn := getattr(self.target.command, cmd):
fn()
if cmd == "shutdown":
self.parent.destroy()
def action_set_voicemeeter(self, cmd, val=True): def action_set_voicemeeter(self, cmd, val=True):
if cmd == "lock": if cmd == "lock":
@@ -208,15 +235,24 @@ class Menus(tk.Menu):
self._unlock.set(not self._lock.get()) self._unlock.set(not self._lock.get())
setattr(self.target.command, cmd, val) setattr(self.target.command, cmd, val)
def load_custom_profile(self, profile):
self.logger.info(f"loading user profile {profile}")
self.target.apply(profile)
def load_profile(self, profile): def load_profile(self, profile):
self.logger.info(f"loading user profile {profile}")
self.target.apply_config(profile) self.target.apply_config(profile)
def load_defaults(self): def load_defaults(self):
resp = messagebox.askyesno( msg = (
message="Are you sure you want to Reset values to defaults?\nPhysical strips B1, Virtual strips A1\nMono, Solo, Mute, EQ all OFF" "Are you sure you want to Reset values to defaults?",
"Physical strips B1, Virtual strips A1",
"Mono, Solo, Mute, EQ all OFF",
"Gain sliders for Strip/Bus at 0.0",
) )
resp = messagebox.askyesno(message="\n".join(msg))
if resp: if resp:
self.target.apply_config("reset") self.load_profile("reset")
def always_on_top(self): def always_on_top(self):
self.parent.attributes("-topmost", self._is_topmost.get()) self.parent.attributes("-topmost", self._is_topmost.get())
@@ -238,6 +274,7 @@ class Menus(tk.Menu):
self.parent.nav_frame.show_submix() self.parent.nav_frame.show_submix()
for j, var in enumerate(self._selected_bus): for j, var in enumerate(self._selected_bus):
var.set(i == j) var.set(i == j)
self.parent.subject.notify("submix")
def load_theme(self, theme): def load_theme(self, theme):
sv_ttk.set_theme(theme) sv_ttk.set_theme(theme)
@@ -267,14 +304,19 @@ class Menus(tk.Menu):
for menu in self.menu_layout.winfo_children() for menu in self.menu_layout.winfo_children()
if isinstance(menu, tk.Menu) if isinstance(menu, tk.Menu)
] ]
self.logger.info(
f"Finished loading theme Sunvalley {sv_ttk.get_theme().capitalize()} theme"
)
def vban_connect(self, i): def menu_teardown(self, i):
# remove config load menus # remove config load menus
[ if len(self.parent.userconfigs) > len(self.config_defaults):
self.menu_configs_load.delete(key) for profile in self.parent.userconfigs:
for key in self.vmr.configs.keys() if profile not in self.config_defaults:
if key not in self.config_defaults try:
] self.menu_configs_load.delete(profile)
except tk._tkinter.tclError as e:
self.logger.warning(f"{type(e).__name__}: {e}")
[ [
self.menu_vban.entryconfig(j, state="disabled") self.menu_vban.entryconfig(j, state="disabled")
@@ -282,13 +324,51 @@ class Menus(tk.Menu):
if j != i if j != i
] ]
def menu_setup(self):
if len(self.parent.userconfigs) > len(self.config_defaults):
for profile in self.parent.userconfigs:
if profile not in self.config_defaults:
self.menu_configs_load.add_command(
label=profile, command=partial(self.load_profile, profile)
)
self.menu_configs.entryconfig(0, state="normal")
else:
self.menu_configs.entryconfig(0, state="disabled")
def toggle_navigation(self, cmd=None):
if cmd == "show":
self.logger.debug("show navframe")
self.parent.nav_frame.grid()
self._navigation_show.set(True)
self._navigation_hide.set(not self._navigation_show.get())
else:
self.logger.debug("hide navframe")
self.parent.nav_frame.grid_remove()
self._navigation_hide.set(True)
self._navigation_show.set(not self._navigation_hide.get())
def vban_connect(self, i):
opts = {} opts = {}
opts |= self.vban_config[f"connection-{i+1}"] opts |= self.vban_config[f"connection-{i+1}"]
kind_id = opts.pop("kind") kind_id = opts.pop("kind")
self.vban = vban_cmd.api(kind_id, **opts) self.vban = vban_cmd.api(kind_id, **opts)
# login to vban interface # login to vban interface
self.vban.login() try:
self.vban.event.add("ldirty") self.logger.info(f"Attempting vban connection to {opts.get('ip')}")
self.vban.login()
except VBANCMDConnectionError as e:
self.vban.logout()
msg = (
f"Timeout attempting to establish connection to {opts.get('ip')}",
f"Please check your connection settings",
)
messagebox.showerror("Connection Error", "\n".join(msg))
msg = (str(e), f"resuming local connection")
self.logger.error(", ".join(msg))
self.after(1, self.enable_vban_menus)
return
self.menu_teardown(i)
self.vban.event.add(["pdirty", "ldirty"])
# destroy the current App frames # destroy the current App frames
self.parent._destroy_top_level_frames() self.parent._destroy_top_level_frames()
_base_values.vban_connected = True _base_values.vban_connected = True
@@ -303,27 +383,15 @@ class Menus(tk.Menu):
self.menu_layout.entryconfig( self.menu_layout.entryconfig(
0, state=f"{'normal' if kind.name == 'potato' else 'disabled'}" 0, state=f"{'normal' if kind.name == 'potato' else 'disabled'}"
) )
# rebuild config load menus # ensure the configs are reloaded into memory
if len(self.target.configs) > len(self.config_defaults) and all( if "config" in self.parent.target.__dict__:
key in self.target.configs for key in self.config_defaults del self.parent.target.__dict__["config"]
): if "userconfigs" in self.parent.__dict__:
[ del self.parent.__dict__["userconfigs"]
self.menu_configs_load.add_command( self.menu_setup()
label=profile, command=partial(self.load_profile, profile)
)
for profile in self.target.configs.keys()
if profile not in self.config_defaults
]
else:
self.menu_configs.entryconfig(0, state="disabled")
def vban_disconnect(self, i): def vban_disconnect(self, i):
# remove config load menus self.menu_teardown(i)
[
self.menu_configs_load.delete(key)
for key in self.vban.configs.keys()
if key not in self.config_defaults
]
# destroy the current App frames # destroy the current App frames
self.parent._destroy_top_level_frames() self.parent._destroy_top_level_frames()
@@ -333,26 +401,19 @@ class Menus(tk.Menu):
self.vban.logout() self.vban.logout()
# build new app frames according to a kind # build new app frames according to a kind
kind = kind_get(self.vmr.type) kind = kind_get(self.vmr.type)
self.parent.build_app(kind, None) self.parent.build_app(kind)
target_menu = getattr(self, f"menu_vban_{i+1}") target_menu = getattr(self, f"menu_vban_{i+1}")
target_menu.entryconfig(0, state="normal") target_menu.entryconfig(0, state="normal")
target_menu.entryconfig(1, state="disabled") target_menu.entryconfig(1, state="disabled")
self.menu_layout.entryconfig( self.menu_layout.entryconfig(
0, state=f"{'normal' if kind.name == 'potato' else 'disabled'}" 0, state=f"{'normal' if kind.name == 'potato' else 'disabled'}"
) )
# rebuild config load menus # ensure the configs are reloaded into memory
if len(self.target.configs) > len(self.config_defaults) and all( if "config" in self.parent.target.__dict__:
key in self.target.configs for key in self.config_defaults del self.parent.target.__dict__["config"]
): if "userconfigs" in self.parent.__dict__:
[ del self.parent.__dict__["userconfigs"]
self.menu_configs_load.add_command( self.menu_setup()
label=profile, command=partial(self.load_profile, profile)
)
for profile in self.target.configs.keys()
if profile not in self.config_defaults
]
else:
self.menu_configs.entryconfig(0, state="disabled")
self.after(15000, self.enable_vban_menus) self.after(15000, self.enable_vban_menus)

View File

@@ -1,3 +1,4 @@
import logging
import tkinter as tk import tkinter as tk
from tkinter import ttk from tkinter import ttk
@@ -5,12 +6,17 @@ from . import builders
from .data import _configuration from .data import _configuration
from .gainlayer import SubMixFrame from .gainlayer import SubMixFrame
logger = logging.getLogger(__name__)
class Navigation(ttk.Frame): class Navigation(ttk.Frame):
def __init__(self, parent): def __init__(self, parent):
super().__init__(parent) super().__init__(parent)
self.parent = parent self.parent = parent
self.logger = logger.getChild(self.__class__.__name__)
self.grid(row=0, column=3, padx=(0, 2), pady=(5, 5), sticky=(tk.W, tk.E)) self.grid(row=0, column=3, padx=(0, 2), pady=(5, 5), sticky=(tk.W, tk.E))
if not _configuration.navigation_show:
self.grid_remove()
self.styletable = self.parent.styletable self.styletable = self.parent.styletable
self.builder = builders.NavigationFrameBuilder(self) self.builder = builders.NavigationFrameBuilder(self)
@@ -26,6 +32,9 @@ class Navigation(ttk.Frame):
def show_submix(self): def show_submix(self):
if self.submix.get(): if self.submix.get():
self.parent.submix_frame = SubMixFrame(self.parent) self.parent.submix_frame = SubMixFrame(self.parent)
self.logger.info(
f"Finished building submixframe for submix {_configuration.submixes}"
)
else: else:
if _configuration.extends_horizontal: if _configuration.extends_horizontal:
self.parent.submix_frame.teardown() self.parent.submix_frame.teardown()
@@ -39,6 +48,9 @@ class Navigation(ttk.Frame):
self.parent.bus_frame.grid() self.parent.bus_frame.grid()
else: else:
self.parent.rowconfigure(2, weight=0, minsize=0) self.parent.rowconfigure(2, weight=0, minsize=0)
self.logger.info(
f"Finished tearing down submixframe for submix {_configuration.submixes}"
)
if not _configuration.themes_enabled: if not _configuration.themes_enabled:
self.styletable.configure( self.styletable.configure(