Matthieu Coudron
12546736a6
Fix in documentation
2014-12-20 15:46:34 +01:00
Matthieu Coudron
d31cc380ef
Follow up of https://github.com/enkore/i3pystatus/pull/149#issuecomment-67712619 .
...
This commit removes and replaces all the old methods 'on_*' by settings
with the same name. The old methods were renamed into more explicit names that can be used for the callbacks like "next_song","mute" etc...
For instance, you can test with:
status.register("clock",
format=[
("Format 0",'Europe/London'),
("%a %-d Format 1",'Europe/Dublin'),
"%a %-d %b %X format 2",
("%a %-d %b %X format 3", 'Europe/Paris'),
],
on_leftclick= ["urxvtc"] , # launch urxvtc on left click
on_rightclick= ["scroll_format", 2] , # update format by steps of 2
log_level=logging.DEBUG,
)
This way much code could be removed from other modules, though I did it only for the clock module here.
2014-12-20 15:30:41 +01:00
Matthieu Coudron
98e46ac3d6
Updated alsa & clock modules with new mechanism
2014-12-19 22:04:49 +01:00
Matthieu Coudron
14c0528be5
This commit introduces a skeleton that allows personalized callbacks in
...
a backwards compatible way. Settings 'on_lclick','on_rclick',
'on_scrollup','on_scrolldown' are inherited by all modules.
These parameters should be a string. Then when a matching action is
detected (ie mouseclick, scrolling), the module check if this string
corresponds to a:
1/ python callable
2/ module method,
In cases 1 and 2, it calls the python function with the module as the
first parameter. Otherwise it considers the string is an external command and launches it via run_through_shell
2014-12-19 18:52:15 +01:00
Matthieu Coudron
9e3f128a15
This commit improves the logging system: instead of setting a boolean to enable logging, the user sets a logging level (per module). By default only critical errors are logged (ie nothing for now).
...
Also adds a test for the function run_through_shell
2014-12-18 18:42:58 +01:00
Matthieu Coudron
69c1cd6460
Various pep8 and comments removal + converted shell module to use run_through_shell command
2014-12-18 00:26:24 +01:00
Matthieu Coudron
bc15eb4e6b
i3pystatus creates a logger that can be imported via import i3pystatus.logger . Thus when modules enable the 'enable_log' setting, it should log i3pystatus errors to a file called '.i3pystatus-<pid>'. This commit only solves the case when email_client was called in the email module and would output things into stderr/stdout.
2014-12-17 23:39:10 +01:00
Matthieu Coudron
cb25cb5fb3
Fix error generated by sphinx-build complaining of no end for the list
2014-12-17 18:18:08 +01:00
Matthieu Coudron
f440322b36
Settings will be inherited between modules
2014-12-17 00:48:49 +01:00
enkore
a2bb10443c
mimimi - 1.5.6 doesn't complain about that. interesting.
2014-10-14 17:40:16 +02:00
enkore
9e06145389
PEP 8 (I'm bored): core/util
2014-10-14 16:51:58 +02:00
enkore
b2b34ad81a
PEP 8 (I'm bored): core/modules
2014-10-14 16:50:40 +02:00
enkore
8db7b1d160
PEP 8 (I'm bored): core/io
2014-10-14 16:50:08 +02:00
facetoe
55810e1431
Added method to draw a vertical bar made of Unicode characters.
2014-10-12 12:10:03 +08:00
enkore
9fd557915c
Update util.py
2014-10-11 13:03:04 +02:00
facetoe
d14e7ddadc
Documented dependencies on the PyPI colour module.
2014-10-11 18:54:12 +08:00
facetoe
20363b9da0
Moved color code into it's own class that other classes can inherit
...
from.
2014-10-11 16:02:04 +08:00
facetoe
48821e34ca
Moved get_hex_color_range() from util.py to network_graph.py to prevent
...
breaking the build.
2014-10-11 14:52:08 +08:00
facetoe
3901aa43f1
Added method to generate a list of hex color values between a start
...
color and end color.
2014-10-11 13:17:02 +08:00
facetoe
a77b06a25e
Added method for printing a graph of Unicode characters.
2014-10-06 19:23:32 +08:00
Tom X. Tobin
c8b4dc0466
Fix internet() test function
...
The change in commit 6989713
broke the internet() test function by
trying to access the DNS port of "www.google.de", causing it to always
return False, which in turn broke all modules calling it. We instead use
the actual domain name of Google's DNS server at IP "8.8.8.8".
2014-09-14 17:15:50 -04:00
Matthieu Coudron
000bdc6978
i3 next branch send click events on mouse wheel up/down. This patch allows to change the alsa volume with the mousewheel when hovering the alsa indicator
2014-08-30 00:13:57 +02:00
enkore
6989713d6c
Require working DNS for internet connectivity
...
Relates to #102
2014-08-28 16:13:52 +02:00
enkore
eee14260f4
Alternative exception handling
...
Related #102 #100 and others
2014-08-28 16:11:53 +02:00
enkore
f50e6c1cf7
core Status docs
2014-08-15 14:24:11 +02:00
Arvedui
cee58e495c
prevents start of command_endpoint thread when click_events are disabled
2014-08-15 00:16:50 +02:00
Arvedui
de3db6fb19
added option for disabeling click events
2014-08-15 00:12:18 +02:00
enkore
6de38c933f
Confirmed #74 fixed, close #74
2014-08-04 18:21:16 +02:00
enkore
c0da4fce06
Possible fix for #74
2014-07-26 21:39:52 +02:00
Chris Wood
33aba4b084
Add user_open() function
2014-07-17 00:59:27 -04:00
eBrnd
a5b4ad0b1c
add bar drawing function, and modules for showing cpu and ram usage as a bar
2014-06-14 20:18:12 +02:00
Andrés Martano
29cdbf72b8
Allow round to INT
...
In round_dict, if places is None, round to INT.
2014-05-10 10:40:00 -03:00
enkore
f06a76ad52
PEP8
2014-04-30 14:51:41 +02:00
enkore
4109515914
Some documentation stuff
2014-04-23 14:45:29 +02:00
Łukasz Jędrzejewski
5fe6d049d2
Configurable interval for every IntervalModule
...
settings attribute for every class inheriting from IntervalModule are
automatically extended by interval setting if it does not exist.
A function to flatten settings in SettingsBase was extracted and added
as a static method.
2014-03-10 17:06:40 +01:00
enkore
c43a22c46d
Optimize imports
2013-10-31 22:33:18 +01:00
enkore
cdf9176258
Reformat
2013-10-30 10:46:04 +01:00
enkore
d9e3dec0c2
Catch ConfigError in register()
2013-10-30 10:41:08 +01:00
enkore
1295bf1ec5
exceptions: define format in ABC
2013-10-23 21:52:44 +02:00
enkore
32e68eb14d
Modulelist.get
2013-10-23 21:36:20 +02:00
enkore
467339e905
Remove __repr__ from Module
2013-10-23 21:36:12 +02:00
enkore
b89b8a8145
core.desktop: Refactor into class
...
TODO: find better way to handle Impl
2013-10-23 21:36:05 +02:00
enkore
c33cb3aa60
CommandEndpoint docs
2013-10-23 21:35:50 +02:00
enkore
135915ac96
Remove call_start_hooks and START_HOOKS #27
2013-10-23 21:08:49 +02:00
enkore
2895aa44cf
Refactor run_command_endpoint into class
2013-10-23 21:06:52 +02:00
enkore
266084801d
Delete Module.test() #27
2013-10-23 21:06:31 +02:00
enkore
6d9494acff
Delete config module #27
2013-10-23 21:06:14 +02:00
enkore
3d484694bd
Remove unneeded stuff
2013-10-23 17:16:04 +02:00
enkore
8fe5c77acd
ModuleList: Remove hard dependency on ClassFinder
2013-10-23 17:14:08 +02:00
enkore
2106585d4c
ClassFinder: fixed unexpected behaviour, add tests for this
2013-10-23 17:13:38 +02:00
enkore
4dd0d0b7c3
ClassFinder: fixed missing imports
2013-10-23 17:12:39 +02:00
enkore
5c0d994006
Remove import
2013-10-23 17:04:32 +02:00
enkore
a1c12a3620
id always returns int
2013-10-23 16:56:12 +02:00
enkore
ead0285ecc
Remove trivial & single-usage chain decorator
2013-10-23 16:55:10 +02:00
enkore
5eb271c684
Remove PrefixedKeyDict (unused)
2013-10-23 16:54:51 +02:00
enkore
1de1eaae87
Rename ModuleList.get_by_id to get_module_by_id
2013-10-23 16:54:30 +02:00
enkore
67faff6e0f
Handling ImportError in Status.register() ( #22 )
2013-10-23 09:50:14 +02:00
Jan Oliver Oelerich
55e070f36b
removed import of parse_json
...
caused an error.
2013-10-19 19:12:06 +02:00
enkore
a5dc101a19
Docstring for chain
2013-10-18 19:23:50 +02:00
enkore
26165647e3
Remove unused render_json
2013-10-18 19:23:41 +02:00
enkore
a983a744be
remove some debugging stuff from formatp
2013-10-18 19:23:15 +02:00
enkore
130f103d07
TimeWrapper docs
2013-10-17 23:24:51 +02:00
enkore
eb661a0ebb
More docs
2013-10-17 21:42:52 +02:00
enkore
35a0096974
Some docs
2013-10-17 19:18:35 +02:00
enkore
e788d83255
core.util: Add require and internet
2013-10-17 16:31:26 +02:00
enkore
0d93f165b3
Sphinx warning
2013-10-14 18:51:52 +02:00
enkore
3381959e6b
Sphinx
2013-10-14 17:55:41 +02:00
enkore
78c01dd3e5
PEP8
2013-10-01 15:22:09 +02:00
enkore
72f1c04c57
(PyCharm)
2013-10-01 13:10:48 +02:00
enkore
5184958179
core: remove unreachable code
2013-10-01 13:05:03 +02:00
enkore
ef4db339de
core: add threading module
2013-10-01 13:04:54 +02:00
enkore
7f57950478
core: remove render module
2013-10-01 13:04:47 +02:00
enkore
a3d86e7a44
core: remove threading package
2013-10-01 13:04:00 +02:00
enkore
69b702d2f1
3.24: Introduce time wrapper, remove battery remaining_* formatter(!!!)
2013-08-04 23:40:19 +02:00
enkore
3394aa56ea
Change relative to absolute imports (style)
2013-08-04 17:56:04 +02:00
enkore
ea1cbe9a0c
3.23: Fixed core.util.formatp (also added core.util.flatten for this fix)
2013-08-04 17:25:04 +02:00
enkore
c3441da72e
core.desktop: make dependency python-gobject optional
2013-08-03 14:24:37 +02:00
enkore
d5d0b19330
Add core.util.formatp (this is going to be good)
2013-08-03 03:18:24 +02:00
enkore
42ab76dd3a
Invocation changed
...
-t/--test run test
-c/--config specify config file
2013-07-31 01:31:13 +02:00
enkore
d2f6dd97a5
3.12: Fixed test command
2013-03-23 22:05:46 +01:00
enkore
c5413c4243
Module.move should return self
2013-03-23 22:02:46 +01:00
enkore
c41c2736bf
Adjust to newest i3bar patch
2013-03-21 12:35:28 +01:00
enkore
1171a1d0ae
Change Module.test API to something more intuitive
...
(I mean, what the hell has crossed my mind to name a method *test*
and let it return FALSE if successful? :D)
2013-03-16 12:58:01 +01:00
enkore
0e90cbfceb
Merge branch 'master' of github.com:enkore/i3pystatus
2013-03-16 12:40:21 +01:00
enkore
a6810840ae
Fix core.threading.wrapper
2013-03-16 12:40:09 +01:00
enkore
b662d8797e
Add Module.test
2013-03-16 12:39:17 +01:00
philipdexter
60c475d6e6
Add the option of specifying python-ish negative array indices to the move method
2013-03-15 21:34:45 -04:00
philipdexter
ecb6c54052
Add the ability to change the position of a module in the i3bar
...
Create a method `move' in modules.py to insert the module's json in a different position than the default 0.
2013-03-15 21:20:24 -04:00
enkore
59437c1707
ClassFinder can also instanciate classes now.
2013-03-11 17:08:38 +01:00
enkore
c340b2cf75
Changed Config.test
2013-03-11 00:28:24 +01:00
enkore
a5b274fd23
PEP 8 and stuff
2013-03-11 00:21:54 +01:00
enkore
c259a653ae
Refactor the config part
2013-03-11 00:21:27 +01:00
enkore
0a32494ce8
3.12: More bullet-proof wrapper
2013-03-10 21:38:02 +01:00
enkore
b42cd6aa15
3.12: Move code around
2013-03-10 21:22:58 +01:00
enkore
19aca9149a
3.12: remove I3statushandler
2013-03-10 20:57:12 +01:00
enkore
7dfac95f1e
3.11: Add test command, invoke like this: i3pystatus test
2013-03-10 18:24:33 +01:00
enkore
c8c8e2226f
Improved UX a bit: all threads are immediately started;
...
no more slow starting of modules.
Although I'm highly unsatisfied with the current implementation
(SoC, you hear me!?)
2013-03-10 02:11:58 +01:00
enkore
375ba3af7b
Support for the 3rd version of the i3bar-onclick-patch
2013-03-10 01:27:23 +01:00
enkore
657bdb826a
Add preliminary(!) support for bidirectional communication with i3bar
...
Novelty use only.
2013-03-09 21:23:36 +01:00
enkore
c60d2fd3df
Should definitely test KeyConstraintDict.
...
Seems to be all ok so far, just needed to add __delitem__
2013-03-08 16:59:59 +01:00
enkore
9084661a5d
Rewrote core.util.partition, added tests for it.
2013-03-08 15:53:48 +01:00
enkore
237123ae0f
Small changes in battery module
2013-03-08 15:53:28 +01:00
enkore
7a0bb1cbaa
Fix issue with gobject&gobject2
...
summary: just don't ever use gobject and gobject2 at the same time...
2013-03-06 22:32:07 +01:00
enkore
df0982ad84
Fix & close #6
...
Paradigm: "I don't know what to do, so let's outsource it"
2013-03-06 18:02:46 +01:00
enkore
553ad4efb9
…
2013-03-06 13:14:28 +01:00
enkore
0cd3e266c3
Add parcel module (currently only suppotr for DHL)
...
Needs documentation, extension, some redesign/separation of concern,
and lxml
2013-03-06 00:02:49 +01:00
enkore
93bfab1d7b
#5 : Support for real config files
2013-03-05 23:07:50 +01:00
enkore
6740f5b1cc
#5 : Add slim wrapper for notifications
2013-03-05 17:26:28 +01:00
enkore
03d96ad0ea
Some internal code butchering again.
2013-03-05 17:26:10 +01:00
enkore
3cac448f6e
Change process title of threads to something meaningful, if setproctitle is installed.
2013-03-02 20:05:41 +01:00
enkore
3c284ad29c
Docstrings and such
2013-03-02 17:34:53 +01:00
enkore
3ebcbec4e1
i3pystatus.core.threads ; some smaller changes.
2013-03-02 17:34:32 +01:00
enkore
901dd4319f
New self-organizing/self-optimising threading model (no API changes)
...
Using a simple, hysteresis based approach… currently in this first
version the optimizer recursively moves modules out of a thread until a
certain timing target is reached; the "modules moved out" just mentioned
are then partitioned into new threads according to their latest time profile.
Very simple, but very effective.
Todo: Implement merging threads with (again) good behaving workloads.
2013-02-28 00:14:51 +01:00
enkore
604a4f8e29
disk module
2013-02-26 23:00:03 +01:00
enkore
9510f0b1c0
Added ability to automatically import modules
...
I thought: Well, isn't it a bit redundant if I go ahead and say in my
config "import this-n-that and temp and load and alsa" while later
just giving register() the modules.
So register() (/ClassFinder as the backend) now support just naming a
module as the first parameter. That module is then imported and
searched for a class as usual.
Just for reference the synopsis of Status.register():
register(mod.SomeChecker())
register(mod, setting1=..., setting2=...)
register(mod, {"setting1:":, "setting2":...})
register("mod", setting=1..., setting2=...)
register("mod", {"setting1:":, "setting2":...})
Fun fact: Actually register() doesn't care for it's arguments.
They're passed straight into ClassFinder.instanciate_class_from_module
(something I should definitely rename), which checks if it's first
parameter is one of:
-Python module
=> It calls ClassFinder.get_class with the same parameters
=> get_class will search the module using ClassFinder.search_module
and return a matching class if and only if there is a single matching
class in the module
-string
=> It calls ClassFinder.get_module to import the module and calls itself
on the result
-something else
=> It returns that something
The actual variation in passing the settings (keyword arguments vs. dict)
is handled in SettingsBase.
2013-02-26 00:56:09 +01:00
enkore
a89b421ebb
battery
2013-02-24 21:46:29 +01:00
enkore
a892a09581
Moving some code around.
2013-02-24 21:00:16 +01:00
enkore
1fd53cd60a
Add ModuleList
2013-02-24 20:20:15 +01:00
enkore
92b2af56a8
Removed ModuleFinder, changed ClassFinder
...
ClassFinder:
Removed exclude argument, which is basically covered with
obj.__module__ == module.__name__ which ensures that no imported
classes are found, which was the only use case for exclude.
2013-02-24 20:16:33 +01:00
enkore
a2104f5d2f
Removed support for indicating the position of a module
2013-02-24 20:13:57 +01:00
enkore
1b6498883b
Divided __init__ into some submodules
...
This didn't change the public "API" used by modules.
.core.io contains the IO classes, namely IOHandler, StandaloneIO and JSONIO
.core.util contains SettingsBase and ClassFinder
.core.exceptions contains all custom exceptions
2013-02-24 18:43:00 +01:00