Simplify Tab.core to remove class variables.

This commit is contained in:
Emmanuel Gil Peyrot 2016-06-28 00:48:42 +01:00
parent 29ac9ec597
commit 15cb47d18c

View file

@ -81,9 +81,6 @@ STATE_PRIORITY = {
} }
class Tab(object): class Tab(object):
tab_core = None
size_manager = None
plugin_commands = {} plugin_commands = {}
plugin_keys = {} plugin_keys = {}
def __init__(self): def __init__(self):
@ -102,15 +99,11 @@ class Tab(object):
@property @property
def size(self): def size(self):
if not Tab.size_manager: return self.core.size
Tab.size_manager = self.core.size
return Tab.size_manager
@property @property
def core(self): def core(self):
if not Tab.tab_core: return Singleton(core.Core)
Tab.tab_core = Singleton(core.Core)
return Tab.tab_core
@property @property
def nb(self): def nb(self):
@ -119,18 +112,6 @@ class Tab(object):
return index return index
return len(self.core.tabs) return len(self.core.tabs)
@property
def tab_win(self):
if not Tab.tab_core:
Tab.tab_core = Singleton(core.Core)
return Tab.tab_core.tab_win
@property
def left_tab_win(self):
if not Tab.tab_core:
Tab.tab_core = Singleton(core.Core)
return Tab.tab_core.left_tab_win
@staticmethod @staticmethod
def tab_win_height(): def tab_win_height():
""" """
@ -300,10 +281,11 @@ class Tab(object):
def refresh_tab_win(self): def refresh_tab_win(self):
if config.get('enable_vertical_tab_list'): if config.get('enable_vertical_tab_list'):
if self.left_tab_win and not self.size.core_degrade_x: left_tab_win = self.core.left_tab_win
self.left_tab_win.refresh() if left_tab_win and not self.size.core_degrade_x:
left_tab_win.refresh()
elif not self.size.core_degrade_y: elif not self.size.core_degrade_y:
self.tab_win.refresh() self.core.tab_win.refresh()
def refresh(self): def refresh(self):
""" """