diff options
author | mathieui <mathieui@mathieui.net> | 2016-07-07 19:51:53 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2016-07-07 19:51:53 +0200 |
commit | dae641412ebebdf7fd7364f07a577688a375715d (patch) | |
tree | 507318f8689689e546fbe17c7c8ede53d29767fa | |
parent | 3dcb04992dd6eb3f76f9d449ae7118da2c572d08 (diff) | |
download | poezio-dae641412ebebdf7fd7364f07a577688a375715d.tar.gz poezio-dae641412ebebdf7fd7364f07a577688a375715d.tar.bz2 poezio-dae641412ebebdf7fd7364f07a577688a375715d.tar.xz poezio-dae641412ebebdf7fd7364f07a577688a375715d.zip |
Fix a circular import introduced in 409b1513
It breaks python 3.4 which is touchy about them, https://bugs.python.org/issue17636
-rw-r--r-- | poezio/size_manager.py | 4 | ||||
-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 | 7 | ||||
-rw-r--r-- | poezio/windows/data_forms.py | 7 |
6 files changed, 12 insertions, 15 deletions
diff --git a/poezio/size_manager.py b/poezio/size_manager.py index a573e176..7e445042 100644 --- a/poezio/size_manager.py +++ b/poezio/size_manager.py @@ -20,12 +20,12 @@ class SizeManager(object): @property def tab_degrade_x(self): - _, x = windows.TAB_WIN.getmaxyx() + _, x = windows.base_wins.TAB_WIN.getmaxyx() return x < THRESHOLD_WIDTH_DEGRADE @property def tab_degrade_y(self): - y, x = windows.TAB_WIN.getmaxyx() + y, x = windows.base_wins.TAB_WIN.getmaxyx() return y < THRESHOLD_HEIGHT_DEGRADE @property diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index ea5aed6e..dbd57aa4 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -164,7 +164,7 @@ class Tab(object): @staticmethod def resize(scr): Tab.height, Tab.width = scr.getmaxyx() - windows.TAB_WIN = scr + windows.base_wins.TAB_WIN = scr def missing_command_callback(self, command_name): """ diff --git a/poezio/windows/__init__.py b/poezio/windows/__init__.py index 24754d2d..463c27e1 100644 --- a/poezio/windows/__init__.py +++ b/poezio/windows/__init__.py @@ -3,8 +3,6 @@ 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 daab504b..fe24ba65 100644 --- a/poezio/windows/base_wins.py +++ b/poezio/windows/base_wins.py @@ -7,13 +7,14 @@ the text window, the roster window, etc. A Tab (see the poezio.tabs module) is composed of multiple Windows """ +TAB_WIN = None + import logging log = logging.getLogger(__name__) import curses import string -from poezio import windows from poezio.theming import to_curses_attr, read_tuple FORMAT_CHAR = '\x19' @@ -43,7 +44,7 @@ class Win(object): return self.height, self.width, self.x, self.y = height, width, x, y try: - self._win = windows.TAB_WIN.derwin(height, width, y, x) + self._win = 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 4df151ee..3102c358 100644 --- a/poezio/windows/bookmark_forms.py +++ b/poezio/windows/bookmark_forms.py @@ -3,8 +3,7 @@ Windows used inthe bookmarkstab """ import curses -from poezio import windows -from poezio.windows.base_wins import Win +from poezio.windows.base_wins import Win, TAB_WIN from poezio.windows.inputs import Input from poezio.windows.data_forms import FieldInput from poezio.theming import to_curses_attr, get_theme @@ -131,7 +130,7 @@ class BookmarkAutojoinWin(FieldInput, Win): class BookmarksWin(Win): def __init__(self, bookmarks, height, width, y, x): - self._win = windows.TAB_WIN.derwin(height, width, y, x) + self._win = TAB_WIN.derwin(height, width, y, x) self.scroll_pos = 0 self._current_input = 0 self.current_horizontal_input = 0 @@ -182,7 +181,7 @@ class BookmarksWin(Win): def resize(self, height, width, y, x): self.height = height self.width = width - self._win = windows.TAB_WIN.derwin(height, width, y, x) + self._win = 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 27b7f2c5..d9f98783 100644 --- a/poezio/windows/data_forms.py +++ b/poezio/windows/data_forms.py @@ -6,8 +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.base_wins import Win, TAB_WIN from poezio.windows.inputs import Input from poezio.theming import to_curses_attr, get_theme @@ -342,7 +341,7 @@ class FormWin(object): } def __init__(self, form, height, width, y, x): self._form = form - self._win = windows.TAB_WIN.derwin(height, width, y, x) + self._win = TAB_WIN.derwin(height, width, y, x) self.scroll_pos = 0 self.current_input = 0 self.inputs = [] # dict list @@ -365,7 +364,7 @@ class FormWin(object): def resize(self, height, width, y, x): self.height = height self.width = width - self._win = windows.TAB_WIN.derwin(height, width, y, x) + self._win = 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: |