changeset 4170:b47f21f2b8fa

quick_frontend, tui: fix name conflict with `show_resources`
author Goffi <goffi@goffi.org>
date Fri, 01 Dec 2023 18:23:04 +0100
parents e92c32014024
children da7d360a87be
files libervia/frontends/quick_frontend/quick_contact_list.py libervia/tui/contact_list.py
diffstat 2 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/frontends/quick_frontend/quick_contact_list.py	Fri Dec 01 18:22:26 2023 +0100
+++ b/libervia/frontends/quick_frontend/quick_contact_list.py	Fri Dec 01 18:23:04 2023 +0100
@@ -84,7 +84,7 @@
         # 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 @@
         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 @@
         # 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):
@@ -1084,6 +1089,14 @@
         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
 
--- a/libervia/tui/contact_list.py	Fri Dec 01 18:22:26 2023 +0100
+++ b/libervia/tui/contact_list.py	Fri Dec 01 18:23:04 2023 +0100
@@ -92,7 +92,7 @@
                 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)