diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2018-06-19 10:40:07 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2018-06-19 22:08:36 +0100 |
commit | f0105c37556116c07f9f30c1fe960ea9e67e7229 (patch) | |
tree | 8642317be8306ea7c18ad62ef9146f507df95f9f /alot/buffers/buffer.py | |
parent | d19615d2ac5bb23aca9068ca8c7644f466ce0b48 (diff) |
refactor buffers
This splits buffers.py, which contained all buffer classes, into several smaller files.
issue #1226
Diffstat (limited to 'alot/buffers/buffer.py')
-rw-r--r-- | alot/buffers/buffer.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/alot/buffers/buffer.py b/alot/buffers/buffer.py new file mode 100644 index 00000000..fc0e7af7 --- /dev/null +++ b/alot/buffers/buffer.py @@ -0,0 +1,40 @@ +# Copyright (C) 2011-2018 Patrick Totzke <patricktotzke@gmail.com> +# This file is released under the GNU GPL, version 3 or a later revision. +# For further details see the COPYING file + + +class Buffer(object): + """Abstract base class for buffers.""" + + modename = None # mode identifier for subclasses + + def __init__(self, ui, widget): + self.ui = ui + self.body = widget + + def __str__(self): + return '[%s]' % self.modename + + def render(self, size, focus=False): + return self.body.render(size, focus) + + def selectable(self): + return self.body.selectable() + + def rebuild(self): + """tells the buffer to (re)construct its visible content.""" + pass + + def keypress(self, size, key): + return self.body.keypress(size, key) + + def cleanup(self): + """called before buffer is closed""" + pass + + def get_info(self): + """ + return dict of meta infos about this buffer. + This can be requested to be displayed in the statusbar. + """ + return {} |