[arch] fixes -> not displaying installed AUR packages when AUR support is disabled | downloading AUR index during the initialization process when AUR support is disabled

This commit is contained in:
Vinicius Moreira
2021-01-12 16:06:34 -03:00
parent d912eb3aef
commit af6367b0ab
4 changed files with 83 additions and 49 deletions

View File

@@ -33,18 +33,6 @@ class SpacerComponent(ViewComponent):
super(SpacerComponent, self).__init__(id_=None)
class PanelComponent(ViewComponent):
def __init__(self, components: List[ViewComponent], id_: str = None):
super(PanelComponent, self).__init__(id_=id_)
self.components = components
self.component_map = {c.id: c for c in components if c.id is not None} if components else None
def get_component(self, id_: str) -> ViewComponent:
if self.component_map:
return self.component_map.get(id_)
class InputViewComponent(ViewComponent):
"""
Represents an component which needs a user interaction to provide its value
@@ -96,6 +84,7 @@ class SingleSelectComponent(InputViewComponent):
self.label = label
self.options = options
self.value = default_option
self.init_value = default_option
self.max_per_line = max_per_line
self.tooltip = tooltip
self.max_width = max_width
@@ -105,6 +94,9 @@ class SingleSelectComponent(InputViewComponent):
if self.value:
return self.value.value
def changed(self) -> bool:
return self.init_value != self.value
class MultipleSelectComponent(InputViewComponent):
@@ -214,10 +206,18 @@ class FormComponent(ViewComponent):
self.components = components
self.component_map = {c.id: c for c in components if c.id} if components else None
def get_component(self, id_: str) -> ViewComponent:
def get_component(self, id_: str) -> Optional[ViewComponent]:
if self.component_map:
return self.component_map.get(id_)
def get_single_select_component(self, id_: str) -> Optional[SingleSelectComponent]:
comp = self.get_component(id_)
if comp:
if not isinstance(comp, SingleSelectComponent):
raise Exception("'{}' is not a {}".format(id_, SingleSelectComponent.__class__.__name__))
return comp
class FileChooserComponent(ViewComponent):
@@ -281,3 +281,23 @@ class RangeInputComponent(InputViewComponent):
self.step = step_value
self.value = value
self.max_width = max_width
class PanelComponent(ViewComponent):
def __init__(self, components: List[ViewComponent], id_: str = None):
super(PanelComponent, self).__init__(id_=id_)
self.components = components
self.component_map = {c.id: c for c in components if c.id is not None} if components else None
def get_component(self, id_: str) -> Optional[ViewComponent]:
if self.component_map:
return self.component_map.get(id_)
def get_form_component(self, id_: str) -> Optional[FormComponent]:
comp = self.get_component(id_)
if comp:
if not isinstance(comp, FormComponent):
raise Exception("'{}' is not a {}".format(id_, FormComponent.__class__.__name__))
return comp