{"action":"created","issue":{"url":"https://api.github.com/repos/vispy/vispy/issues/968","labels_url":"https://api.github.com/repos/vispy/vispy/issues/968/labels{/name}","comments_url":"https://api.github.com/repos/vispy/vispy/issues/968/comments","events_url":"https://api.github.com/repos/vispy/vispy/issues/968/events","html_url":"https://github.com/vispy/vispy/pull/968","id":84510754,"number":968,"title":"Add new signature to `message_handler` for pyqt5","user":{"login":"hadim","id":528003,"avatar_url":"https://avatars.githubusercontent.com/u/528003?v=3","gravatar_id":"","url":"https://api.github.com/users/hadim","html_url":"https://github.com/hadim","followers_url":"https://api.github.com/users/hadim/followers","following_url":"https://api.github.com/users/hadim/following{/other_user}","gists_url":"https://api.github.com/users/hadim/gists{/gist_id}","starred_url":"https://api.github.com/users/hadim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadim/subscriptions","organizations_url":"https://api.github.com/users/hadim/orgs","repos_url":"https://api.github.com/users/hadim/repos","events_url":"https://api.github.com/users/hadim/events{/privacy}","received_events_url":"https://api.github.com/users/hadim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-03T11:37:10Z","updated_at":"2015-06-03T11:53:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/vispy/vispy/pulls/968","html_url":"https://github.com/vispy/vispy/pull/968","diff_url":"https://github.com/vispy/vispy/pull/968.diff","patch_url":"https://github.com/vispy/vispy/pull/968.patch"},"body":"A small bug fix in Qt backend.\r\n\r\nIn pyqt5 `QtCore.qInstallMessageHandler` takes a function with a different signature than pyqt4. The result was that all pyqt5 log message would display `TypeError: message_handler() takes 2 positional arguments but 3 were given`.\r\n\r\nThis PR fix the issue by checking wether `qt_lib` is pyqt4 or pyqt5.\r\n\r\nPS: I also add a `.decode()` to pyqt4 logging message signature because it's return a byte and not an str. However it could raise issue with Python 2. This code has only been tested with Python 3.4."},"comment":{"url":"https://api.github.com/repos/vispy/vispy/issues/comments/108335533","html_url":"https://github.com/vispy/vispy/pull/968#issuecomment-108335533","issue_url":"https://api.github.com/repos/vispy/vispy/issues/968","id":108335533,"user":{"login":"hadim","id":528003,"avatar_url":"https://avatars.githubusercontent.com/u/528003?v=3","gravatar_id":"","url":"https://api.github.com/users/hadim","html_url":"https://github.com/hadim","followers_url":"https://api.github.com/users/hadim/followers","following_url":"https://api.github.com/users/hadim/following{/other_user}","gists_url":"https://api.github.com/users/hadim/gists{/gist_id}","starred_url":"https://api.github.com/users/hadim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadim/subscriptions","organizations_url":"https://api.github.com/users/hadim/orgs","repos_url":"https://api.github.com/users/hadim/repos","events_url":"https://api.github.com/users/hadim/events{/privacy}","received_events_url":"https://api.github.com/users/hadim/received_events","type":"User","site_admin":false},"created_at":"2015-06-03T11:53:35Z","updated_at":"2015-06-03T11:53:35Z","body":"The last commit fix some compatibility issue in `vispy/app/qt.py`.\r\n\r\nIt basically adds this :+1: \r\n\r\n```python\r\nfrom .backends import qt_lib\r\n\r\nif qt_lib == 'pyqt4':\r\n    from PyQt4 import QtGui, QtCore\r\n    QWidget, QGridLayout = QtGui.QWidget, QtGui.QGridLayout  # Compat\r\nelif qt_lib == 'pyqt5':\r\n    from PyQt5 import QtGui, QtCore, QtWidgets\r\n    QWidget, QGridLayout = QtWidgets.QWidget, QtWidgets.QGridLayout  # Compat\r\nelif qt_lib == 'pyside':\r\n    from PySide import QtGui, QtCore\r\n    QWidget, QGridLayout = QtGui.QWidget, QtGui.QGridLayout  # Compat\r\nelif qt_lib:\r\n    raise RuntimeError(\"Invalid value for qt_lib %r.\" % qt_lib)\r\nelse:\r\n    raise RuntimeError(\"Module backends._qt should not be imported directly.\")\r\n```\r\n\r\nIt's maybe an heavy solution for later if you want to add more Qt related widgets ..."}}