Commit graph

152 commits

Author SHA1 Message Date
Tobias Witek
affeba5b8f [core/theme] Add simple theme stub
Add support for default fg/bg colors
2020-02-15 14:05:27 +01:00
Tobias Witek
5d971267db [core/theme] Add preparatory work for themes
Add two new parameters: theme and iconset

Add a placeholder class core.theme.Theme, an instance of which is passed
in to the i3 output object (which is the only object that should ever
have need of the theme, hopefully).
2020-02-09 13:46:56 +01:00
Tobias Witek
4e2a645bd3 [core/input] Separate module/widget update and retrieval
To make it easier to update individual modules, separate the call to
update() and the call to actually drawing the status.

Additionally, this avoids the "side effect" of updating when drawing the
status line.
2020-02-09 13:25:34 +01:00
Tobias Witek
cc0139e517 [tests/input] Add test for non-callable callback 2020-02-08 14:09:14 +01:00
Tobias Witek
fca364554e [core/output] Add id of widget and module to output
In the process of that, fix a bug in how the parent class constructors
were invoked.
2020-02-08 13:45:52 +01:00
Tobias Witek
9d4936b596 [util/cli] Add new CLI utilities
For now, this just allows executing commands
2020-02-08 13:39:35 +01:00
Tobias Witek
e0df8b84e5 [core] Add input handling
Add a (half-finished) input library, that for now simply allows
registration and triggering of events.

As next steps, the trigger will happen as part of a separate thread that
reads input events.

Additionally, invoking commands via a execute() will be supported.

Thirdly, there is need of a way to selectively update the affected
modules (widgets), which should be possible given that the event
contains both the instance (widget ID) and name (module name).
2020-02-07 21:28:29 +01:00
Tobias Witek
6adc497f68 [core] Add support for module parameters
Parse '-p' parameters and make them accessible via 'parameter()' from
within a module (basically, restore the previous configuration
facility).

Still TODO: Add support for configuration files.
2020-02-04 21:09:11 +01:00
Tobias Witek
3a531c359f [core/module] Add config to module
Add access for all modules to the commandline parameters (called
"config" in bumblebee-status)
2020-02-03 21:30:06 +01:00
Tobias Witek
854d7dc470 [modules] Add first "real" module: kernel
Since 'kernel' is small and shows static information, have this be the
very first module added.
2020-02-02 14:41:22 +01:00
Tobias Witek
445c5a65f1 [core/output] Move widget/module handling inside output
The core.output module now manages the list of modules and retrieves the
widgets inside draw() itself. That way, details of drawing/updating
widgets are not visible from the outside anymore.
2020-02-02 14:18:13 +01:00
Tobias Witek
66537fbe05 [core/output] Rewrite to hide sys.stout
Add generic "draw()" method that redirects internally to the actual
calls. These can now produce JSON, which is nicer because:

1. Easier to use during testing
2. More flexible
3. Centralizes printing (somewhat)

