[core/input] methods can be event callbacks
When registering an event (especially mouse events), if the parameter is a valid method in the Module, execute that with the event as parameter. Add this in the core.spacer module as an example. fixes #858 see #857
This commit is contained in:
parent
eb51a3c1c7
commit
7d33171749
2 changed files with 7 additions and 1 deletions
|
@ -9,7 +9,7 @@ Parameters:
|
|||
import core.module
|
||||
import core.widget
|
||||
import core.decorators
|
||||
|
||||
import core.input
|
||||
|
||||
class Module(core.module.Module):
|
||||
@core.decorators.every(minutes=60)
|
||||
|
@ -20,5 +20,8 @@ class Module(core.module.Module):
|
|||
def text(self, _):
|
||||
return self.__text
|
||||
|
||||
def update_text(self, event):
|
||||
self.__text = core.input.button_name(event["button"])
|
||||
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue