[arch] feature -> AUR: allowing to edit the PKGBUILD file of a package to be installed/upgraded/downgraded

This commit is contained in:
Vinicius Moreira
2020-08-16 12:39:20 -03:00
parent ef6909be38
commit 9c1ffbd356
41 changed files with 811 additions and 205 deletions

View File

@@ -0,0 +1,18 @@
from typing import List, Tuple, Optional
from bauh.api.abstract.view import SelectViewType, InputOption, SingleSelectComponent
def new_select(label: str, tip: str, id_: str, opts: List[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]
return SingleSelectComponent(label=label,
tooltip=tip,
options=inp_opts,
default_option=def_opt[0] if def_opt else inp_opts[0],
max_per_line=len(inp_opts),
max_width=max_width,
type_=type_,
id_=id_,
capitalize_label=capitalize_label)