diff options
Diffstat (limited to 'slime-0.11/ui_config.py')
-rw-r--r-- | slime-0.11/ui_config.py | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/slime-0.11/ui_config.py b/slime-0.11/ui_config.py new file mode 100644 index 0000000..f184797 --- /dev/null +++ b/slime-0.11/ui_config.py @@ -0,0 +1,103 @@ +import os +from Config import * +from ConfigEditor import * + +config_file = "~/.slime/config" + +config_vars = { + +"count-width": (CONFIG_INTEGER, 3, "Width for message count in folder list"), + +"from-address": (CONFIG_STRING, "", "User's address (automatic, if empty)"), +"reply-to": (CONFIG_STRING, "", "Default Reply-To"), +"fcc-folder": (CONFIG_STRING, "", + "Folder to store copy of sent mail (no copy, if empty)"), +"signature-file": (CONFIG_STRING, "~/.signature", "Signature file"), + +"make-pgp-signatures": (CONFIG_BOOLEAN, 0, "Make PGP signatures?"), +"check-pgp-signatures": (CONFIG_BOOLEAN, 0, "Check PGP signatures?"), +"pgp-path": (CONFIG_STRING, "/usr/bin/pgp", "PGP command (full path)"), +"pgp-username": (CONFIG_STRING, "", "PGP username"), +"pgp-max-password-age": (CONFIG_INTEGER, 60, + "Time (in minutes) to remember PGP passphrase"), + +"smtp-server": (CONFIG_STRING, "localhost", "SMTP server"), +"max-references-length": (CONFIG_INTEGER, 500, + "Max length for References header"), +"external-editor": (CONFIG_STRING, "", "External editor"), + +"normal-font": (CONFIG_STRING, "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1", + "Normal font"), +"unread-font": (CONFIG_STRING, "-misc-fixed-bold-r-semicondensed--13-120-75-75-c-60-iso8859-1", + "Unread font"), +"command-font": (CONFIG_STRING, "-misc-fixed-medium-r-normal--10-*-*-*-*-*-iso8859-1", + "Command button font"), +"max-subject-indent": (CONFIG_INTEGER, 4, + "Max subject indentation"), +"max-folder-indent": (CONFIG_INTEGER, 2, + "Max folder indentation"), +"important-headers": (CONFIG_STRING, "From To Cc Date Subject", + "Headers shown normally"), + +"inbox-scan-frequency": (CONFIG_INTEGER, 1, + "Frequency of new message scan (minutes)"), + +} + +config_layout = [ + ["Mail sending", + "from-address", + "reply-to", + "smtp-server", + "max-references-length", + "fcc-folder", + "external-editor", + "signature-file", + ], + ["PGP", + "make-pgp-signatures", + "check-pgp-signatures", + "pgp-path", + "pgp-username", + "pgp-max-password-age", + ], + ["Appearance", + "normal-font", + "unread-font", + "max-subject-indent", + "max-folder-indent", + "important-headers", + "count-width", + ], + ["Misc", + "inbox-scan-frequency", + ], +] + +config = Config(config_vars) + +def edit_config(): + global config, config_layout + ConfigEditor(config, config_layout) + +def load_config(): + p = os.path.expanduser(config_file) + if os.path.isfile(p): + f = open(p, "r") + config.read(f) + f.close() + +def save_config(): + p = os.path.expanduser(config_file) + if os.path.isfile(p): + pnew = p + ".new" + fp = open(p, "r") + fpnew = open(pnew, "w") + config.rewrite(fp, fpnew) + fp.close() + fpnew.close() + os.rename(p + ".new", p) + else: + f = open(p, "w") + config.write(f) + f.close() |