core: added a "_debug" signal:

this signal is a generic debugging signal which can be implemented in frontends to do specific actions, like printing data dumps.
This commit is contained in:
Goffi 2019-03-10 18:04:01 +01:00
commit 3eeeb8040c

View file

@ -383,6 +383,8 @@ class QuickApp(object):
self.registerSignal("chatStateReceived", iface="plugin")
self.registerSignal("messageState", iface="plugin")
self.registerSignal("psEvent", iface="plugin")
# useful for debugging
self.registerSignal("_debug", iface="core")
# FIXME: do it dynamically
quick_games.Tarot.registerSignals(self)
@ -1099,6 +1101,14 @@ class QuickApp(object):
answer_data=(entity, profile),
)
def _debugHandler(self, action, parameters, profile):
if action == u"widgets_dump":
from pprint import pformat
log.info(u"Widgets dump:\n{data}".format(data=pformat(self.widgets._widgets)))
else:
log.warning(u"Unknown debug action: {action}".format(action=action))
def showDialog(self, message, title, type="info", answer_cb=None, answer_data=None):
"""Show a dialog to user