summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-03-25 21:55:36 +0100
committermathieui <mathieui@mathieui.net>2021-04-02 17:44:36 +0200
commit9ae60e589988b67c6eac60fbd47e35deebbd02f0 (patch)
treedd3a20d7e62ec7bbbe539a8091d7561b252273d3
parentdcd929c9b83ecaeeee34d2ecdaf61f88653705cb (diff)
downloadpoezio-9ae60e589988b67c6eac60fbd47e35deebbd02f0.tar.gz
poezio-9ae60e589988b67c6eac60fbd47e35deebbd02f0.tar.bz2
poezio-9ae60e589988b67c6eac60fbd47e35deebbd02f0.tar.xz
poezio-9ae60e589988b67c6eac60fbd47e35deebbd02f0.zip
refactor: only init core wins after the curses init
-rw-r--r--poezio/core/core.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 59ef094c..f41eb363 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -17,7 +17,6 @@ import uuid
from collections import defaultdict
from typing import (
Any,
- cast,
Callable,
Dict,
List,
@@ -28,7 +27,6 @@ from typing import (
TypeVar,
)
from xml.etree import ElementTree as ET
-from functools import partial
from slixmpp import JID, InvalidJID
from slixmpp.util import FileSystemPerJidCache
@@ -38,9 +36,7 @@ from slixmpp.exceptions import IqError, IqTimeout
from poezio import connection
from poezio import decorators
from poezio import events
-from poezio import multiuserchat as muc
from poezio import tabs
-from poezio import mam
from poezio import theming
from poezio import timed_events
from poezio import windows
@@ -114,15 +110,8 @@ class Core:
# that are displayed in almost all tabs, in an
# information window.
self.information_buffer = TextBuffer()
- self.information_win_size = cast(
- int,
- config.getint('info_win_height', section='var'),
- )
- self.information_win = windows.TextWin(300)
- self.information_buffer.add_window(self.information_win)
- self.left_tab_win = None
+ self.information_win_size = config.getint('info_win_height', section='var')
- self.tab_win = windows.GlobalInfoBar(self)
# Whether the XML tab is opened
self.xml_tab = None
self.xml_buffer = TextBuffer()
@@ -349,6 +338,13 @@ class Core:
for option, handler in config_handlers:
self.add_configuration_handler(option, handler)
+ def _create_windows(self):
+ """Create the windows (delayed after curses init)"""
+ self.information_win = windows.TextWin(300)
+ self.information_buffer.add_window(self.information_win)
+ self.left_tab_win = None
+ self.tab_win = windows.GlobalInfoBar(self)
+
def on_tab_change(self, old_tab: tabs.Tab, new_tab: tabs.Tab):
"""Whenever the current tab changes, change focus and refresh"""
old_tab.on_lose_focus()
@@ -529,6 +525,8 @@ class Core:
"""
self.stdscr = curses.initscr()
self._init_curses(self.stdscr)
+ windows.base_wins.TAB_WIN = self.stdscr
+ self._create_windows()
self.call_for_resize()
default_tab = tabs.RosterInfoTab(self)
default_tab.on_gain_focus()