Module: on_click now returns True if a valid click event callback was found and executed, False otherwise.

This commit is contained in:
Lukáš Mandák 2015-06-22 11:07:23 +02:00
parent fff0444151
commit c042be12ed

View File

@ -91,21 +91,23 @@ class Module(SettingsBase):
cb = self.on_downscroll cb = self.on_downscroll
else: else:
self.logger.info("Button '%d' not handled yet." % (button)) self.logger.info("Button '%d' not handled yet." % (button))
return return False
if not cb: if not cb:
self.logger.info("no cb attached") self.logger.info("no cb attached")
return return False
else: else:
cb, args = split_callback_and_args(cb) cb, args = split_callback_and_args(cb)
self.logger.debug("cb=%s args=%s" % (cb, args)) self.logger.debug("cb=%s args=%s" % (cb, args))
if callable(cb): if callable(cb):
return cb(self) cb(self)
elif hasattr(self, cb): elif hasattr(self, cb):
return getattr(self, cb)(*args) if cb is not "run":
getattr(self, cb)(*args)
else: else:
return run_through_shell(cb, *args) run_through_shell(cb, *args)
return True
def move(self, position): def move(self, position):
self.position = position self.position = position