From 8978cc348245210da697403fa1904504950e7ec8 Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Mon, 24 Aug 2026 15:37:03 +0200 Subject: [PATCH] Disabled profiles: the reach split is impossible on a disabled profile to avoid any problem --- src/View/Network/ProfileDialog.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/View/Network/ProfileDialog.py b/src/View/Network/ProfileDialog.py index 28caa99d..446327e7 100644 --- a/src/View/Network/ProfileDialog.py +++ b/src/View/Network/ProfileDialog.py @@ -64,6 +64,7 @@ class SelectProfileDialog(PamhyrDialog): self._reach = reach self._profile = None + self._profiles = self._reach.reach.enabled_profiles self.setup_combobox() @@ -73,17 +74,19 @@ class SelectProfileDialog(PamhyrDialog): list( map( lambda p: p.display_name(), - self._reach.reach.profiles))) + self._profiles))) + + if len(self._profiles) == 0: + self.find(QDialogButtonBox, "buttonBox")\ + .button(QDialogButtonBox.Ok)\ + .setEnabled(False) def accept(self): - profile = self.get_combobox_text("comboBox") + index = self.find(QComboBox, "comboBox").currentIndex() + if not 0 <= index < len(self._profiles): + return - self._profile = next( - filter( - lambda p: p.display_name() == profile, - self._reach.reach.profiles - ) - ) + self._profile = self._profiles[index] super(SelectProfileDialog, self).accept()