Commit graph

19 commits

Author SHA1 Message Date
Tobi-wan Kenobi
f33711f49f [core] Pass configuration parameters to modules
User can now use -p <key>=<value> to pass configuration parameters to
modules. For this, the module gets a "parameter()" method. Parameter
keys are in the format <name>.<key> where <name> is the name of the
loaded module. This is either the name of the module itself (e.g. "cpu")
or its alias, if the user specified it, for example:

bumblebee-status -m cpu -p cpu.warning=90

vs.

bumblebee-status -m cpu:test -p test.warning=90

see #23
2016-12-09 08:00:26 +01:00
Tobi-wan Kenobi
64f5fc100e [core/theme] Add prefix/postfix methods
Add a way to specify prefix and postfix strings to the full text of a
widget's text. Currently, the theme does not fill those yet.

see #23
2016-12-08 11:31:20 +01:00
Tobi-wan Kenobi
a7eff64294 [lint] Add tool to run pylint on all files
pylint all *.py files and fix the errors reported so far.
2016-12-04 08:02:40 +01:00
Tobi-wan Kenobi
9a5a6d354a [core/config] Add module aliases
Allow the user to provide aliases when loading a module multiple times
so that the modules can be differentiated (e.g. for passing parameters
to a module).

see #23
2016-12-03 20:54:57 +01:00
Tobi-wan Kenobi
a720baf407 [tests] Add Python3 test run
Add testrun to also verify Python3 functionality.

+ Immediately fix a Python3 incompatibility.

see #23
2016-12-03 20:45:52 +01:00
Tobi-wan Kenobi
a8a6c9bba2 [core] Refactor engine
This is going to be a bit more comprehensive than anticipated. In order
to cleanly refactor the core and the engine, basically start from
scratch with the implementation.

Goals:

* Test coverage
* Maintain backwards compatibility with module interface as much as
  possible (but still make modules easier to code)
* Simplicity

see #23
2016-12-03 20:38:54 +01:00
Tobi-wan Kenobi
20858991b9 [theme] Fix cycling through widget styles
Cycled widget styles (such as the battery charging style) were broken
until now. The reason for this: They maintain state that represents the
current cycle position (i.e. what is the current icon that is being
displayed), but that is done in a way that uses repr() on the widget
object.

Since the widget objects are re-created each time the bar is drawn, this
is a deeply flawed design.

Instead, use the instance() of the widget for now.
2016-12-02 22:35:28 +01:00
Tobi-wan Kenobi
2f3f171ca5 [core] Remove alias from module
Hide alias concept for modules in the engine. That way, the individual
modules never get to know about whether a module has been aliased or
not.

see #23
2016-12-02 18:53:34 +01:00
Tobias Witek
4e0e3ef427 [general] Add Python3 support
* Change some formatting to please python3
* remote pyroute2 dependency, for which I didn't find a python3 module
  in Fedora24

this solves #1
2016-11-05 16:33:35 +01:00
Tobias Witek
caceb6f20f [help] Update and beautify the commandline help output 2016-11-05 16:18:53 +01:00
Tobias Witek
3af8ee771d [general] Refactoring
* remove (hopefully) unnecessary import statements
* make some code a bit more compact
* remove dead code ... again: hopefully so
2016-11-05 15:54:34 +01:00
Tobias Witek
4e648cf009 [modules] Add module-specific configuration
Big oversight in my previous commits: Widgets need to be able to have
specific configurations (i.e. the path for different instances of the
"disk" module has to be different).

To account for that, it is now possible to assign an "alias" to a module
instance using ":" (for example: -m "disk:home"). This alias is then
used for the configuration parameter resolution automatically, for
example:

-m disk:home -p home.path=/home

As a consequence, parameter names in the module code are now relative to
the module, which means: shorter!
2016-11-05 14:26:02 +01:00
Tobias Witek
18d7e1befb [config] Allow parameter passing via commandline
Allow the user to specify arbitrary configuration parameters from the
commandline and evaluate those in the modules (and elsewhere). Re-enable
the CPU module as a first showcase of this functionality.
2016-11-05 12:28:05 +01:00
Tobias Witek
353c47d76e [general] Very minor refactoring 2016-11-05 12:18:30 +01:00
Tobias Witek
2f0cc30c38 [config] Write custom action for printing theme/module details 2016-11-05 12:07:54 +01:00
Tobias Witek
998db40a2d [theme] Re-implement rotation of values for theme entries
Allow theme entries to be lists that are then iterated. For this
purpose, extend the Config class so that it can serve as generic store
for data items. That makes it easy to centralize code used for rotation
etc. in a single place.
2016-11-05 11:57:09 +01:00
Tobias Witek
7f91b8298f [modules] Refactor module initialization
Modules now get an output and a complete config object. This should make
customization much easier in the future.
2016-11-05 08:11:08 +01:00
Tobias Witek
a8b29ed22e [config] Beautify help output a bit 2016-11-05 07:59:58 +01:00
Tobias Witek
a58610f3ee [config] Start refactoring by creating separate config class
Add a class that will hold all configuration and argument information
and serve as central repository for this kind of information.
2016-11-05 07:54:36 +01:00