Commit Graph

212 Commits

Author SHA1 Message Date
Facetoe
328eb92864 Catch all exceptions. 2016-11-03 21:54:02 +08:00
Facetoe
458e05cae8 Catch exceptions thrown in init().
Possible solution for #490
2016-11-01 20:01:27 +08:00
enkore
10416e8ed0 Merge pull request #471 from hobarrera/online-dont-fail-when-offline
online module: Don't fail when offline
2016-10-18 01:18:32 +02:00
Hugo Osvaldo Barrera
aeec2e86f3 online module: Don't fail when offline
If the system is offline, socket.gaierror is raised, the module crashes,
and shows `offline` indefinitely.

Catch that exception, and return False.
2016-10-17 20:05:05 -03:00
Erik Johnson
bafc492c45 Always log exception for DesktopNotification failure
Also remove unused ``exc`` variable.
2016-09-20 12:53:06 -05:00
Erik Johnson
429c5d4865 Fix traceback when notification daemon not running
When a desktop notification is displayed but there is no notification
daemon running, an exception is raised.

This fixes the traceback by adding a logger to the DesktopNotification
class, and logging an error when the exception is caught.

Fixes #453.
2016-09-18 20:45:40 -05:00
Matthieu Coudron
33764e349e "logfile" accepts environment variables 2016-08-29 14:54:07 +02:00
Facetoe
8d8c0b6812 Update comment 2016-08-09 18:33:28 +08:00
Facetoe
c30365338b Refactor conditional to pass required setting tests.
If a setting is defined in a subclass and is not None do not raise
config error.
2016-08-09 18:20:40 +08:00
Facetoe
5bb40926b8 Ensure required settings are defined correctly.
Possible fix for #424. If a setting has not been overidden in a subclass
or set in the user's config then raise an exception.
2016-08-07 01:16:27 +08:00
Jay Cornwall
1dabaf1c2e Pulseaudio: Update status immediately when volume changes
Volume changes may occur externally (e.g. through pactl bound to media
keys) or through mouse interaction. The new volume is received
asynchronously but can only be outputted at the next status poll,
causing a small delay.

Introduce Module.send_output() to allow a module to send its output
without delay. Invoke this method in the Pulseaudio sink info callback.
2016-07-17 18:12:38 -05:00
Erik Johnson
8e9b6dfba3 Remove leading newline from exception logging
The new log formatting makes this unnecessary.
2016-04-10 21:16:23 -05:00
Erik Johnson
c6b2077263 Add support for logformat parameter to i3pystatus.Status()
This improves the usefulness of log messages, especially when it comes
to debug logging added for the purpose of future troubleshooting.
2016-04-10 21:16:23 -05:00
Mathis FELARDOS
f26a9f9d1d core: Improve the support of other button
* This commit fix #259
* Change 'unhandled' callback by 'other'
* Add the an optional parameter 'button_id' for all callbacks

Signed-off-by: Mathis FELARDOS <mathis.felardos@gmail.com>
2016-03-25 22:27:33 +01:00
Mathis FELARDOS
95f625cd6b core: Add the middle click support and unhandled button support
* This commit fix #259
* Support of middle click button
* Add an unhandled click events for all button that will not be handled
* Remove the return type of on_click: it became useless now
* Fix the unique call of on_click in CommandEndpoint

Signed-off-by: Mathis FELARDOS <mathis.felardos@gmail.com>
2016-03-25 04:32:29 +01:00
Mathis FELARDOS
98e8a1cc04 core: handle callbacks that are not functions on Python 3.3
* Fix inspect.getargspec issue for non functions callbacks by creating
  an empty ArgSpec. There for we ignore all kwargs parameters.

Signed-off-by: Mathis FELARDOS <mathis.felardos@gmail.com>
2016-03-23 10:14:20 +01:00
Mathis FELARDOS
d15b3173f1 core: Change command_endpoint and on_click for supporting i3bar mouse positions
* command_endpoint: get the position from the mouse when the click
  occured. Parameters names are set here: pos_x pos_y.
  Positions are passed to on_click through keyword arguments.
* Module:
  - change __log_button_event, __button_callback_handler and on_click
    methods for handling keyword arguments.
  - "Member", "Method" and "Python" callbacks are handled by detecting
    if they have pos_x or pos_y as parameters, or if they have a
    keyword arguments. The special case of wrapped callbacks (made with
    get_module decorator for example) is handled in a similar way.
  - "External command" is handled by considering the position as a
    format dictionary. Actually no distinctions are made of how
    self.data and the new keyword argument are treated on this.
  - the parameter kwargs as been added to the doc string of on_click.
* MultiClickHandler: now handle keyword arguments.

