summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poezio/windows/base_wins.py2
-rw-r--r--poezio/windows/bookmark_forms.py3
-rw-r--r--poezio/windows/confirm.py2
-rw-r--r--poezio/windows/data_forms.py23
-rw-r--r--poezio/windows/image.py2
-rw-r--r--poezio/windows/info_bar.py4
-rw-r--r--poezio/windows/info_wins.py20
-rw-r--r--poezio/windows/input_placeholders.py2
-rw-r--r--poezio/windows/inputs.py5
-rw-r--r--poezio/windows/list.py6
-rw-r--r--poezio/windows/misc.py4
-rw-r--r--poezio/windows/muc.py4
-rw-r--r--poezio/windows/roster_win.py4
-rw-r--r--poezio/windows/text_win.py9
14 files changed, 88 insertions, 2 deletions
diff --git a/poezio/windows/base_wins.py b/poezio/windows/base_wins.py
index b14b44c3..6dabd7b8 100644
--- a/poezio/windows/base_wins.py
+++ b/poezio/windows/base_wins.py
@@ -37,6 +37,8 @@ class DummyWin:
class Win:
+ __slots__ = ('_win', 'height', 'width', 'y', 'x')
+
def __init__(self) -> None:
self._win = None
self.height, self.width = 0, 0
diff --git a/poezio/windows/bookmark_forms.py b/poezio/windows/bookmark_forms.py
index b7875e3c..2940ef04 100644
--- a/poezio/windows/bookmark_forms.py
+++ b/poezio/windows/bookmark_forms.py
@@ -152,6 +152,9 @@ class BookmarkAutojoinWin(FieldInputMixin):
class BookmarksWin(Win):
+ __slots__ = ('scroll_pos', '_current_input', 'current_horizontal_input',
+ '_bookmarks', 'lines')
+
def __init__(self, bookmarks: BookmarkList, height: int, width: int, y: int, x: int) -> None:
self._win = base_wins.TAB_WIN.derwin(height, width, y, x)
self.scroll_pos = 0
diff --git a/poezio/windows/confirm.py b/poezio/windows/confirm.py
index 65878509..0a8de67b 100644
--- a/poezio/windows/confirm.py
+++ b/poezio/windows/confirm.py
@@ -4,6 +4,8 @@ from poezio.theming import get_theme, to_curses_attr
class Dialog(Win):
+ __slots__ = ('text', 'accept', 'critical')
+
str_accept = " Accept "
str_refuse = " Reject "
diff --git a/poezio/windows/data_forms.py b/poezio/windows/data_forms.py
index dc954bd7..70d396dc 100644
--- a/poezio/windows/data_forms.py
+++ b/poezio/windows/data_forms.py
@@ -20,6 +20,9 @@ class FieldInput:
'windows' library.
"""
+ # XXX: This conflicts with Win in the FieldInputMixin.
+ #__slots__ = ('_field', 'color')
+
def __init__(self, field):
self._field = field
self.color = get_theme().COLOR_NORMAL_TEXT
@@ -47,6 +50,8 @@ class FieldInput:
class FieldInputMixin(FieldInput, Win):
"Mix both FieldInput and Win"
+ __slots__ = ()
+
def __init__(self, field):
FieldInput.__init__(self, field)
Win.__init__(self)
@@ -60,6 +65,8 @@ class FieldInputMixin(FieldInput, Win):
class ColoredLabel(Win):
+ __slots__ = ('text', 'color')
+
def __init__(self, text):
self.text = text
self.color = get_theme().COLOR_NORMAL_TEXT
@@ -85,6 +92,8 @@ class DummyInput(FieldInputMixin):
Used for fields that do not require any input ('fixed')
"""
+ __slots__ = ()
+
def __init__(self, field):
FieldInputMixin.__init__(self, field)
@@ -99,6 +108,8 @@ class DummyInput(FieldInputMixin):
class BooleanWin(FieldInputMixin):
+ __slots__ = ('last_key', 'value')
+
def __init__(self, field):
FieldInputMixin.__init__(self, field)
self.last_key = 'KEY_RIGHT'
@@ -133,6 +144,8 @@ class BooleanWin(FieldInputMixin):
class TextMultiWin(FieldInputMixin):
+ __slots__ = ('options', 'val_pos', 'edition_input')
+
def __init__(self, field):
FieldInputMixin.__init__(self, field)
options = field.get_value()
@@ -212,6 +225,8 @@ class TextMultiWin(FieldInputMixin):
class ListMultiWin(FieldInputMixin):
+ __slots__ = ('options', 'val_pos')
+
def __init__(self, field):
FieldInputMixin.__init__(self, field)
values = field.get_value() or []
@@ -261,6 +276,8 @@ class ListMultiWin(FieldInputMixin):
class ListSingleWin(FieldInputMixin):
+ __slots__ = ('options', 'val_pos')
+
def __init__(self, field):
FieldInputMixin.__init__(self, field)
# the option list never changes
@@ -306,6 +323,8 @@ class ListSingleWin(FieldInputMixin):
class TextSingleWin(FieldInputMixin, Input):
+ __slots__ = ('text', 'pos')
+
def __init__(self, field):
FieldInputMixin.__init__(self, field)
Input.__init__(self)
@@ -323,6 +342,8 @@ class TextSingleWin(FieldInputMixin, Input):
class TextPrivateWin(TextSingleWin):
+ __slots__ = ()
+
def __init__(self, field):
TextSingleWin.__init__(self, field)
@@ -352,6 +373,8 @@ class FormWin:
On resize, move and resize all the subwin and define how the text will be written
On refresh, write all the text, and refresh all the subwins
"""
+ __slots__ = ('_form', '_win', 'scroll_pos', 'current_input', 'inputs')
+
input_classes = {
'boolean': BooleanWin,
'fixed': DummyInput,
diff --git a/poezio/windows/image.py b/poezio/windows/image.py
index 309fe0e6..75f4d588 100644
--- a/poezio/windows/image.py
+++ b/poezio/windows/image.py
@@ -24,6 +24,8 @@ class ImageWin(Win):
A window which contains either an image or a border.
"""
+ __slots__ = ('_image', '_display_avatar')
+
def __init__(self) -> None:
self._image = None # type: Optional[Image]
Win.__init__(self)
diff --git a/poezio/windows/info_bar.py b/poezio/windows/info_bar.py
index 96382d0f..15821c10 100644
--- a/poezio/windows/info_bar.py
+++ b/poezio/windows/info_bar.py
@@ -16,6 +16,8 @@ from poezio.theming import get_theme, to_curses_attr
class GlobalInfoBar(Win):
+ __slots__ = ('core')
+
def __init__(self, core) -> None:
Win.__init__(self)
self.core = core
@@ -63,6 +65,8 @@ class GlobalInfoBar(Win):
class VerticalGlobalInfoBar(Win):
+ __slots__ = ('core')
+
def __init__(self, core, scr) -> None:
Win.__init__(self)
self.core = core
diff --git a/poezio/windows/info_wins.py b/poezio/windows/info_wins.py
index 27f9e1cf..0a8f0f27 100644
--- a/poezio/windows/info_wins.py
+++ b/poezio/windows/info_wins.py
@@ -20,6 +20,8 @@ class InfoWin(Win):
MucInfoWin, etc. Provides some useful methods.
"""
+ __slots__ = ()
+
def __init__(self):
Win.__init__(self)
@@ -40,6 +42,8 @@ class XMLInfoWin(InfoWin):
Info about the latest xml filter used and the state of the buffer.
"""
+ __slots__ = ()
+
def __init__(self):
InfoWin.__init__(self)
@@ -63,6 +67,8 @@ class PrivateInfoWin(InfoWin):
about the MUC user we are talking to
"""
+ __slots__ = ()
+
def __init__(self):
InfoWin.__init__(self)
@@ -104,6 +110,8 @@ class MucListInfoWin(InfoWin):
about the muc server being listed
"""
+ __slots__ = ('message')
+
def __init__(self, message=''):
InfoWin.__init__(self)
self.message = message
@@ -129,6 +137,8 @@ class ConversationInfoWin(InfoWin):
about the user we are talking to
"""
+ __slots__ = ()
+
def __init__(self):
InfoWin.__init__(self)
@@ -218,6 +228,8 @@ class ConversationInfoWin(InfoWin):
class DynamicConversationInfoWin(ConversationInfoWin):
+ __slots__ = ()
+
def write_contact_jid(self, jid):
"""
Just displays the resource in an other color
@@ -240,6 +252,8 @@ class MucInfoWin(InfoWin):
about the MUC we are viewing
"""
+ __slots__ = ()
+
def __init__(self):
InfoWin.__init__(self)
@@ -306,6 +320,8 @@ class ConversationStatusMessageWin(InfoWin):
The upper bar displaying the status message of the contact
"""
+ __slots__ = ()
+
def __init__(self):
InfoWin.__init__(self)
@@ -331,6 +347,8 @@ class ConversationStatusMessageWin(InfoWin):
class BookmarksInfoWin(InfoWin):
+ __slots__ = ()
+
def __init__(self):
InfoWin.__init__(self)
@@ -347,6 +365,8 @@ class BookmarksInfoWin(InfoWin):
class ConfirmStatusWin(Win):
+ __slots__ = ('text', 'critical')
+
def __init__(self, text, critical=False):
Win.__init__(self)
self.text = text
diff --git a/poezio/windows/input_placeholders.py b/poezio/windows/input_placeholders.py
index c5656f72..4d414636 100644
--- a/poezio/windows/input_placeholders.py
+++ b/poezio/windows/input_placeholders.py
@@ -19,6 +19,8 @@ class HelpText(Win):
command mode.
"""
+ __slots__ = ('txt')
+
def __init__(self, text: str = '') -> None:
Win.__init__(self)
self.txt = text # type: str
diff --git a/poezio/windows/inputs.py b/poezio/windows/inputs.py
index 6b0bc798..c0c73419 100644
--- a/poezio/windows/inputs.py
+++ b/poezio/windows/inputs.py
@@ -32,6 +32,9 @@ class Input(Win):
passing the list of items that can be used to complete. The completion can be used
in a very flexible way.
"""
+ __slots__ = ('key_func', 'text', 'pos', 'view_pos', 'on_input', 'color',
+ 'last_completion', 'hit_list')
+
text_attributes = 'bou1234567ti'
clipboard = '' # A common clipboard for all the inputs, this makes
@@ -586,6 +589,8 @@ class HistoryInput(Input):
An input with colors and stuff, plus an history
^R allows to search inside the history (as in a shell)
"""
+ __slots__ = ('help_message', 'histo_pos', 'current_completed', 'search')
+
history = [] # type: List[str]
def __init__(self) -> None:
diff --git a/poezio/windows/list.py b/poezio/windows/list.py
index b24b8aea..f03dcf6a 100644
--- a/poezio/windows/list.py
+++ b/poezio/windows/list.py
@@ -19,6 +19,9 @@ class ListWin(Win):
scrolled up and down, with one selected line at a time
"""
+ __slots__ = ('_columns', '_columns_sizes', 'sorted_by', 'lines',
+ '_selected_row', '_starting_pos')
+
def __init__(self, columns: Dict[str, int], with_headers: bool = True) -> None:
Win.__init__(self)
self._columns = columns # type: Dict[str, int]
@@ -165,6 +168,9 @@ class ColumnHeaderWin(Win):
A class displaying the column's names
"""
+ __slots__ = ('_columns', '_columns_sizes', '_column_sel', '_column_order',
+ '_column_order_asc')
+
def __init__(self, columns: List[str]) -> None:
Win.__init__(self)
self._columns = columns
diff --git a/poezio/windows/misc.py b/poezio/windows/misc.py
index e6596622..6c04b814 100644
--- a/poezio/windows/misc.py
+++ b/poezio/windows/misc.py
@@ -19,6 +19,8 @@ class VerticalSeparator(Win):
refreshed only on resize, but never on refresh, for efficiency
"""
+ __slots__ = ()
+
def rewrite_line(self) -> None:
self._win.vline(0, 0, curses.ACS_VLINE, self.height,
to_curses_attr(get_theme().COLOR_VERTICAL_SEPARATOR))
@@ -30,6 +32,8 @@ class VerticalSeparator(Win):
class SimpleTextWin(Win):
+ __slots__ = ('_text', 'built_lines')
+
def __init__(self, text) -> None:
Win.__init__(self)
self._text = text
diff --git a/poezio/windows/muc.py b/poezio/windows/muc.py
index 3e52f63d..72dc602c 100644
--- a/poezio/windows/muc.py
+++ b/poezio/windows/muc.py
@@ -28,6 +28,8 @@ def userlist_to_cache(userlist: List[User]) -> List[CachedUser]:
class UserList(Win):
+ __slots__ = ('pos', 'cache')
+
def __init__(self) -> None:
Win.__init__(self)
self.pos = 0
@@ -128,6 +130,8 @@ class UserList(Win):
class Topic(Win):
+ __slots__ = ('_message')
+
def __init__(self) -> None:
Win.__init__(self)
self._message = ''
diff --git a/poezio/windows/roster_win.py b/poezio/windows/roster_win.py
index 3497e342..3c62ea0a 100644
--- a/poezio/windows/roster_win.py
+++ b/poezio/windows/roster_win.py
@@ -20,6 +20,8 @@ Row = Union[RosterGroup, Contact]
class RosterWin(Win):
+ __slots__ = ('pos', 'start_pos', 'selected_row', 'roster_cache')
+
def __init__(self) -> None:
Win.__init__(self)
self.pos = 0 # cursor position in the contact list
@@ -342,6 +344,8 @@ class RosterWin(Win):
class ContactInfoWin(Win):
+ __slots__ = ()
+
def draw_contact_info(self, contact: Contact) -> None:
"""
draw the contact information
diff --git a/poezio/windows/text_win.py b/poezio/windows/text_win.py
index 76c7d2d7..d0669b26 100644
--- a/poezio/windows/text_win.py
+++ b/poezio/windows/text_win.py
@@ -32,6 +32,9 @@ class Line:
class BaseTextWin(Win):
+ __slots__ = ('lines_nb_limit', 'pos', 'built_lines', 'lock', 'lock_buffer',
+ 'separator_after')
+
def __init__(self, lines_nb_limit: Optional[int] = None) -> None:
if lines_nb_limit is None:
lines_nb_limit = config.get('max_lines_in_memory')
@@ -175,6 +178,8 @@ class BaseTextWin(Win):
class TextWin(BaseTextWin):
+ __slots__ = ('highlights', 'hl_pos', 'nb_of_highlights_after_separator')
+
def __init__(self, lines_nb_limit: Optional[int] = None) -> None:
BaseTextWin.__init__(self, lines_nb_limit)
@@ -190,8 +195,6 @@ class TextWin(BaseTextWin):
# This is useful to make “go to next highlight“ work after a “move to separator”.
self.nb_of_highlights_after_separator = 0
- self.separator_after = None
-
def next_highlight(self) -> None:
"""
Go to the next highlight in the buffer.
@@ -563,6 +566,8 @@ class TextWin(BaseTextWin):
class XMLTextWin(BaseTextWin):
+ __slots__ = ()
+
def __init__(self) -> None:
BaseTextWin.__init__(self)