[backup] improvement: remove_method option

This commit is contained in:
Vinicius Moreira
2022-03-29 19:01:31 -03:00
parent da8a4e6547
commit a904c73b2d
15 changed files with 111 additions and 25 deletions

View File

@@ -1,13 +1,12 @@
from typing import List, Tuple, Optional
from typing import Tuple, Optional, Iterable
from bauh.api.abstract.view import SelectViewType, InputOption, SingleSelectComponent
SIZE_UNITS = ((1, 'B'), (1024, 'Kb'), (1048576, 'Mb'), (1073741824, 'Gb'),
(1099511627776, 'Tb'), (1125899906842624, 'Pb'))
def new_select(label: str, tip: str, id_: str, opts: List[Tuple[Optional[str], object, Optional[str]]], value: object, max_width: int,
def new_select(label: str, tip: Optional[str], id_: str, opts: Iterable[Tuple[Optional[str], object, Optional[str]]], value: object, max_width: int,
type_: SelectViewType = SelectViewType.RADIO, capitalize_label: bool = True):
inp_opts = [InputOption(label=o[0].capitalize(), value=o[1], tooltip=o[2]) for o in opts]
def_opt = [o for o in inp_opts if o.value == value]