{"action":"created","issue":{"url":"https://api.github.com/repos/spyder-ide/spyder/issues/1421","labels_url":"https://api.github.com/repos/spyder-ide/spyder/issues/1421/labels{/name}","comments_url":"https://api.github.com/repos/spyder-ide/spyder/issues/1421/comments","events_url":"https://api.github.com/repos/spyder-ide/spyder/issues/1421/events","html_url":"https://github.com/spyder-ide/spyder/issues/1421","id":57968360,"number":1421,"title":"Registry for all ready signals from widgets","user":{"login":"spyder-issues-migrator","id":11021581,"avatar_url":"https://avatars.githubusercontent.com/u/11021581?v=3","gravatar_id":"","url":"https://api.github.com/users/spyder-issues-migrator","html_url":"https://github.com/spyder-issues-migrator","followers_url":"https://api.github.com/users/spyder-issues-migrator/followers","following_url":"https://api.github.com/users/spyder-issues-migrator/following{/other_user}","gists_url":"https://api.github.com/users/spyder-issues-migrator/gists{/gist_id}","starred_url":"https://api.github.com/users/spyder-issues-migrator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spyder-issues-migrator/subscriptions","organizations_url":"https://api.github.com/users/spyder-issues-migrator/orgs","repos_url":"https://api.github.com/users/spyder-issues-migrator/repos","events_url":"https://api.github.com/users/spyder-issues-migrator/events{/privacy}","received_events_url":"https://api.github.com/users/spyder-issues-migrator/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/1%20star","name":"1 star","color":"fef2c0"},{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/Maintainability","name":"Maintainability","color":"5319e7"},{"url":"https://api.github.com/repos/spyder-ide/spyder/labels/Miscelleneous","name":"Miscelleneous","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-02-17T19:18:12Z","updated_at":"2015-04-17T13:29:30Z","closed_at":null,"body":"_From [techtonik@gmail.com](https://code.google.com/u/techtonik@gmail.com/) on 2013-06-02T02:00:50Z_\n\nPartially inspired by e75a44b270ba, the idea is to gather all ready signals into one container, which can provide real-time data about state of Spyder components and operations.\r\n\r\nI can already see this implemented as a LED bar (dashboard) for all ready signals.\r\n\r\n\r\nSome implementation details.\r\n1. Helper to create signals and add them to registry. As far as I know QT4 doesn't allow to track when signals are created or query them.\r\n2. When signal is added, it is given a \"grey\" placeholder.\r\n3. When signal if fired, this \"gray\" changes state to \"green\"\r\n4. A dashboard page accessible from some `?' submenus, maybe even from About screen\n\n_Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1421_"},"comment":{"url":"https://api.github.com/repos/spyder-ide/spyder/issues/comments/93986079","html_url":"https://github.com/spyder-ide/spyder/issues/1421#issuecomment-93986079","issue_url":"https://api.github.com/repos/spyder-ide/spyder/issues/1421","id":93986079,"user":{"login":"goanpeca","id":3627835,"avatar_url":"https://avatars.githubusercontent.com/u/3627835?v=3","gravatar_id":"","url":"https://api.github.com/users/goanpeca","html_url":"https://github.com/goanpeca","followers_url":"https://api.github.com/users/goanpeca/followers","following_url":"https://api.github.com/users/goanpeca/following{/other_user}","gists_url":"https://api.github.com/users/goanpeca/gists{/gist_id}","starred_url":"https://api.github.com/users/goanpeca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goanpeca/subscriptions","organizations_url":"https://api.github.com/users/goanpeca/orgs","repos_url":"https://api.github.com/users/goanpeca/repos","events_url":"https://api.github.com/users/goanpeca/events{/privacy}","received_events_url":"https://api.github.com/users/goanpeca/received_events","type":"User","site_admin":false},"created_at":"2015-04-17T13:29:30Z","updated_at":"2015-04-17T13:29:30Z","body":"@techtonik \r\n\r\nI was curious so I did something on the lines I described...\r\n\r\n```python\r\n\r\n# -*- coding: utf-8 -*-\r\nimport sys\r\n\r\nfrom spyderlib.qt.QtCore import Signal, QPoint\r\nfrom spyderlib.qt.QtGui import QPushButton, QApplication, QDialog, QVBoxLayout\r\n\r\n\r\nclass _SignalTracker:\r\n    \"\"\"\r\n    \"\"\"\r\n    SIGNAL_ID = {}\r\n\r\n    def track_signal(self, signal):\r\n        \"\"\"\r\n        \"\"\"\r\n        id_ = id(signal)\r\n        func_name = 'signal_{0}_emitted'.format(id_)\r\n        func_str = 'def {0}(*args):\\n    _signal_emitted(*args, id={1})'\r\n        exec func_str.format(func_name, id_)\r\n        setattr(self, func_name, eval(func_name))\r\n        signal.connect(getattr(self, func_name))\r\n        self.SIGNAL_ID[id_] = signal\r\n\r\n\r\n_signal_tracker = _SignalTracker()\r\n\r\n\r\ndef _signal_emitted(*args, **kwargs):\r\n    \"\"\"\r\n    \"\"\"\r\n    id_ = kwargs['id']\r\n    signal = _signal_tracker.SIGNAL_ID[id_]\r\n    name = signal.signal[1:]\r\n    print(args, signal, name)\r\n\r\n\r\ndef track_signal(*args):\r\n    \"\"\"\r\n    \"\"\"\r\n    for signal in args:\r\n        _signal_tracker.track_signal(signal)\r\n\r\n\r\nclass SpyderWidget(QDialog):\r\n    sig_foo = Signal(bool)\r\n    sig_bar = Signal(bool, str, list)\r\n\r\n    def __init__(self):\r\n        super(SpyderWidget, self).__init__()\r\n        self.button_1 = QPushButton(self)\r\n        self.button_1.setText('1')\r\n        self.button_2 = QPushButton(self)\r\n        self.button_2.setText('2')\r\n        self.button_2.clicked.connect(self.sig_foo)\r\n        self.button_3 = QPushButton(self)\r\n        self.button_3.setText('3')\r\n        self.button_3.clicked.connect(self.test_method)\r\n        layout = QVBoxLayout()\r\n        layout.addWidget(self.button_1)\r\n        layout.addWidget(self.button_2)\r\n        layout.addWidget(self.button_3)\r\n        self.setLayout(layout)\r\n\r\n        # Track any signal here...\r\n        track_signal(self.button_1.clicked, self.sig_foo, self.sig_bar)\r\n\r\n    def test_method(self):\r\n        self.sig_bar.emit(True, 'hello', [1, 2, 3])\r\n\r\n\r\ndef main():\r\n    app = QApplication(sys.argv)\r\n    test = SpyderWidget()\r\n    test2 = SpyderWidget()\r\n    test.show()\r\n    test2.show()\r\n    test2.move(QPoint(test2.x() + test2.width()*2, test2.y()))\r\n    app.exec_()\r\n\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n\r\n```\r\n\r\nSomething like this (though hackish) would be less invasive and we could add any sort of signal... custom or native and have the information of the signal itself plus any arguments it emits.\r\n\r\n\r\n\r\n"}}