summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/envelope.py6
-rw-r--r--alot/commands/globals.py27
-rw-r--r--alot/commands/thread.py6
-rw-r--r--alot/completion.py9
-rw-r--r--alot/db/envelope.py27
-rw-r--r--alot/db/errors.py3
-rw-r--r--alot/defaults/default.bindings6
-rw-r--r--alot/defaults/default.theme6
-rw-r--r--alot/settings/manager.py5
-rw-r--r--alot/settings/utils.py1
-rw-r--r--alot/ui.py6
11 files changed, 61 insertions, 41 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py
index a1bced27..b0490b6a 100644
--- a/alot/commands/envelope.py
+++ b/alot/commands/envelope.py
@@ -311,8 +311,10 @@ class EditCommand(Command):
if old_tmpfile:
os.unlink(old_tmpfile.name)
cmd = globals.EditCommand(self.envelope.tmpfile.name,
- on_success=openEnvelopeFromTmpfile, spawn=self.force_spawn,
- thread=self.force_spawn, refocus=self.refocus)
+ on_success=openEnvelopeFromTmpfile,
+ spawn=self.force_spawn,
+ thread=self.force_spawn,
+ refocus=self.refocus)
ui.apply_command(cmd)
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 9f2f0222..587cfa48 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -57,7 +57,8 @@ class SearchCommand(Command):
:param query: notmuch querystring
:type query: str
:param sort: how to order results. Must be one of
- 'oldest_first', 'newest_first', 'message_id' or 'unsorted'.
+ 'oldest_first', 'newest_first', 'message_id' or
+ 'unsorted'.
:type sort: str
"""
self.query = ' '.join(query)
@@ -324,7 +325,7 @@ class CallCommand(Command):
except Exception as e:
logging.exception(e)
msg = 'an error occurred during execution of "%s":\n%s'
- ui.notify(msg % (self.command,e), priority='error')
+ ui.notify(msg % (self.command, e), priority='error')
@registerCommand(MODE, 'bclose', arguments=[
@@ -350,9 +351,10 @@ class BufferCloseCommand(Command):
if (isinstance(self.buffer, buffers.EnvelopeBuffer) and
not self.buffer.envelope.sent_time):
- if (not self.force and
- (yield ui.choice('close without sending?', select='yes',
- cancel='no', msg_position='left')) == 'no'):
+ if (not self.force and (yield ui.choice('close without sending?',
+ select='yes', cancel='no',
+ msg_position='left')) ==
+ 'no'):
return
if len(ui.buffers) == 1:
@@ -371,8 +373,8 @@ class BufferCloseCommand(Command):
@registerCommand(MODE, 'bnext', forced={'offset': +1},
help='focus next buffer')
@registerCommand(MODE, 'buffer', arguments=[
- (['index'], {'type':int, 'help':'buffer index to focus'}),],
- help='focus buffer with given index')
+ (['index'], {'type':int, 'help':'buffer index to focus'}), ],
+ help='focus buffer with given index')
class BufferFocusCommand(Command):
"""focus a :class:`~alot.buffers.Buffer`"""
def __init__(self, buffer=None, index=None, offset=0, **kwargs):
@@ -505,8 +507,8 @@ class HelpCommand(Command):
linewidgets = []
# mode specific maps
if modemaps:
- linewidgets.append(urwid.Text((section_att,
- '\n%s-mode specific maps' % ui.mode)))
+ txt = (section_att, '\n%s-mode specific maps' % ui.mode)
+ linewidgets.append(urwid.Text(txt))
for (k, v) in modemaps.items():
line = urwid.Columns([('fixed', keycolumnwidth,
urwid.Text((text_att, k))),
@@ -697,8 +699,8 @@ class ComposeCommand(Command):
else:
ui.notify('could not locate signature: %s' % sig,
priority='error')
- if (yield ui.choice('send without signature',
- select='yes', cancel='no')) == 'no':
+ if (yield ui.choice('send without signature?', 'yes',
+ 'no')) == 'no':
return
# Figure out whether we should GPG sign messages by default
@@ -744,5 +746,6 @@ class ComposeCommand(Command):
logging.debug('attaching: ' + a)
cmd = commands.envelope.EditCommand(envelope=self.envelope,
- spawn=self.force_spawn, refocus=False)
+ spawn=self.force_spawn,
+ refocus=False)
ui.apply_command(cmd)
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index 4cbeb4b5..96f3a287 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -318,8 +318,8 @@ class EditNewCommand(Command):
(['--all'], {'action': 'store_true', 'help':'affect all messages'})],
help='display message source')
@registerCommand(MODE, 'toggleheaders', forced={'all_headers': 'toggle'},
- arguments=[
- (['--all'], {'action': 'store_true', 'help':'affect all messages'})],
+ arguments=[ (['--all'], {'action': 'store_true',
+ 'help':'affect all messages'})],
help='display all headers')
class ChangeDisplaymodeCommand(Command):
"""fold or unfold messages"""
@@ -388,7 +388,7 @@ class ChangeDisplaymodeCommand(Command):
(['--shell'], {'action': 'store_true',
'help':'let the shell interpret the command'}),
(['--notify_stdout'], {'action': 'store_true',
- 'help':'display command\'s stdout as notification message'}),
+ 'help':'display cmd\'s stdout as notification'}),
],
)
class PipeCommand(Command):
diff --git a/alot/completion.py b/alot/completion.py
index a0a76a9b..d916b6b0 100644
--- a/alot/completion.py
+++ b/alot/completion.py
@@ -126,7 +126,7 @@ class QueryCompleter(Completer):
mypos - cmdlen)
else:
localres = self._tagcompleter.complete(mypart[cmdlen:],
- mypos - cmdlen)
+ mypos - cmdlen)
resultlist = []
for ltxt, lpos in localres:
newtext = original[:start] + cmd + ':' + ltxt + original[end:]
@@ -240,7 +240,7 @@ class ArgparseOptionCompleter(Completer):
if optionstring.startswith(pref):
# append '=' for options that await a string value
if isinstance(act, argparse._StoreAction) or\
- isinstance(act, BooleanAction):
+ isinstance(act, BooleanAction):
optionstring += '='
res.append(optionstring)
@@ -372,8 +372,9 @@ class CommandLineCompleter(Completer):
def f((completed, pos)):
return ('%s %s' % (header, completed),
pos + len(header) + 1)
- res = map(f, self._contactscompleter.complete(params,
- localpos))
+ res = map(f,
+ self._contactscompleter.complete(params,
+ localpos))
elif self.mode == 'envelope' and cmd == 'unset':
plist = params.split(' ', 1)
if len(plist) == 1: # complete from header keys
diff --git a/alot/db/envelope.py b/alot/db/envelope.py
index d8cf9faf..041b26d6 100644
--- a/alot/db/envelope.py
+++ b/alot/db/envelope.py
@@ -26,7 +26,7 @@ from utils import encode_header
class Envelope(object):
"""a message that is not yet sent and still editable"""
def __init__(self, template=None, bodytext=u'', headers={}, attachments=[],
- sign=False, sign_key=None, encrypt=False):
+ sign=False, sign_key=None, encrypt=False):
"""
:param template: if not None, the envelope will be initialised by
:meth:`parsing <parse_template>` this string before
@@ -48,7 +48,7 @@ class Envelope(object):
self.parse_template(template)
logging.debug('PARSED TEMPLATE: %s' % template)
logging.debug('BODY: %s' % self.body)
- if self.body == None:
+ if self.body is None:
self.body = bodytext
self.headers.update(headers)
self.attachments = list(attachments)
@@ -57,7 +57,7 @@ class Envelope(object):
self.encrypt = encrypt
self.sent_time = None
self.modified_since_sent = False
- self.sending = False # used as semaphore to avoid accidental double sendout
+ self.sending = False # semaphore to avoid accidental double sendout
def __str__(self):
return "Envelope (%s)\n%s" % (self.headers, self.body)
@@ -147,7 +147,7 @@ class Envelope(object):
# Build body text part. To properly sign/encrypt messages later on, we
# convert the text to its canonical format (as per RFC 2015).
canonical_format = self.body.encode('utf-8')
- canonical_format = canonical_format.replace('\\t', ' '*4)
+ canonical_format = canonical_format.replace('\\t', ' ' * 4)
textpart = MIMEText(canonical_format, 'plain', 'utf-8')
# wrap it in a multipart container if necessary
@@ -166,31 +166,32 @@ class Envelope(object):
try:
signatures, signature_str = crypto.detached_signature_for(
- plaintext, self.sign_key)
+ plaintext, self.sign_key)
if len(signatures) != 1:
raise GPGProblem(("Could not sign message "
- "(GPGME did not return a signature)"))
+ "(GPGME did not return a signature)"))
except gpgme.GpgmeError as e:
if e.code == gpgme.ERR_BAD_PASSPHRASE:
# If GPG_AGENT_INFO is unset or empty, the user just does
# not have gpg-agent running (properly).
if os.environ.get('GPG_AGENT_INFO', '').strip() == '':
- raise GPGProblem(("Bad passphrase and "
- "GPG_AGENT_INFO not set. Please setup "
- "gpg-agent."))
+ msg = "Got invalid passphrase and GPG_AGENT_INFO\
+ not set. Please set up gpg-agent."
+ raise GPGProblem(msg)
else:
raise GPGProblem(("Bad passphrase. Is "
- "gpg-agent running?"))
+ "gpg-agent running?"))
raise GPGProblem(str(e))
micalg = crypto.RFC3156_micalg_from_algo(signatures[0].hash_algo)
outer_msg = MIMEMultipart('signed', micalg=micalg,
- protocol='application/pgp-signature')
+ protocol='application/pgp-signature')
# wrap signature in MIMEcontainter
+ stype = 'pgp-signature; name="signature.asc"'
signature_mime = MIMEApplication(_data=signature_str,
- _subtype='pgp-signature; name="signature.asc"',
- _encoder=encode_7or8bit)
+ _subtype=stype,
+ _encoder=encode_7or8bit)
signature_mime['Content-Description'] = 'signature'
signature_mime.set_charset('us-ascii')
diff --git a/alot/db/errors.py b/alot/db/errors.py
index 904ddbad..55eb05ef 100644
--- a/alot/db/errors.py
+++ b/alot/db/errors.py
@@ -1,6 +1,8 @@
# Copyright (C) 2011-2012 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 DatabaseError(Exception):
pass
@@ -18,4 +20,3 @@ class DatabaseLockedError(DatabaseError):
class NonexistantObjectError(DatabaseError):
"""requested thread or message does not exist in the index"""
pass
-
diff --git a/alot/defaults/default.bindings b/alot/defaults/default.bindings
index 3ccb3e2b..1eddd7b0 100644
--- a/alot/defaults/default.bindings
+++ b/alot/defaults/default.bindings
@@ -1,3 +1,9 @@
+###########################################################################
+# Default Key Bindings #
+# #
+# for alot. © 2012 Patrick Totzke, GNU GPL3+ https://github.com/pazz/alot #
+###########################################################################
+
up = move up
down = move down
page up = move page up
diff --git a/alot/defaults/default.theme b/alot/defaults/default.theme
index 3d187786..56773288 100644
--- a/alot/defaults/default.theme
+++ b/alot/defaults/default.theme
@@ -1,3 +1,9 @@
+############################################################################
+# Default Theme #
+# #
+# for alot. © 2012 Patrick Totzke, GNU GPL3+, https://github.com/pazz/alot #
+############################################################################
+
[global]
footer = 'standout','','white,bold','dark blue','white,bold','#006'
body = 'default','','dark gray','default','g58','default'
diff --git a/alot/settings/manager.py b/alot/settings/manager.py
index 24d648e2..1d38ef82 100644
--- a/alot/settings/manager.py
+++ b/alot/settings/manager.py
@@ -81,8 +81,9 @@ class SettingsManager(object):
if themes_dir:
themes_dir = os.path.expanduser(themes_dir)
else:
- themes_dir = os.path.join(os.environ.get('XDG_CONFIG_HOME',
- os.path.expanduser('~/.config')), 'alot', 'themes')
+ configdir = os.environ.get('XDG_CONFIG_HOME',
+ os.path.expanduser('~/.config'))
+ themes_dir = os.path.join(configdir, 'alot', 'themes')
logging.debug(themes_dir)
if themestring:
diff --git a/alot/settings/utils.py b/alot/settings/utils.py
index 2647bb75..c3dbf3b0 100644
--- a/alot/settings/utils.py
+++ b/alot/settings/utils.py
@@ -41,7 +41,6 @@ def read_config(configpath=None, specpath=None, checks={}):
except ConfigObjError as e:
raise ConfigError(e.message)
-
if results != True:
error_msg = ''
for (section_list, key, res) in flatten_errors(config, results):
diff --git a/alot/ui.py b/alot/ui.py
index e84db7a5..cb9f16d2 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -143,9 +143,9 @@ class UI(object):
def _unhandeled_input(self, key):
"""
- Called by :class:`urwid.MainLoop` if a keypress was passed to the root widget by
- `self._input_filter` but is not handled in any widget.
- We keep it for debuging purposes.
+ Called by :class:`urwid.MainLoop` if a keypress was passed to the root
+ widget by `self._input_filter` but is not handled in any widget. We
+ keep it for debuging purposes.
"""
logging.debug('unhandled input: %s' % key)