diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-07-05 23:29:57 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-07-06 00:25:13 +0100 |
commit | 409b1513ce83e114235c33079fa67623c7843f7e (patch) | |
tree | 04267482d6ff5cea32722f18c2f9c2cb8001da4f | |
parent | 4ffe32ac649f8aa5ca5a7bc526c8860c2795a69e (diff) | |
download | poezio-409b1513ce83e114235c33079fa67623c7843f7e.tar.gz poezio-409b1513ce83e114235c33079fa67623c7843f7e.tar.bz2 poezio-409b1513ce83e114235c33079fa67623c7843f7e.tar.xz poezio-409b1513ce83e114235c33079fa67623c7843f7e.zip |
Move Win._tab_win into poezio.windows.TAB_WIN.
-rw-r--r-- | poezio/size_manager.py | 7 | ||||
-rw-r--r-- | poezio/tabs/basetabs.py | 2 | ||||
-rw-r--r-- | poezio/windows/__init__.py | 2 | ||||
-rw-r--r-- | poezio/windows/base_wins.py | 5 | ||||
-rw-r--r-- | poezio/windows/bookmark_forms.py | 5 | ||||
-rw-r--r-- | poezio/windows/data_forms.py | 5 |
6 files changed, 17 insertions, 9 deletions
diff --git a/poezio/size_manager.py b/poezio/size_manager.py index 1a8735ab..a573e176 100644 --- a/poezio/size_manager.py +++ b/poezio/size_manager.py @@ -3,6 +3,9 @@ Size Manager: used to check size boundaries of the whole window and specific tabs """ + +from poezio import windows + THRESHOLD_WIDTH_DEGRADE = 45 THRESHOLD_HEIGHT_DEGRADE = 10 @@ -17,12 +20,12 @@ class SizeManager(object): @property def tab_degrade_x(self): - _, x = self._win_class._tab_win.getmaxyx() + _, x = windows.TAB_WIN.getmaxyx() return x < THRESHOLD_WIDTH_DEGRADE @property def tab_degrade_y(self): - y, x = self._win_class._tab_win.getmaxyx() + y, x = windows.TAB_WIN.getmaxyx() return y < THRESHOLD_HEIGHT_DEGRADE @property diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index b54cd542..6f0ed7ab 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -166,7 +166,7 @@ class Tab(object): @staticmethod def resize(scr): Tab.height, Tab.width = scr.getmaxyx() - windows.Win._tab_win = scr + windows.TAB_WIN = scr def missing_command_callback(self, command_name): """ diff --git a/poezio/windows/__init__.py b/poezio/windows/__init__.py index 463c27e1..24754d2d 100644 --- a/poezio/windows/__init__.py +++ b/poezio/windows/__init__.py @@ -3,6 +3,8 @@ Module exporting all the Windows, which are wrappers around curses wins used to display information on the screen """ +TAB_WIN = None + from poezio.windows.base_wins import Win from poezio.windows.data_forms import FormWin from poezio.windows.bookmark_forms import BookmarksWin diff --git a/poezio/windows/base_wins.py b/poezio/windows/base_wins.py index a5629ed5..daab504b 100644 --- a/poezio/windows/base_wins.py +++ b/poezio/windows/base_wins.py @@ -13,6 +13,7 @@ log = logging.getLogger(__name__) import curses import string +from poezio import windows from poezio.theming import to_curses_attr, read_tuple FORMAT_CHAR = '\x19' @@ -30,8 +31,8 @@ class DummyWin(object): def __bool__(self): return False + class Win(object): - _tab_win = None def __init__(self): self._win = None self.height, self.width = 0, 0 @@ -42,7 +43,7 @@ class Win(object): return self.height, self.width, self.x, self.y = height, width, x, y try: - self._win = Win._tab_win.derwin(height, width, y, x) + self._win = windows.TAB_WIN.derwin(height, width, y, x) except: log.debug('DEBUG: mvwin returned ERR. Please investigate') if self._win is None: diff --git a/poezio/windows/bookmark_forms.py b/poezio/windows/bookmark_forms.py index 47173738..4df151ee 100644 --- a/poezio/windows/bookmark_forms.py +++ b/poezio/windows/bookmark_forms.py @@ -3,6 +3,7 @@ Windows used inthe bookmarkstab """ import curses +from poezio import windows from poezio.windows.base_wins import Win from poezio.windows.inputs import Input from poezio.windows.data_forms import FieldInput @@ -130,7 +131,7 @@ class BookmarkAutojoinWin(FieldInput, Win): class BookmarksWin(Win): def __init__(self, bookmarks, height, width, y, x): - self._win = Win._tab_win.derwin(height, width, y, x) + self._win = windows.TAB_WIN.derwin(height, width, y, x) self.scroll_pos = 0 self._current_input = 0 self.current_horizontal_input = 0 @@ -181,7 +182,7 @@ class BookmarksWin(Win): def resize(self, height, width, y, x): self.height = height self.width = width - self._win = Win._tab_win.derwin(height, width, y, x) + self._win = windows.TAB_WIN.derwin(height, width, y, x) # Adjust the scroll position, if resizing made the window too small # for the cursor to be visible while self.current_input - self.scroll_pos > self.height-1: diff --git a/poezio/windows/data_forms.py b/poezio/windows/data_forms.py index b7e5bc37..27b7f2c5 100644 --- a/poezio/windows/data_forms.py +++ b/poezio/windows/data_forms.py @@ -6,6 +6,7 @@ does not inherit from the Win base class), as it will create the others when needed. """ +from poezio import windows from poezio.windows.base_wins import Win from poezio.windows.inputs import Input @@ -341,7 +342,7 @@ class FormWin(object): } def __init__(self, form, height, width, y, x): self._form = form - self._win = Win._tab_win.derwin(height, width, y, x) + self._win = windows.TAB_WIN.derwin(height, width, y, x) self.scroll_pos = 0 self.current_input = 0 self.inputs = [] # dict list @@ -364,7 +365,7 @@ class FormWin(object): def resize(self, height, width, y, x): self.height = height self.width = width - self._win = Win._tab_win.derwin(height, width, y, x) + self._win = windows.TAB_WIN.derwin(height, width, y, x) # Adjust the scroll position, if resizing made the window too small # for the cursor to be visible while self.current_input - self.scroll_pos > self.height-1: |