diff options
author | pazz <patricktotzke@gmail.com> | 2011-06-05 18:52:24 +0100 |
---|---|---|
committer | pazz <patricktotzke@gmail.com> | 2011-06-05 18:52:24 +0100 |
commit | 4b5f0556393f2808d705db35af4c75bf3eb742f9 (patch) | |
tree | 3db22a414651033c86fd440bc291096abd54d73f /alot/settings.py | |
parent | 45b168b08da5e07a7bc0afb14cf952410f38cfd3 (diff) |
config parser
Diffstat (limited to 'alot/settings.py')
-rw-r--r-- | alot/settings.py | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/alot/settings.py b/alot/settings.py index 39ab748d..cb16a298 100644 --- a/alot/settings.py +++ b/alot/settings.py @@ -16,11 +16,29 @@ along with notmuch. If not, see <http://www.gnu.org/licenses/>. Copyright (C) 2011 Patrick Totzke <patricktotzke@gmail.com> """ -editor_cmd = "/usr/bin/vim -f -c 'set filetype=mail' %s" -pager_cmd = "/usr/bin/view -f -c 'set filetype=mail' %s" -terminal_cmd = 'urxvt -T notmuch -e %s' -spawn_editor = True -spawn_pager = True +from ConfigParser import SafeConfigParser + + +class ListConfigParser(SafeConfigParser): + def getstringlist(self, section, option, **kwargs): + value = SafeConfigParser.get(self, section, option, **kwargs) + return [s.strip() for s in value.split(',')] + +DEFAULTS = { + 'editor_cmd': "/usr/bin/vim -f -c 'set filetype=mail' ", + 'pager_cmd': "/usr/bin/view -f -c 'set filetype=mail' ", + 'terminal_cmd': 'urxvt -T notmuch -e', + 'spawn_editor': 'True', + 'spawn_pager': 'True', + 'displayed_headers': 'From,To,Cc,Bcc,Subject', + 'authors_maxlength': '30', +} + +config = ListConfigParser(DEFAULTS) +config.add_section('general') + +def setup(configfilename): + config.read(configfilename) # colour palette. # id, fg16, bg16, mono, fg256, bg256 @@ -58,16 +76,6 @@ palette = [ ('taglist_tag', 'light gray', 'black', '', '', ''), ('taglist_focus', 'white', 'dark gray', '', '#ffa', 'g38'), ] -displayed_headers = [ - 'From', - 'To', - 'Cc', - 'Bcc', - 'Subject', -] - -authors_maxlength = 30 - hooks = { 'pre-shutdown': lambda ui: ui.logger.info('goodbye!'), |