From a5915a0999a031efab86df9494e1e368872afca1 Mon Sep 17 00:00:00 2001 From: facetoe Date: Sun, 12 Oct 2014 21:50:52 +0800 Subject: [PATCH 1/3] Document how to switch focus to mail client on left click. --- i3pystatus/mail/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/i3pystatus/mail/__init__.py b/i3pystatus/mail/__init__.py index c028e39..c44ec1c 100644 --- a/i3pystatus/mail/__init__.py +++ b/i3pystatus/mail/__init__.py @@ -17,6 +17,8 @@ class Mail(IntervalModule): """ Generic mail checker + + The `backends` setting determines the backends to use. For available backends see :ref:`mailbackends` """ @@ -26,7 +28,12 @@ class Mail(IntervalModule): ("backends", "List of backends (instances of ``i3pystatus.mail.xxx.zzz``, i.e. ``i3pystatus.mail.imap.IMAP``)"), "color", "color_unread", "format", "format_plural", ("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'), ) required = ("backends",) From d481b62c44e61a9db823a4cc86cecbe11cb2d41f Mon Sep 17 00:00:00 2001 From: enkore Date: Sun, 12 Oct 2014 14:42:12 +0200 Subject: [PATCH 2/3] .... --- docs/i3pystatus.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/i3pystatus.rst b/docs/i3pystatus.rst index b38774e..ec24356 100644 --- a/docs/i3pystatus.rst +++ b/docs/i3pystatus.rst @@ -4,11 +4,11 @@ Module reference .. Don't list *every* module here, e.g. cpu-usage suffices, because the other variants are listed below that one. -:System: `clock`_ - `disk`_ - `load`_ - `mem`_ - `cpu-usage`_ +:System: `clock`_ - `disk`_ - `load`_ - `mem`_ - `cpu_usage`_ :Audio: `alsa`_ - `pulseaudio`_ :Hardware: `battery`_ - `backlight`_ - `temp`_ :Network: `network`_ - `wireless`_ -:Music: `now-playing`_ - `mpd`_ +:Music: `now_playing`_ - `mpd`_ :Websites & stuff: `weather`_ - `bitcoin`_ - `reddit`_ - `parcel`_ :Other: `mail`_ - `pyload`_ - `text`_ :Advanced: `file`_ - `regex`_ - `runwatch`_ - `shell`_ From 1fd3b748a59184e87041f105077021695b44e190 Mon Sep 17 00:00:00 2001 From: enkore Date: Sun, 12 Oct 2014 16:50:50 +0200 Subject: [PATCH 3/3] ... --- docs/module_docs.py | 21 ++++++++++++--------- i3pystatus/mail/__init__.py | 20 ++++++++------------ 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/docs/module_docs.py b/docs/module_docs.py index e53a10a..a067f57 100644 --- a/docs/module_docs.py +++ b/docs/module_docs.py @@ -52,9 +52,10 @@ def process_docstring(app, what, name, obj, options, lines): if self.default is self.empty: attrs.append("default: *empty*") - formatted = "* **{name}** – {doc}".format(name=self.name, doc=self.doc) - if attrs: - formatted += " ({attrs})".format(attrs=", ".join(attrs)) + formatted = "* **{name}** {attrsf} {doc}".format( + name=self.name, + doc="– " + self.doc if self.doc else "", + attrsf=" ({attrs})".format(attrs=", ".join(attrs)) if attrs else "") return formatted @@ -65,13 +66,15 @@ def process_docstring(app, what, name, obj, options, lines): for setting in obj.settings: lines.append(str(Setting(obj, setting))) + lines.append("") + def process_signature(app, what, name, obj, options, signature, return_annotation): if is_module(obj): return ("", return_annotation) -def get_modules(path): +def get_modules(path, name): modules = [] for finder, modname, is_package in pkgutil.iter_modules(path): 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)) -def get_all(module_path, basecls): +def get_all(module_path, modname, basecls): mods = [] 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) found = [] for cls in classes: @@ -100,8 +103,8 @@ def get_all(module_path, basecls): return sorted(mods, key=lambda module: module[0]) -def generate_automodules(path, basecls): - modules = get_all(path, basecls) +def generate_automodules(path, name, basecls): + modules = get_all(path, name, basecls) contents = [] @@ -133,7 +136,7 @@ class AutogenDirective(Directive): for e in self.content: contents.append(e) contents.append("") - contents.extend(generate_automodules(modpath, basecls)) + contents.extend(generate_automodules(modpath, modname, basecls)) node = paragraph() self.state.nested_parse(StringList(contents), 0, node) diff --git a/i3pystatus/mail/__init__.py b/i3pystatus/mail/__init__.py index c44ec1c..56f1556 100644 --- a/i3pystatus/mail/__init__.py +++ b/i3pystatus/mail/__init__.py @@ -17,23 +17,19 @@ class Mail(IntervalModule): """ 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 = ( - ("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", ("hide_if_null", "Don't output anything if there are no new mails"), - ("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'), + ("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",)