Signed-off-by: Mathis FELARDOS <mathis.felardos@gmail.com>
2016-03-23 08:36:11 +01:00
Kenny Keslar
693d2ebdb7 Catch exceptions in button handlers 2016-03-02 15:57:57 -05:00
enkore
7117df6fb2 Display exception class name (in-line exception display)
cf #322
2016-02-16 13:40:30 +01:00
enkore
58ca67109c Change default mode to standalone=True 2016-02-12 14:12:43 +01:00
enkore
2890f942f3 configuration.rst: update example callbacks 2016-02-02 16:01:28 +01:00
enkore
dcda1bb3a4 Fix initialization error if standalone is False
Does anybody even use this scenario anymore? We could remove quite some
code if we only supported standalone operation.
2016-02-02 15:47:00 +01:00
enkore
9759d6eea5 Revert "Lift restriction that "run" cannot be used as a callback"
This reverts commit d018be872a.
2016-02-01 17:09:47 +01:00
enkore
d018be872a Lift restriction that "run" cannot be used as a callback 2016-02-01 12:18:03 +01:00
enkore
739c595ef0 Fix is_method_of (cf #310), add regression test case 2016-01-28 20:34:53 +01:00
enkore
2aeda9c5e3 Fix single string case & docs 2016-01-27 20:15:59 +01:00
enkore
dec534ce81 Fix errorneous recursive replace mishap 2016-01-27 20:02:51 +01:00
enkore
612b8b07eb Update modules to a7583a9
Not updated for various reasons:
clock,
dpms,
gpu_temp,
load,
mail,
mem_bar,
modsde,
net_speed,
pianobar,
pulseaudio,
regex [no named formatters],
runwatch,
shell,
solaar,
temp,
text,
updates,
weather,
whosonlocation,
xkblayout,
zabbix


This might break something: I can't test all these modules. If it does,
file a bug / open a PR / send me a note.
2016-01-27 19:53:33 +01:00
enkore
a7583a9786 Implement #300 2016-01-27 19:31:12 +01:00
enkore
aed169de4d Implement decided resolution of #304
- Remove self for normal callables
- Retain self for methods (of course)
- Add decorator to retrieve self for special callbacks that need it
  (Yes, the example is kinda stupid and would be unnecessary with #300)
2016-01-27 19:07:59 +01:00
Maxi Padulo
f12d1f9d48 Fix handler not executing external cmd (#301)
Wrong name on function call was raising AttributeError
exception disrutping the code execution.
2016-01-12 13:03:50 +01:00
Nuno Cardoso
87c01278f7 Added double click support 2016-01-03 16:43:29 +01:00
Lukáš Mandák
6d211f823c Added options to change logfile and internet check server. 2015-11-28 15:42:26 +01:00
Jan Oliver Oelerich
e78501a0cc Update desktop.py
Fixed syntax error.
2015-10-25 20:41:42 +01:00
enkore
4d24b17e2b Fix crash on import with desktop notifications when python-gobject is available, but no notification daemon is running. 2015-10-25 20:30:36 +01:00
Lukáš Mandák
b0e914d4e9 Module: Updated docstring for on_click method. 2015-10-03 11:20:16 +02:00
Lukáš Mandák
081bd329f9 Changed checks for command attribute in run_through_shell and execute. 2015-10-03 10:14:29 +02:00
Lukáš Mandák
2ef74ded79 Replace regular 'split' to 'shlex.split'. 2015-09-29 12:47:32 +02:00
Lukáš Mandák
68d11b2f81 Module: Log first then let bad things happen. :) 2015-09-25 19:37:53 +02:00
Lukáš Mandák
6d3c7eddc8 Module: More detailed logs for clickevents as suggested by @teto in #231. 2015-09-25 19:12:05 +02:00
Lukáš Mandák
4aa6b2a73c Docs: Updated docstring of run_through_shell. 2015-09-25 18:47:54 +02:00
Lukáš Mandák
30b73fe6d6 SettingsBase: Fixed logging for modules outside of i3pystatus directory i.e. modules defined directly in the config file. 2015-09-25 18:17:54 +02:00
Lukáš Mandák
d07168beb7 Module: Allow passing of arguments to callable callbacks. 2015-09-25 13:58:08 +02:00
Lukáš Mandák
32ab77c203 Module: External programs are launched in detached mode. 2015-09-25 13:57:09 +02:00
Lukáš Mandák
97e2ad7bba Fixed detached mode of execute and updated its docstring. 2015-09-25 13:55:56 +02:00
Lukáš Mandák
4bfe04dab6 Module: Clickevents now do not wait for commands output. Fix for #254. 2015-09-22 10:35:42 +02:00
Lukáš Mandák
375b77178d Renamed 'run_in_background' to 'execute'. 2015-09-21 23:09:19 +02:00
Lukáš Mandák
6f2c8f2e40 Added run_in_background function. 2015-07-14 16:14:29 +02:00
Lukáš Mandák
46794200fa StandaloneIO: Change all static and class methods to normal methods. 2015-06-22 17:34:10 +02:00
Lukáš Mandák
a63d7fe4d8 StandaloneIO: Remove unused variable from refresh_signal_handler. 2015-06-22 13:06:32 +02:00