quick_frontend, tui: fix name conflict with show_resources

This commit is contained in:
Goffi 2023-12-01 18:23:04 +01:00
commit 516fa2e673
2 changed files with 19 additions and 6 deletions

View file

@ -84,7 +84,7 @@ class ProfileContactList(object):
# options
self.show_disconnected = False
self._show_empty_groups = True
self.show_resources = False
self._show_resources = False
self.show_status = False
# do we show entities with notifications?
# if True, entities will be show even if they normally would not
@ -765,11 +765,16 @@ class ProfileContactList(object):
self._show_empty_groups = show
self.update(type_=C.UPDATE_STRUCTURE, profile=self.profile)
def show_resources(self, show):
@property
def show_resources(self) -> bool:
return self._show_resources
@show_resources.setter
def show_resources(self, show: bool) -> None:
assert isinstance(show, bool)
if self.show_resources == show:
if self._show_resources == show:
return
self.show_resources = show
self._show_resources = show
self.update(type_=C.UPDATE_STRUCTURE, profile=self.profile)
def plug(self):
@ -1068,7 +1073,7 @@ class QuickContactList(QuickWidget):
# True or False mean override these values for all profiles
self.show_disconnected = None # TODO
self._show_empty_groups = None # TODO
self.show_resources = None # TODO
self._show_resources = None # TODO
self.show_status = None # TODO
def post_init(self):
@ -1083,6 +1088,14 @@ class QuickContactList(QuickWidget):
def items(self):
return handler.items
@property
def show_resources(self) -> bool|None:
return self._show_resources
@show_resources.setter
def show_resources(self, show: bool|None) -> None:
self._show_resources = show
@property
def items_sorted(self):
return handler.items_sorted

View file

@ -92,7 +92,7 @@ class ContactList(LiberviaTUIWidget, QuickContactList):
profile_key=self.profile,
)
elif key == a_key["RESOURCES_HIDE"]: # user wants to (un)hide contacts resources
self.contact_list.show_resources(not self.contact_list.show_resources)
self.contact_list.show_resources = not self.contact_list.show_resources
self.update()
return super(ContactList, self).keypress(size, key)