Commit graph

282 commits

Author SHA1 Message Date
Tobi-wan Kenobi
59fb47ae3b [all] pylint cleanup 2016-12-09 11:57:13 +01:00
Tobi-wan Kenobi
e59e969bdc [core] Refactor -> replace some getter/setter pairs with attributes
Remove some set_* methods and replace them with a simple attribute.

see #23
2016-12-09 11:49:59 +01:00
Tobi-wan Kenobi
068968bbf5 [tests] Refactor by removing getter/setter methods
Instead of having get/set methods for simple attributes, use the
attributes directly.

see #23
2016-12-09 11:42:02 +01:00
Tobi-wan Kenobi
c52cb99518 [core/theme] Add support for foreground and background colors
Themes can now define "fg" and "bg" attributes that are used for
foreground (text) color and background color.

see #23
2016-12-09 09:02:19 +01:00
Tobi-wan Kenobi
0c7884d170 [all] pylint refinements
Improve code by bringing up the pylint score a bit.

see #23
2016-12-09 08:43:14 +01:00
Tobi-wan Kenobi
252260c249 [modules/datetime] Use parameter functionality to get format
Make the format string of the datetime module configurable using the new
parameter() method in the module.

Also, restructured the setting of the config information a bit so that
the parameter() method can be used in the constructor of a module.

see #23
2016-12-09 08:23:53 +01:00
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
c8a51b416f [core] Add "Store" interface
Add an interface that allows arbitrary objects to store/retrieve
arbitrary key/value pairs. This will be used for different purposes in
the future:

* Config class(es) can store user-defined parameters for modules
* Widgets can store state
* ???

see #23
2016-12-09 07:41:07 +01:00
Tobi-wan Kenobi
a7e756e015 [tests] Generic module tests
Add a helper function that lists all existing modules and modify the CPU
module test so that it now generically iterates all available modules
and tests their widgets.

see #23
2016-12-09 07:27:01 +01:00
Tobi-wan Kenobi
f40418475f [modules/datetime] Re-enable datetime module
Add datetime module + aliases date and time.

see #23
2016-12-09 07:11:23 +01:00
Tobi-wan Kenobi
2fa8d7b778 [core/themes] Add module-specific themes
Allow module-specific theme information to overload "default"
configuration. I.e. it is now possible to have specific prefix or
postfix configurations for different modules. The module name is derived
for each widget from the module (__module__) from which it was
instantiated.

see #23
2016-12-08 12:44:52 +01:00
Tobi-wan Kenobi
562fd85ca2 [core/theme] Add support for icon themes
Allow sub-themes ("iconsets") to be merged into the "main" theme. That
way, effectively, it's possible to define colors and icons in separate
JSON files.

see #23
2016-12-08 12:09:21 +01:00
Tobi-wan Kenobi
394ef61760 [core/theme] Add support for default -> prefix/suffix in themes
Themes can now define default prefix and suffix strings.

see #23
2016-12-08 11:52:47 +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
e6666becb3 [tests/theme] Refactor 2016-12-08 10:17:25 +01:00
Tobi-wan Kenobi
2399cf9af1 [core/themes] Add theme loading
Load a theme from a JSON file.
2016-12-08 09:44:05 +01:00
Tobi-wan Kenobi
f645203579 [core] Widget creation/update overhaul
Until now, widgets were re-created during each iteration. For multiple,
reasons, using static widget objects is much easier, so instead of
creating new widgets continuously, modules now create the widgets during
instantiation and get the list of widgets passed as parameter whenever
an update occurs. During the update, they can still manipulate the
widget list by removing and adding elements as needed.

Advantages:
* Less memory fragmentation (fewer (de)allocations)
* Easier event management (widgets now have static IDs)
* Easier module code (widget contents can simply be the result of a
  callback)

see #23
2016-12-08 08:44:54 +01:00
Tobi-wan Kenobi
60ae92c8e3 [core/themes] Prepare adding of themeing support
* Add framework JSON definition for themes
* Add framework test module
* Add framework module

see #23
2016-12-04 18:10:04 +01:00
Tobi-wan Kenobi
aacc56a4e2 [modules/cpu] Add initial version of CPU utilization module
Re-enable the CPU utilization module as proof-of-concept for the new
core engine.

see #23
2016-12-04 17:45:42 +01:00
Tobi-wan Kenobi
8855f1155b [core/errors] Add custom exceptions
Add custom exceptions and add error handling to the engine's module
loading logic. I.e. when a non-existent module is loaded, an exception
is thrown now.

see #23
2016-12-04 16:23:44 +01:00
Tobi-wan Kenobi
b6eb3ee8e6 [output/i3bar] Add flush method
flush() terminates a single iteration of widget drawing.

see #23
2016-12-04 16:14:43 +01:00
Tobi-wan Kenobi
712d958e18 [core/output] Add widget drawing
Add basic drawing of widgets. Each module instance returns a list of
widgets using the widgets() method which is then forwarded to the draw()
method of the configured output.

see #23
2016-12-04 12:53:18 +01:00
Tobi-wan Kenobi
6f52825ef0 [core/output] Add initial version of i3bar output
Add output handler for i3bar protocol and add some tests for it. Right
now, it only support start and end.

see #23
2016-12-04 12:26:20 +01:00
Tobi-wan Kenobi
a2c6214baa [core/engine] Add module loading logic
Allow the engine to load modules from the bumblebee/modules/ directory.

see #23
2016-12-04 11:09:10 +01:00
Tobi-wan Kenobi
cf1693548b [engine] Add initial version of event loop engine
Re-add the engine that is responsible for tying together input, output,
etc.

see #23
2016-12-04 08:37:56 +01:00
Tobi-wan Kenobi
e5201187a2 [tests/config] Small refactoring (renaming) 2016-12-04 08:25:11 +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
Tobias Witek
9c95c0b319 [tests] Added first module tests (for CPU)
I finally *really* need to get started on testing. I've had too many
releases in too short time intervals now, all because of small
bugs/oversights.
2016-11-06 14:30:59 +01:00
Tobias Witek
df27355977 [tests] Add framework for unittests 2016-11-05 07:54:16 +01:00