Merge branch 'facetoe-mail'

This commit is contained in:
enkore 2014-10-12 16:51:33 +02:00
commit dcbb73db4a
2 changed files with 20 additions and 14 deletions

View File

@ -52,9 +52,10 @@ def process_docstring(app, what, name, obj, options, lines):
if self.default is self.empty: if self.default is self.empty:
attrs.append("default: *empty*") attrs.append("default: *empty*")
formatted = "* **{name}** {doc}".format(name=self.name, doc=self.doc) formatted = "* **{name}** {attrsf} {doc}".format(
if attrs: name=self.name,
formatted += " ({attrs})".format(attrs=", ".join(attrs)) doc=" " + self.doc if self.doc else "",
attrsf=" ({attrs})".format(attrs=", ".join(attrs)) if attrs else "")
return formatted return formatted
@ -65,13 +66,15 @@ def process_docstring(app, what, name, obj, options, lines):
for setting in obj.settings: for setting in obj.settings:
lines.append(str(Setting(obj, setting))) lines.append(str(Setting(obj, setting)))
lines.append("")
def process_signature(app, what, name, obj, options, signature, return_annotation): def process_signature(app, what, name, obj, options, signature, return_annotation):
if is_module(obj): if is_module(obj):
return ("", return_annotation) return ("", return_annotation)
def get_modules(path): def get_modules(path, name):
modules = [] modules = []
for finder, modname, is_package in pkgutil.iter_modules(path): for finder, modname, is_package in pkgutil.iter_modules(path):
if modname not in IGNORE_MODULES: if modname not in IGNORE_MODULES:
@ -84,12 +87,12 @@ def get_module(finder, modname):
return (modname, finder.find_loader(fullname)[0].load_module(fullname)) return (modname, finder.find_loader(fullname)[0].load_module(fullname))
def get_all(module_path, basecls): def get_all(module_path, modname, basecls):
mods = [] mods = []
finder = ClassFinder(basecls) finder = ClassFinder(basecls)
for name, module in get_modules(module_path): for name, module in get_modules(module_path, modname):
classes = finder.get_matching_classes(module) classes = finder.get_matching_classes(module)
found = [] found = []
for cls in classes: for cls in classes:
@ -100,8 +103,8 @@ def get_all(module_path, basecls):
return sorted(mods, key=lambda module: module[0]) return sorted(mods, key=lambda module: module[0])
def generate_automodules(path, basecls): def generate_automodules(path, name, basecls):
modules = get_all(path, basecls) modules = get_all(path, name, basecls)
contents = [] contents = []
@ -133,7 +136,7 @@ class AutogenDirective(Directive):
for e in self.content: for e in self.content:
contents.append(e) contents.append(e)
contents.append("") contents.append("")
contents.extend(generate_automodules(modpath, basecls)) contents.extend(generate_automodules(modpath, modname, basecls))
node = paragraph() node = paragraph()
self.state.nested_parse(StringList(contents), 0, node) self.state.nested_parse(StringList(contents), 0, node)

View File

@ -17,16 +17,19 @@ class Mail(IntervalModule):
""" """
Generic mail checker Generic mail checker
The `backends` setting determines the backends to use. For available backends see :ref:`mailbackends` The `backends` setting determines the backends to use. For available backends see :ref:`mailbackends`.
""" """
_endstring = """!!i3pystatus.mail!!"""
settings = ( settings = (
("backends", "List of backends (instances of ``i3pystatus.mail.xxx.zzz``, i.e. ``i3pystatus.mail.imap.IMAP``)"), ("backends", "List of backends (instances of ``i3pystatus.mail.xxx.zzz``, e.g. :py:class:`.imap.IMAP`)"),
"color", "color_unread", "format", "format_plural", "color", "color_unread", "format", "format_plural",
("hide_if_null", "Don't output anything if there are no new mails"), ("hide_if_null", "Don't output anything if there are no new mails"),
("email_client", "The email client to open on left click"), ("email_client", "The command to run on left click. "
"For example, to launch Thunderbird set command_on_click to ``thunderbird``. "
"Alternatively, to bring Thunderbird into focus, "
"set command_on_click to ``i3-msg -q [class=\"^Thunderbird$\"] focus``. "
"Hint: To discover the X window class of your email client run 'xprop | grep -i class' "
"and click on it's window\n"),
) )
required = ("backends",) required = ("backends",)