diff options
author | mathieui <mathieui@mathieui.net> | 2016-06-30 23:57:12 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2016-06-30 23:57:12 +0200 |
commit | 8383f773413cee8529ad4fdc05f092286d6dd377 (patch) | |
tree | 1604936f9b10aa84b929e22c40751b020b8b348d /poezio/tabs | |
parent | 8f7be37a700aa78f1906e155f79356fcd7e4b260 (diff) | |
download | poezio-8383f773413cee8529ad4fdc05f092286d6dd377.tar.gz poezio-8383f773413cee8529ad4fdc05f092286d6dd377.tar.bz2 poezio-8383f773413cee8529ad4fdc05f092286d6dd377.tar.xz poezio-8383f773413cee8529ad4fdc05f092286d6dd377.zip |
Use a "core" parameter for each tab object instead of a singleton
fixes the circular import issue
Diffstat (limited to 'poezio/tabs')
-rw-r--r-- | poezio/tabs/adhoc_commands_list.py | 4 | ||||
-rw-r--r-- | poezio/tabs/basetabs.py | 16 | ||||
-rw-r--r-- | poezio/tabs/bookmarkstab.py | 4 | ||||
-rw-r--r-- | poezio/tabs/conversationtab.py | 4 | ||||
-rw-r--r-- | poezio/tabs/data_forms.py | 4 | ||||
-rw-r--r-- | poezio/tabs/listtab.py | 4 | ||||
-rw-r--r-- | poezio/tabs/muclisttab.py | 4 | ||||
-rw-r--r-- | poezio/tabs/muctab.py | 4 | ||||
-rw-r--r-- | poezio/tabs/privatetab.py | 4 | ||||
-rw-r--r-- | poezio/tabs/rostertab.py | 4 | ||||
-rw-r--r-- | poezio/tabs/xmltab.py | 4 |
11 files changed, 26 insertions, 30 deletions
diff --git a/poezio/tabs/adhoc_commands_list.py b/poezio/tabs/adhoc_commands_list.py index 4d396d84..6db654c9 100644 --- a/poezio/tabs/adhoc_commands_list.py +++ b/poezio/tabs/adhoc_commands_list.py @@ -15,8 +15,8 @@ class AdhocCommandsListTab(ListTab): plugin_commands = {} plugin_keys = {} - def __init__(self, jid): - ListTab.__init__(self, jid.full, + def __init__(self, core, jid): + ListTab.__init__(self, core, jid.full, "“Enter”: execute selected command.", 'Ad-hoc commands of JID %s (Loading)' % jid, (('Node', 0), ('Description', 1))) diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index 9f1e09e7..b0bebfec 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -83,7 +83,8 @@ STATE_PRIORITY = { class Tab(object): plugin_commands = {} plugin_keys = {} - def __init__(self): + def __init__(self, core): + self.core = core if not hasattr(self, 'name'): self.name = self.__class__.__name__ self.input = None @@ -102,10 +103,6 @@ class Tab(object): return self.core.size @property - def core(self): - return Singleton(core.Core) - - @property def nb(self): for index, tab in enumerate(self.core.tabs): if tab == self: @@ -425,8 +422,8 @@ class ChatTab(Tab): """ plugin_commands = {} plugin_keys = {} - def __init__(self, jid=''): - Tab.__init__(self) + def __init__(self, core, jid=''): + Tab.__init__(self, core) self.name = jid self.text_win = None self._text_buffer = TextBuffer() @@ -688,8 +685,8 @@ class ChatTab(Tab): class OneToOneTab(ChatTab): - def __init__(self, jid=''): - ChatTab.__init__(self, jid) + def __init__(self, core, jid=''): + ChatTab.__init__(self, core, jid) # Set to true once the first disco is done self.__initial_disco = False @@ -860,4 +857,3 @@ class OneToOneTab(ChatTab): self.add_message(msg, typ=0) self.core.refresh_window() - diff --git a/poezio/tabs/bookmarkstab.py b/poezio/tabs/bookmarkstab.py index 2eb138b3..053e45dd 100644 --- a/poezio/tabs/bookmarkstab.py +++ b/poezio/tabs/bookmarkstab.py @@ -17,8 +17,8 @@ class BookmarksTab(Tab): a 4 widgets to set the jid/password/autojoin/storage method """ plugin_commands = {} - def __init__(self, bookmarks: BookmarkList): - Tab.__init__(self) + def __init__(self, core, bookmarks: BookmarkList): + Tab.__init__(self, core) self.name = "Bookmarks" self.bookmarks = bookmarks self.new_bookmarks = [] diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py index 686e2d5c..70eed405 100644 --- a/poezio/tabs/conversationtab.py +++ b/poezio/tabs/conversationtab.py @@ -38,8 +38,8 @@ class ConversationTab(OneToOneTab): plugin_keys = {} additional_informations = {} message_type = 'chat' - def __init__(self, jid): - OneToOneTab.__init__(self, jid) + def __init__(self, core, jid): + OneToOneTab.__init__(self, core, jid) self.nick = None self.nick_sent = False self.state = 'normal' diff --git a/poezio/tabs/data_forms.py b/poezio/tabs/data_forms.py index 82c0f128..0edf9e89 100644 --- a/poezio/tabs/data_forms.py +++ b/poezio/tabs/data_forms.py @@ -14,8 +14,8 @@ class DataFormsTab(Tab): a form that the user needs to fill. """ plugin_commands = {} - def __init__(self, form, on_cancel, on_send, kwargs): - Tab.__init__(self) + def __init__(self, core, form, on_cancel, on_send, kwargs): + Tab.__init__(self, core) self._form = form self._on_cancel = on_cancel self._on_send = on_send diff --git a/poezio/tabs/listtab.py b/poezio/tabs/listtab.py index 3e290aee..ddb8b58e 100644 --- a/poezio/tabs/listtab.py +++ b/poezio/tabs/listtab.py @@ -21,7 +21,7 @@ class ListTab(Tab): plugin_commands = {} plugin_keys = {} - def __init__(self, name, help_message, header_text, cols): + def __init__(self, core, name, help_message, header_text, cols): """Parameters: name: The name of the tab help_message: The default help message displayed instead of the @@ -31,7 +31,7 @@ class ListTab(Tab): cols: a tuple of 2-tuples. e.g. (('column1_name', number), ('column2_name', number)) """ - Tab.__init__(self) + Tab.__init__(self, core) self.state = 'normal' self.name = name columns = collections.OrderedDict() diff --git a/poezio/tabs/muclisttab.py b/poezio/tabs/muclisttab.py index ec60d245..5a860b6b 100644 --- a/poezio/tabs/muclisttab.py +++ b/poezio/tabs/muclisttab.py @@ -19,8 +19,8 @@ class MucListTab(ListTab): plugin_commands = {} plugin_keys = {} - def __init__(self, server): - ListTab.__init__(self, server, + def __init__(self, core, server): + ListTab.__init__(self, core, server, "“j”: join room.", 'Chatroom list on server %s (Loading)' % server, (('node-part', 0), ('name', 2), ('users', 3))) diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py index b55c1141..f91cf2b1 100644 --- a/poezio/tabs/muctab.py +++ b/poezio/tabs/muctab.py @@ -53,9 +53,9 @@ class MucTab(ChatTab): message_type = 'groupchat' plugin_commands = {} plugin_keys = {} - def __init__(self, jid, nick, password=None): + def __init__(self, core, jid, nick, password=None): self.joined = False - ChatTab.__init__(self, jid) + ChatTab.__init__(self, core, jid) if self.joined == False: self._state = 'disconnected' self.own_nick = nick diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py index 8dc1b18e..c8c80f19 100644 --- a/poezio/tabs/privatetab.py +++ b/poezio/tabs/privatetab.py @@ -35,8 +35,8 @@ class PrivateTab(OneToOneTab): plugin_commands = {} additional_informations = {} plugin_keys = {} - def __init__(self, name, nick): - OneToOneTab.__init__(self, name) + def __init__(self, core, name, nick): + OneToOneTab.__init__(self, core, name) self.own_nick = nick self.name = name self.text_win = windows.TextWin() diff --git a/poezio/tabs/rostertab.py b/poezio/tabs/rostertab.py index c5475bee..b9b0c228 100644 --- a/poezio/tabs/rostertab.py +++ b/poezio/tabs/rostertab.py @@ -35,8 +35,8 @@ class RosterInfoTab(Tab): """ plugin_commands = {} plugin_keys = {} - def __init__(self): - Tab.__init__(self) + def __init__(self, core): + Tab.__init__(self, core) self.name = "Roster" self.v_separator = windows.VerticalSeparator() self.information_win = windows.TextWin() diff --git a/poezio/tabs/xmltab.py b/poezio/tabs/xmltab.py index e6faed4d..937ab0f9 100644 --- a/poezio/tabs/xmltab.py +++ b/poezio/tabs/xmltab.py @@ -54,8 +54,8 @@ MATCHERS_MAPPINGS = { } class XMLTab(Tab): - def __init__(self): - Tab.__init__(self) + def __init__(self, core): + Tab.__init__(self, core) self.state = 'normal' self.name = 'XMLTab' self.filters = [] |