Still, the "suffix" concept isn't really nice, but so far, I have no
better approach.
2020-02-01 21:37:38 +01:00
Tobias Witek
fbd44618dc [test] Python 3.5 compatibility
Use assert_called_once_with() instead of assert_called_once() to
maintain compatibility with Python 3.5
2020-01-26 14:17:14 +01:00
Tobias Witek
7a9cb8b533 [core/module] Add very basic widget capability 2020-01-26 14:06:09 +01:00
Tobias Witek
fee7cf7882 [core/widget] Add widget class
To maintain backwards compatibility (and because I think it's an OK
design choice), keep the widget concept (a single module can produce
multiple widgets).
2020-01-26 13:58:29 +01:00
Tobias Witek
acf9d6214e [tests] Restructure
Put tests into directory structure equivalent to that of the code
itself, for better separation (hopefully)
2020-01-25 14:27:41 +01:00
Tobias Witek
5a60a23ebd [core/config] Add interval (as parameter store)
Add a generic parameter store to the configuration and use it to set the
parameter "interval" (backwards compatibility)
2020-01-25 14:24:21 +01:00
Tobias Witek
8a2ef5ea5d [core] Add util.store for store-like get/set 2020-01-25 14:20:25 +01:00
Tobias Witek
bd12a51bfb [core] Add simple module loading
Add a way to load modules located in modules/*
2020-01-19 16:06:21 +01:00
Tobias Witek
8622673114 [core] Re-enable preliminary module loading (stubbed)
Add logic for parsing commandline options, and a preliminary stub for
loading modules.

Note: The idea is that core.module.load() will return a valid, but
empty, module that displays an error, if the module cannot be loaded
2020-01-19 15:36:52 +01:00
Tobias Witek
e931bb93c6 [core] Rework core implementation
Experimental re-implementation of core functionality with the aim:
- Depend only on the Python Standard Library for core
- If modules are missing elsewhere, *never* throw
- Unit test *everything*
- Cleaner and more minimal implementation
- Better integration points for existing implementations (charts,
  braille, etc.)
- Full backwards-compatibility with existing module system (except where
  modules can be vastly simplified)
2020-01-19 13:29:34 +01:00
me
d952661b28 add tests with custom format for bumblebee.util.bytefmt() 2020-01-12 20:33:51 +02:00
me
c45c5134a7 add txtbars 2020-01-01 22:22:31 +02:00
Tobias Witek
c4cf1da337 [tests] Fix failing tests
* better checks for "brightness" modules
* add mocking for output config
2019-12-26 13:56:53 +01:00
user
d4946f2c13 hddtemp module 2019-12-25 03:12:06 +02:00
Tobias Witek
f80fcfa60c [tests] Remove test about listing modules
If an import fails, this test fails, which is not the original
intention.

Until such time that the listing of existing modules is fixed, this test
is removed.

fixes #491
2019-12-23 13:35:05 +01:00
Tobias Witek
14813f5fee [tests] improve output
see #491
2019-12-22 14:25:00 +01:00
Tobias Witek
2305ce4622 [tests] Remove generic test_modules
This module doesn't *really* perform tests and causes more trouble than
it is worth at the moment.

see #456 and #457 for reasons why the tests need to be overhauled a bit
anyhow.
2019-10-27 20:25:57 +01:00
WORD559
fb2fb796da add test for asbool 2019-10-04 15:18:11 +01:00
mw
ac418caa59 Add test cases 2019-09-05 20:19:20 +02:00
Tobias Witek
5ee612da2d [doc] Add screenshot for network_traffic
Add http status module

fix

chore: update modules number
2019-07-24 12:37:59 +02:00
Tobias Witek
682d2f47dd [core/theme] State == "" causes backtraces
Empty states ("" rather than None) caused a backtrace in the theme
engine. Fix that by being a bit more robust, and add a test that checks
for regressions.

fixes #406
2019-07-02 20:19:26 +02:00
Tobias Witek
928c37a972 [core+tests] Improved poll handling
- mock poll instead of epoll
- increase timeout for poll (1ms is a lot of system load for nothing)
2019-06-23 16:51:28 +02:00
Frank Scherrer
a6eb5a43a5
fix code for flake8 linter 2018-09-04 10:04:18 +02:00
Frank Scherrer
a52c3e8e12
add further tests for which
* test which for always present binary "ls"
* test which for garbage input
2018-09-04 09:58:52 +02:00
Frank Scherrer
872c2047e5
add test for util.which
* and make runtests.sh dash-compatible for debian-like OS
2018-08-28 14:52:17 +02:00
Tobias Witek
be8669270e [tests] Removed memory test, as psutil is not used anymore
mocking psutil doesn't bring much to the table now...
2017-09-20 06:28:47 +02:00
Tobias Witek
115f03cb0f [module/battery] Add remaining time, if available
Add remaining time directly to widget, if available, and if not on
charge.

see #146
2017-07-26 16:41:30 +02:00
Frederic Junod
37434aa5e5 [module/memory] Add new format string parameter 2017-07-15 09:48:23 +02:00
Tobias Witek
e5061b4d5f [tests/brightness] Disable failing test
Honestly: I don't know why Travis is failing on this test, it works fine
on my machine with Python 2.7. Therefore, I will disable this test until
I can get to the bottom of it.
2017-06-26 20:42:33 +02:00
Tobias Witek
fd7c5f6f0b [tests/brightness] Create open call, if it does not exist
Hopefully, this fixes the failing Travis build.
2017-06-26 20:33:06 +02:00
Tobias Witek
d37218ce4a [tests/brightness] Fix FileNotFoundError for Python 2.7 2017-06-26 19:10:51 +02:00
jmg5e
fc912a8fbc fixed tests for brightness module 2017-06-26 06:07:19 -05:00
Tobias Witek
d69f13f0b4 [modules/battery] Autodetect battery devices
The module now creates a widget for each battery device it detects and
shows the status for each of them (I don't know of anyone with more than
a single battery, but if I'm overhauling the module anyhow, might as
well do it comprehensively).

fixes #117
2017-06-18 11:35:06 +02:00
Tobias Witek
c7e2f39132 [tests/cpu] Fix expectation for CPU module output 2017-06-15 14:06:45 +02:00
Tobias Witek
c75ad75920 [tests/module/disk] Adapt to new input parameters
Open application now defaults to xdg-open, replace with nautilus
manually.
2017-06-01 19:57:50 +02:00
Tobias Witek
94c72a1e6a [tests] Fix failing test for i3bar protocol 2017-04-26 07:50:27 +02:00
Tobias Witek
59fc835b88 [tests] Fix broken cmus test
Adding scrollable output broke the cmus test.
2017-04-22 13:17:09 +02:00
Tobias Witek
0f34826cac [tests] Fix broken tests caused by new theme methods
Add "minwidth()" and "align()" mocks for i3bar output tests.
2017-04-22 13:14:52 +02:00
Tobi-wan Kenobi
bb2ed63528 [test/disk] Fix unit test for disk module 2017-03-10 08:26:33 +01:00