docs
This commit is contained in:
parent
72f7b3acf1
commit
317d96b176
@ -2,7 +2,7 @@ Configuration
|
|||||||
=============
|
=============
|
||||||
|
|
||||||
The configuration file is a normal Python script. The status bar is controlled by a central
|
The configuration file is a normal Python script. The status bar is controlled by a central
|
||||||
status object, which individual *modules* like a :py:mod:`.clock` or a :py:mod:`.battery`
|
:py:class:`.Status` object, which individual *modules* like a :py:mod:`.clock` or a :py:mod:`.battery`
|
||||||
monitor are added to with the ``register`` method.
|
monitor are added to with the ``register`` method.
|
||||||
|
|
||||||
A typical configuration file could look like this (note the additional
|
A typical configuration file could look like this (note the additional
|
||||||
|
@ -15,8 +15,9 @@ decimal dot
|
|||||||
formatp
|
formatp
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Some modules use an extended format string syntax (the mpd module, for example).
|
Some modules use an extended format string syntax (the :py:mod:`.mpd`
|
||||||
Given the format string below the output adapts itself to the available data.
|
module, for example). Given the format string below the output adapts
|
||||||
|
itself to the available data.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
@ -33,14 +34,14 @@ Inside a group always all format specifiers must evaluate to true (logical and).
|
|||||||
You can nest groups. The inner group will only become part of the output if both
|
You can nest groups. The inner group will only become part of the output if both
|
||||||
the outer group and the inner group are eligible for output.
|
the outer group and the inner group are eligible for output.
|
||||||
|
|
||||||
|
|
||||||
.. _TimeWrapper:
|
.. _TimeWrapper:
|
||||||
|
|
||||||
TimeWrapper
|
TimeWrapper
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Some modules that output times use TimeWrapper to format these. TimeWrapper is
|
Some modules that output times use :py:class:`.TimeWrapper` to format
|
||||||
a mere extension of the standard formatting method.
|
these. TimeWrapper is a mere extension of the standard formatting
|
||||||
|
method.
|
||||||
|
|
||||||
The time format that should be used is specified using the format specifier, i.e.
|
The time format that should be used is specified using the format specifier, i.e.
|
||||||
with some_time being 3951 seconds a format string like ``{some_time:%h:%m:%s}``
|
with some_time being 3951 seconds a format string like ``{some_time:%h:%m:%s}``
|
||||||
|
@ -8,14 +8,13 @@ updates it's info periodically, like checking for a network link or
|
|||||||
displaying the status of some service, then we have prepared common
|
displaying the status of some service, then we have prepared common
|
||||||
tools for this which make this even easier:
|
tools for this which make this even easier:
|
||||||
|
|
||||||
- Common base classes: :py:class:`i3pystatus.core.modules.Module` for
|
- Common base classes: :py:class:`.Module` for everything and
|
||||||
everything and :py:class:`i3pystatus.core.modules.IntervalModule`
|
:py:class:`.IntervalModule` specifically for the aforementioned
|
||||||
specifically for the aforementioned usecase of updating stuff
|
usecase of updating stuff periodically.
|
||||||
periodically.
|
|
||||||
- Settings (already built into above classes) allow you to easily
|
- Settings (already built into above classes) allow you to easily
|
||||||
specify user-modifiable attributes of your class for configuration.
|
specify user-modifiable attributes of your class for configuration.
|
||||||
|
|
||||||
See :py:class:`i3pystatus.core.settings.SettingsBase` for details.
|
See :py:class:`.SettingsBase` for details.
|
||||||
- For modules that require credentials, it is recommended to add a
|
- For modules that require credentials, it is recommended to add a
|
||||||
keyring_backend setting to allow users to specify their own backends
|
keyring_backend setting to allow users to specify their own backends
|
||||||
for retrieving sensitive credentials.
|
for retrieving sensitive credentials.
|
||||||
@ -36,7 +35,7 @@ reStructuredText description for your module in the README file.
|
|||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
:py:class:`i3pystatus.core.settings.SettingsBase` for a detailed description of the settings system
|
:py:class:`.SettingsBase` for a detailed description of the settings system
|
||||||
|
|
||||||
Handling Dependencies
|
Handling Dependencies
|
||||||
---------------------
|
---------------------
|
||||||
|
@ -57,7 +57,15 @@ class Status:
|
|||||||
self.io = io.IOHandler(input_stream)
|
self.io = io.IOHandler(input_stream)
|
||||||
|
|
||||||
def register(self, module, *args, **kwargs):
|
def register(self, module, *args, **kwargs):
|
||||||
"""Register a new module."""
|
"""
|
||||||
|
Register a new module.
|
||||||
|
|
||||||
|
:param module: Either a string module name, or a module class,
|
||||||
|
or a module instance (in which case args and kwargs are
|
||||||
|
invalid).
|
||||||
|
:param kwargs: Settings for the module.
|
||||||
|
:returns: module instance
|
||||||
|
"""
|
||||||
from i3pystatus.text import Text
|
from i3pystatus.text import Text
|
||||||
|
|
||||||
if not module:
|
if not module:
|
||||||
@ -81,6 +89,9 @@ class Status:
|
|||||||
text=configuration_error.message))
|
text=configuration_error.message))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
"""
|
||||||
|
Run main loop.
|
||||||
|
"""
|
||||||
if self.click_events:
|
if self.click_events:
|
||||||
self.command_endpoint.start()
|
self.command_endpoint.start()
|
||||||
for j in io.JSONIO(self.io).read():
|
for j in io.JSONIO(self.io).read():
|
||||||
|
Loading…
Reference in New Issue
Block a user