mirror of https://gitlab.com/pamhyr/pamhyr2
Disabled profiles: the reach split is impossible on a disabled profile to avoid any problem
parent
f08d4b1a37
commit
8978cc3482
|
|
@ -64,6 +64,7 @@ class SelectProfileDialog(PamhyrDialog):
|
||||||
|
|
||||||
self._reach = reach
|
self._reach = reach
|
||||||
self._profile = None
|
self._profile = None
|
||||||
|
self._profiles = self._reach.reach.enabled_profiles
|
||||||
|
|
||||||
self.setup_combobox()
|
self.setup_combobox()
|
||||||
|
|
||||||
|
|
@ -73,17 +74,19 @@ class SelectProfileDialog(PamhyrDialog):
|
||||||
list(
|
list(
|
||||||
map(
|
map(
|
||||||
lambda p: p.display_name(),
|
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):
|
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(
|
self._profile = self._profiles[index]
|
||||||
filter(
|
|
||||||
lambda p: p.display_name() == profile,
|
|
||||||
self._reach.reach.profiles
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
super(SelectProfileDialog, self).accept()
|
super(SelectProfileDialog, self).accept()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue