summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-03-25 22:24:45 +0100
committermathieui <mathieui@mathieui.net>2021-04-02 17:44:36 +0200
commit0db73f722f875a1c9ef439d78c67971a244665f1 (patch)
tree75971557a2e0536bf372ca7081f94de3e5038e36
parent48a5b3e769783944106a569ebbd25ad82da1a4bf (diff)
downloadpoezio-0db73f722f875a1c9ef439d78c67971a244665f1.tar.gz
poezio-0db73f722f875a1c9ef439d78c67971a244665f1.tar.bz2
poezio-0db73f722f875a1c9ef439d78c67971a244665f1.tar.xz
poezio-0db73f722f875a1c9ef439d78c67971a244665f1.zip
fix: make Tab.name always a property
-rw-r--r--poezio/tabs/basetabs.py12
-rw-r--r--poezio/tabs/bookmarkstab.py2
2 files changed, 10 insertions, 4 deletions
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index 372f2349..0d860adb 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -128,8 +128,8 @@ class Tab:
def __init__(self, core: Core):
self.core = core
self.nb = 0
- if not hasattr(self, 'name'):
- self.name = self.__class__.__name__
+ if not hasattr(self, '_name'):
+ self._name = self.__class__.__name__
self.input = None
self.closed = False
self._state = 'normal'
@@ -141,6 +141,12 @@ class Tab:
self.commands = {} # and their own commands
@property
+ def name(self) -> str:
+ if hasattr(self, '_name'):
+ return self._name
+ return ''
+
+ @property
def size(self) -> SizeManager:
return self.core.size
@@ -510,7 +516,7 @@ class ChatTab(Tab):
self._jid = jid
#: Is the tab currently requesting MAM data?
self.query_status = False
- self._name: Optional[str] = jid.full
+ self._name = jid.full
self.text_win = windows.TextWin()
self.directed_presence = None
self._text_buffer = TextBuffer()
diff --git a/poezio/tabs/bookmarkstab.py b/poezio/tabs/bookmarkstab.py
index 4b7f708b..4f4833fc 100644
--- a/poezio/tabs/bookmarkstab.py
+++ b/poezio/tabs/bookmarkstab.py
@@ -29,7 +29,7 @@ class BookmarksTab(Tab):
def __init__(self, core, bookmarks: BookmarkList):
Tab.__init__(self, core)
- self.name = "Bookmarks"
+ self._name = "Bookmarks"
self.bookmarks = bookmarks
self.new_bookmarks: List[Bookmark] = []
self.removed_bookmarks: List[Bookmark] = []