fix: make Tab.name always a property
This commit is contained in:
parent
48a5b3e769
commit
0db73f722f
2 changed files with 10 additions and 4 deletions
|
@ -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'
|
||||
|
@ -140,6 +140,12 @@ class Tab:
|
|||
# and use them in on_input
|
||||
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()
|
||||
|
|
|
@ -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] = []
|
||||
|
|
Loading…
Reference in a new issue