show messagebox on connection timeout

patch bump
This commit is contained in:
onyx-and-iris 2022-09-23 20:23:55 +01:00
parent 2c290e2632
commit 6de79977cc
3 changed files with 38 additions and 59 deletions

29
poetry.lock generated
View File

@ -84,7 +84,7 @@ python-versions = ">=3.7"
[[package]] [[package]]
name = "vban-cmd" name = "vban-cmd"
version = "1.4.2" version = "1.4.3"
description = "Python interface for the VBAN RT Packet Service (Sendtext)" description = "Python interface for the VBAN RT Packet Service (Sendtext)"
category = "main" category = "main"
optional = false optional = false
@ -107,31 +107,16 @@ tomli = {version = ">=2.0.1,<3.0.0", markers = "python_version < \"3.11\""}
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = "^3.10" python-versions = "^3.10"
content-hash = "738f40473a635574dc00427d128af1c3bf45f4290aca9b4d8ae78b6992a486c7" content-hash = "df755b86361b6c58978bcdc7875d8d8e5f4d554d13b189823347d64994ba1507"
[metadata.files] [metadata.files]
black = [] black = []
click = [ click = []
{file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, colorama = []
{file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, mypy-extensions = []
]
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 = [] pathspec = []
platformdirs = [ 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 = [] sv-ttk = []
tomli = [ 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 = [] vban-cmd = []
voicemeeter-api = [] voicemeeter-api = []

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "voicemeeter-compact" name = "voicemeeter-compact"
version = "1.5.1" version = "1.5.2"
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"
@ -17,7 +17,7 @@ python = "^3.10"
sv-ttk = "^2.0" sv-ttk = "^2.0"
tomli = { version = "^2.0.1", python = "<3.11" } tomli = { version = "^2.0.1", python = "<3.11" }
voicemeeter-api = "^0.7.0" voicemeeter-api = "^0.7.0"
vban-cmd = "^1.4.2" vban-cmd = "^1.4.3"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
black = {version = "^22.6.0", allow-prereleases = true} black = {version = "^22.6.0", allow-prereleases = true}

View File

@ -268,11 +268,11 @@ class Menus(tk.Menu):
if isinstance(menu, tk.Menu) if isinstance(menu, tk.Menu)
] ]
def vban_connect(self, i): def menu_teardown(self, i):
# remove config load menus # remove config load menus
[ [
self.menu_configs_load.delete(key) self.menu_configs_load.delete(key)
for key in self.vmr.configs.keys() for key in self.target.configs.keys()
if key not in self.config_defaults if key not in self.config_defaults
] ]
@ -282,12 +282,35 @@ class Menus(tk.Menu):
if j != i if j != i
] ]
def menu_setup(self):
if len(self.target.configs) > len(self.config_defaults) and all(
key in self.target.configs for key in self.config_defaults
):
[
self.menu_configs_load.add_command(
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_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
try:
self.vban.login() self.vban.login()
except TimeoutError as e:
messagebox.showerror(
"Connection Error", f"Unable to establish connection with {opts['ip']}"
)
self.after(1, self.enable_vban_menus)
return
self.menu_teardown(i)
self.vban.event.add("ldirty") self.vban.event.add("ldirty")
# destroy the current App frames # destroy the current App frames
self.parent._destroy_top_level_frames() self.parent._destroy_top_level_frames()
@ -303,27 +326,10 @@ 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 self.menu_setup()
if len(self.target.configs) > len(self.config_defaults) and all(
key in self.target.configs for key in self.config_defaults
):
[
self.menu_configs_load.add_command(
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()
@ -340,19 +346,7 @@ 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 self.menu_setup()
if len(self.target.configs) > len(self.config_defaults) and all(
key in self.target.configs for key in self.config_defaults
):
[
self.menu_configs_load.add_command(
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)