Disabled profiles: the reach split is impossible on a disabled profile to avoid any problem

mesh_tab
Dylan Jeannin 2026-08-24 15:37:03 +02:00
parent f08d4b1a37
commit 8978cc3482
1 changed files with 11 additions and 8 deletions

View File

@ -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()