summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alot/buffers/buffer.py4
-rw-r--r--alot/buffers/bufferlist.py3
-rw-r--r--alot/buffers/envelope.py6
-rw-r--r--alot/buffers/namedqueries.py16
-rw-r--r--alot/buffers/search.py3
-rw-r--r--alot/buffers/taglist.py6
-rw-r--r--alot/buffers/thread.py6
-rw-r--r--alot/commands/envelope.py2
-rw-r--r--alot/commands/globals.py4
-rw-r--r--alot/commands/search.py2
10 files changed, 26 insertions, 26 deletions
diff --git a/alot/buffers/buffer.py b/alot/buffers/buffer.py
index 38aff329..d5b662eb 100644
--- a/alot/buffers/buffer.py
+++ b/alot/buffers/buffer.py
@@ -8,10 +8,6 @@ class Buffer:
modename = None # mode identifier for subclasses
- def __init__(self, ui, widget):
- self.ui = ui
- self.body = widget
-
def __str__(self):
return '[%s]' % self.modename
diff --git a/alot/buffers/bufferlist.py b/alot/buffers/bufferlist.py
index 14f94e20..185b4660 100644
--- a/alot/buffers/bufferlist.py
+++ b/alot/buffers/bufferlist.py
@@ -18,7 +18,8 @@ class BufferlistBuffer(Buffer):
self.ui = ui
self.isinitialized = False
self.rebuild()
- Buffer.__init__(self, ui, self.body)
+
+ super().__init__()
def index_of(self, b):
"""
diff --git a/alot/buffers/envelope.py b/alot/buffers/envelope.py
index ae2972d7..ada8791c 100644
--- a/alot/buffers/envelope.py
+++ b/alot/buffers/envelope.py
@@ -17,12 +17,12 @@ class EnvelopeBuffer(Buffer):
modename = 'envelope'
- def __init__(self, ui, envelope):
- self.ui = ui
+ def __init__(self, envelope):
self.envelope = envelope
self.all_headers = False
self.rebuild()
- Buffer.__init__(self, ui, self.body)
+
+ super().__init__()
def __str__(self):
to = self.envelope.get('To', fallback='unset')
diff --git a/alot/buffers/namedqueries.py b/alot/buffers/namedqueries.py
index ad7c5fb6..2ff7ac08 100644
--- a/alot/buffers/namedqueries.py
+++ b/alot/buffers/namedqueries.py
@@ -13,16 +13,20 @@ class NamedQueriesBuffer(Buffer):
modename = 'namedqueries'
- def __init__(self, ui, filtfun):
- self.ui = ui
+ _dbman = None
+
+ def __init__(self, dbman, filtfun):
+ self._dbman = dbman
+
self.filtfun = filtfun
self.isinitialized = False
self.querylist = None
self.rebuild()
- Buffer.__init__(self, ui, self.body)
+
+ super().__init__()
def rebuild(self):
- self.queries = self.ui.dbman.get_named_queries()
+ self.queries = self._dbman.get_named_queries()
if self.isinitialized:
focusposition = self.querylist.get_focus()[1]
@@ -32,8 +36,8 @@ class NamedQueriesBuffer(Buffer):
lines = []
for (num, key) in enumerate(self.queries):
value = self.queries[key]
- count = self.ui.dbman.count_messages('query:"%s"' % key)
- count_unread = self.ui.dbman.count_messages('query:"%s" and '
+ count = self._dbman.count_messages('query:"%s"' % key)
+ count_unread = self._dbman.count_messages('query:"%s" and '
'tag:unread' % key)
line = QuerylineWidget(key, value, count, count_unread)
diff --git a/alot/buffers/search.py b/alot/buffers/search.py
index 7d327f23..74b47439 100644
--- a/alot/buffers/search.py
+++ b/alot/buffers/search.py
@@ -99,7 +99,8 @@ class SearchBuffer(Buffer):
self.sort_order = sort_order or default_order
self.proc = None # process that fills our pipe
self.rebuild()
- Buffer.__init__(self, ui, self.body)
+
+ super().__init__()
def __str__(self):
formatstring = '[search] for "%s" (%d message%s in %d thread%s)'
diff --git a/alot/buffers/taglist.py b/alot/buffers/taglist.py
index 55fa2fdd..d97876df 100644
--- a/alot/buffers/taglist.py
+++ b/alot/buffers/taglist.py
@@ -13,13 +13,13 @@ class TagListBuffer(Buffer):
modename = 'taglist'
- def __init__(self, ui, alltags=None, filtfun=lambda x: x):
+ def __init__(self, alltags=None, filtfun=lambda x: x):
self.filtfun = filtfun
- self.ui = ui
self.tags = alltags or []
self.isinitialized = False
self.rebuild()
- Buffer.__init__(self, ui, self.body)
+
+ super().__init__()
def rebuild(self):
if self.isinitialized:
diff --git a/alot/buffers/thread.py b/alot/buffers/thread.py
index 8d1aa374..052ed98d 100644
--- a/alot/buffers/thread.py
+++ b/alot/buffers/thread.py
@@ -38,10 +38,8 @@ class ThreadBuffer(Buffer):
_divider_up = None
_divider_down = None
- def __init__(self, ui, thread):
+ def __init__(self, thread):
"""
- :param ui: main UI
- :type ui: :class:`~alot.ui.UI`
:param thread: thread to display
:type thread: :class:`~alot.db.Thread`
"""
@@ -68,7 +66,7 @@ class ThreadBuffer(Buffer):
self.rebuild()
- super().__init__(ui, self.body)
+ super().__init__()
def __str__(self):
return '[thread] %s (%d message%s)' % (self.thread.subject,
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index 5aebadc5..1502011a 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -367,7 +367,7 @@ class EditCommand(Command):
self.envelope.parse_template(template,
only_body=self.edit_only_body)
if self.openNew:
- ui.buffer_open(buffers.EnvelopeBuffer(ui, self.envelope))
+ ui.buffer_open(buffers.EnvelopeBuffer(self.envelope))
else:
ebuffer.envelope = self.envelope
ebuffer.rebuild()
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 9051d61b..19bc0086 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -573,7 +573,7 @@ class TagListCommand(Command):
buf.rebuild()
ui.buffer_focus(buf)
else:
- ui.buffer_open(buffers.TagListBuffer(ui, tags, self.filtfun))
+ ui.buffer_open(buffers.TagListBuffer(tags, self.filtfun))
@registerCommand(MODE, 'namedqueries')
@@ -588,7 +588,7 @@ class NamedQueriesCommand(Command):
Command.__init__(self, **kwargs)
def apply(self, ui):
- ui.buffer_open(buffers.NamedQueriesBuffer(ui, self.filtfun))
+ ui.buffer_open(buffers.NamedQueriesBuffer(ui.dbman, self.filtfun))
@registerCommand(MODE, 'flush')
diff --git a/alot/commands/search.py b/alot/commands/search.py
index 3741f4c2..413dd8e3 100644
--- a/alot/commands/search.py
+++ b/alot/commands/search.py
@@ -38,7 +38,7 @@ class OpenThreadCommand(Command):
query = ui.current_buffer.querystring
logging.info('open thread view for %s', self.thread)
- tb = buffers.ThreadBuffer(ui, self.thread)
+ tb = buffers.ThreadBuffer(self.thread)
ui.buffer_open(tb)
tb.focus_next_matching(query)