summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST.in2
-rw-r--r--alot/__init__.py2
-rw-r--r--alot/buffers.py2
-rw-r--r--alot/defaults/alot.rc.spec8
-rw-r--r--alot/helper.py5
-rw-r--r--alot/walker.py8
-rw-r--r--alot/widgets/globals.py7
-rw-r--r--alot/widgets/thread.py10
-rw-r--r--docs/source/configuration/alotrc_table14
-rwxr-xr-xsetup.py2
-rw-r--r--tests/helper_test.py9
11 files changed, 54 insertions, 15 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 40c8eef3..0b5acb78 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -2,4 +2,4 @@ include COPYING
include NEWS
include extra/completion/alot-completion.zsh
include extra/alot.desktop
-recursive-exclude tests *
+include tests
diff --git a/alot/__init__.py b/alot/__init__.py
index ad4291dc..83966213 100644
--- a/alot/__init__.py
+++ b/alot/__init__.py
@@ -1,5 +1,5 @@
__productname__ = 'alot'
-__version__ = '0.5.1'
+__version__ = '0.6.0dev'
__copyright__ = "Copyright (C) 2012-17 Patrick Totzke"
__author__ = "Patrick Totzke"
__author_email__ = "patricktotzke@gmail.com"
diff --git a/alot/buffers.py b/alot/buffers.py
index 1f25357f..93ca60f0 100644
--- a/alot/buffers.py
+++ b/alot/buffers.py
@@ -679,4 +679,4 @@ class TagListBuffer(Buffer):
"""returns selected tagstring"""
cols, _ = self.taglist.get_focus()
tagwidget = cols.original_widget.get_focus()
- return tagwidget.get_tag()
+ return tagwidget.tag
diff --git a/alot/defaults/alot.rc.spec b/alot/defaults/alot.rc.spec
index ae06890e..ad61c178 100644
--- a/alot/defaults/alot.rc.spec
+++ b/alot/defaults/alot.rc.spec
@@ -80,7 +80,7 @@ editor_cmd = string(default=None)
# file encoding used by your editor
editor_writes_encoding = string(default='UTF-8')
-# use terminal_command to spawn a new terminal for the editor?
+# use :ref:`terminal_cmd <terminal-cmd>` to spawn a new terminal for the editor?
# equivalent to always providing the `--spawn=yes` parameter to compose/edit commands
editor_spawn = boolean(default=False)
@@ -256,6 +256,12 @@ history_size = integer(default=50)
# The number of seconds to wait between calls to the loop_hook
periodic_hook_frequency = integer(default=300)
+# Split message body linewise and allows to (move) the focus to each individual
+# line. Setting this to False will result in one potentially big text widget
+# for the whole message body.
+thread_focus_linewise = boolean(default=True)
+
+
# Key bindings
[bindings]
__many__ = string(default=None)
diff --git a/alot/helper.py b/alot/helper.py
index 7214de38..f673781e 100644
--- a/alot/helper.py
+++ b/alot/helper.py
@@ -279,12 +279,13 @@ def call_cmd(cmdlist, stdin=None):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE if stdin is not None else None)
- out, err = proc.communicate(stdin)
- ret = proc.returncode
except OSError as e:
out = b''
err = e.strerror
ret = e.errno
+ else:
+ out, err = proc.communicate(stdin)
+ ret = proc.returncode
out = string_decode(out, urwid.util.detected_encoding)
err = string_decode(err, urwid.util.detected_encoding)
diff --git a/alot/walker.py b/alot/walker.py
index 11296473..560a0605 100644
--- a/alot/walker.py
+++ b/alot/walker.py
@@ -8,8 +8,12 @@ import urwid
class PipeWalker(urwid.ListWalker):
- """urwid.ListWalker that reads next items from a pipe and
- wraps them in `containerclass` widgets for displaying
+ """urwid.ListWalker that reads next items from a pipe and wraps them in
+ `containerclass` widgets for displaying
+
+ Atributes that should be considered publicly readable:
+ :attr lines: the lines obtained from the pipe
+ :type lines: list(`containerclass`)
"""
def __init__(self, pipe, containerclass, reverse=False, **kwargs):
self.pipe = pipe
diff --git a/alot/widgets/globals.py b/alot/widgets/globals.py
index 60397104..95b55465 100644
--- a/alot/widgets/globals.py
+++ b/alot/widgets/globals.py
@@ -279,6 +279,10 @@ class TagWidget(urwid.AttrMap):
It looks up the string it displays in the `tags` section
of the config as well as custom theme settings for its tag.
+
+ Atributes that should be considered publicly readable:
+ :attr tag: the notmuch tag
+ :type tag: str
"""
def __init__(self, tag, fallback_normal=None, fallback_focus=None):
self.tag = tag
@@ -307,9 +311,6 @@ class TagWidget(urwid.AttrMap):
def keypress(self, size, key):
return key
- def get_tag(self):
- return self.tag
-
def set_focussed(self):
self.set_attr_map(self.attmaps['focus'])
diff --git a/alot/widgets/thread.py b/alot/widgets/thread.py
index 70e7c840..1635d52d 100644
--- a/alot/widgets/thread.py
+++ b/alot/widgets/thread.py
@@ -94,8 +94,14 @@ class TextlinesList(SimpleTree):
for each line in content.
"""
structure = []
- for line in content.splitlines():
- structure.append((FocusableText(line, attr, attr_focus), None))
+
+ # depending on this config setting, we either add individual lines
+ # or the complete context as focusable objects.
+ if settings.get('thread_focus_linewise'):
+ for line in content.splitlines():
+ structure.append((FocusableText(line, attr, attr_focus), None))
+ else:
+ structure.append((FocusableText(content, attr, attr_focus), None))
SimpleTree.__init__(self, structure)
diff --git a/docs/source/configuration/alotrc_table b/docs/source/configuration/alotrc_table
index a51079d9..b15ec412 100644
--- a/docs/source/configuration/alotrc_table
+++ b/docs/source/configuration/alotrc_table
@@ -192,7 +192,7 @@
.. describe:: editor_spawn
- use terminal_command to spawn a new terminal for the editor?
+ use :ref:`terminal_cmd <terminal-cmd>` to spawn a new terminal for the editor?
equivalent to always providing the `--spawn=yes` parameter to compose/edit commands
:type: boolean
@@ -633,6 +633,18 @@
:default: True
+.. _thread-focus-linewise:
+
+.. describe:: thread_focus_linewise
+
+ Split message body linewise and allows to (move) the focus to each individual
+ line. Setting this to False will result in one potentially big text widget
+ for the whole message body.
+
+ :type: boolean
+ :default: True
+
+
.. _thread-statusbar:
.. describe:: thread_statusbar
diff --git a/setup.py b/setup.py
index a3f6f908..ecfb33af 100755
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@ setup(name='alot',
author_email=alot.__author_email__,
url=alot.__url__,
license=alot.__copyright__,
- packages=find_packages(),
+ packages=find_packages(exclude=['tests*']),
package_data={'alot': [
'defaults/alot.rc.spec',
'defaults/notmuch.rc.spec',
diff --git a/tests/helper_test.py b/tests/helper_test.py
index 78cba84d..9c783706 100644
--- a/tests/helper_test.py
+++ b/tests/helper_test.py
@@ -370,3 +370,12 @@ class TestCallCmd(unittest.TestCase):
# We don't control this, although 1 might be a fairly safe guess, we
# know for certain it should *not* return 0
self.assertNotEqual(code, 0)
+
+ def test_os_errors_from_popen_are_caught(self):
+ with mock.patch('subprocess.Popen',
+ mock.Mock(side_effect=OSError(42, u'foobar'))):
+ out, err, code = helper.call_cmd(
+ ['does_not_matter_as_subprocess_popen_is_mocked'])
+ self.assertEqual(out, u'')
+ self.assertEqual(err, u'foobar')
+ self.assertEqual(code, 42)