diff sat_frontends/quick_frontend/quick_app.py @ 2854:eb9fa72eb62b

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.
author Goffi <goffi@goffi.org>
date Sun, 10 Mar 2019 18:04:01 +0100
parents b9da74c9d46e
children e9e33e05d143
line wrap: on
line diff
--- a/sat_frontends/quick_frontend/quick_app.py	Sun Mar 10 18:03:41 2019 +0100
+++ b/sat_frontends/quick_frontend/quick_app.py	Sun Mar 10 18:04:01 2019 +0100
@@ -383,6 +383,8 @@
         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 @@
                 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