Fix subvol selection (#1277)
* Fix subvolume selection * Update Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
This commit is contained in:
parent
0601956b5b
commit
5171458796
|
|
@ -227,7 +227,7 @@ class GeneralMenu:
|
||||||
""" will be called before each action in the menu """
|
""" will be called before each action in the menu """
|
||||||
return
|
return
|
||||||
|
|
||||||
def post_callback(self, selector_name :str, value :Any):
|
def post_callback(self, selection_name: str = None, value: Any = None):
|
||||||
""" will be called after each action in the menu """
|
""" will be called after each action in the menu """
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
@ -327,12 +327,12 @@ class GeneralMenu:
|
||||||
break
|
break
|
||||||
cursor_pos += 1
|
cursor_pos += 1
|
||||||
|
|
||||||
value = value.strip()
|
value = value.strip()
|
||||||
|
|
||||||
# if this calls returns false, we exit the menu
|
# if this calls returns false, we exit the menu
|
||||||
# we allow for an callback for special processing on realeasing control
|
# we allow for an callback for special processing on realeasing control
|
||||||
if not self._process_selection(value):
|
if not self._process_selection(value):
|
||||||
break
|
break
|
||||||
|
|
||||||
if not self.is_context_mgr:
|
if not self.is_context_mgr:
|
||||||
self.__exit__()
|
self.__exit__()
|
||||||
|
|
|
||||||
|
|
@ -80,24 +80,33 @@ class SubvolumeMenu(GeneralMenu):
|
||||||
super().__init__(data_store=self.ds)
|
super().__init__(data_store=self.ds)
|
||||||
|
|
||||||
def _setup_selection_menu_options(self):
|
def _setup_selection_menu_options(self):
|
||||||
# [str(_('Add')),str(_('Copy')),str(_('Edit')),str(_('Delete'))]
|
self._menu_options['name'] = Selector(
|
||||||
self._menu_options['name'] = Selector(str(_('Subvolume name ')),
|
str(_('Subvolume name ')),
|
||||||
self._select_subvolume_name if not self.action or self.action in (str(_('Add')),str(_('Copy'))) else None,
|
self._select_subvolume_name if not self.action or self.action in (str(_('Add')), str(_('Copy'))) else None,
|
||||||
mandatory=True,
|
mandatory=True,
|
||||||
enabled=True)
|
enabled=True)
|
||||||
self._menu_options['mountpoint'] = Selector(str(_('Subvolume mountpoint')),
|
|
||||||
|
self._menu_options['mountpoint'] = Selector(
|
||||||
|
str(_('Subvolume mountpoint')),
|
||||||
self._select_subvolume_mount_point if not self.action or self.action in (str(_('Add')),str(_('Edit'))) else None,
|
self._select_subvolume_mount_point if not self.action or self.action in (str(_('Add')),str(_('Edit'))) else None,
|
||||||
enabled=True)
|
enabled=True)
|
||||||
self._menu_options['options'] = Selector(str(_('Subvolume options')),
|
|
||||||
|
self._menu_options['options'] = Selector(
|
||||||
|
str(_('Subvolume options')),
|
||||||
self._select_subvolume_options if not self.action or self.action in (str(_('Add')),str(_('Edit'))) else None,
|
self._select_subvolume_options if not self.action or self.action in (str(_('Add')),str(_('Edit'))) else None,
|
||||||
enabled=True)
|
enabled=True)
|
||||||
self._menu_options['save'] = Selector(str(_('Save')),
|
|
||||||
exec_func=lambda n,v:True,
|
self._menu_options['save'] = Selector(
|
||||||
enabled=True)
|
str(_('Save')),
|
||||||
self._menu_options['cancel'] = Selector(str(_('Cancel')),
|
exec_func=lambda n,v:True,
|
||||||
# func = lambda pre:True,
|
enabled=True)
|
||||||
exec_func=lambda n,v:self.fast_exit(n),
|
|
||||||
enabled=True)
|
self._menu_options['cancel'] = Selector(
|
||||||
|
str(_('Cancel')),
|
||||||
|
# func = lambda pre:True,
|
||||||
|
exec_func=lambda n,v:self.fast_exit(n),
|
||||||
|
enabled=True)
|
||||||
|
|
||||||
self.cancel_action = 'cancel'
|
self.cancel_action = 'cancel'
|
||||||
self.save_action = 'save'
|
self.save_action = 'save'
|
||||||
self.bottom_list = [self.save_action,self.cancel_action]
|
self.bottom_list = [self.save_action,self.cancel_action]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue