Enable event loop integration with PyQt4. Parameters ---------- app : Qt Application, optional. Running application to use. If not given, we probe Qt for an existing application object, and create a new one if none is found. Notes --
(self, app=None)
| 187 | self.enable_qt4(app) |
| 188 | |
| 189 | def enable_qt4(self, app=None): |
| 190 | """Enable event loop integration with PyQt4. |
| 191 | |
| 192 | Parameters |
| 193 | ---------- |
| 194 | app : Qt Application, optional. |
| 195 | Running application to use. If not given, we probe Qt for an |
| 196 | existing application object, and create a new one if none is found. |
| 197 | |
| 198 | Notes |
| 199 | ----- |
| 200 | This methods sets the PyOS_InputHook for PyQt4, which allows |
| 201 | the PyQt4 to integrate with terminal based applications like |
| 202 | IPython. |
| 203 | |
| 204 | If ``app`` is not given we probe for an existing one, and return it if |
| 205 | found. If no existing app is found, we create an :class:`QApplication` |
| 206 | as follows:: |
| 207 | |
| 208 | from PyQt4 import QtCore |
| 209 | app = QtGui.QApplication(sys.argv) |
| 210 | """ |
| 211 | from pydev_ipython.inputhookqt4 import create_inputhook_qt4 |
| 212 | |
| 213 | app, inputhook_qt4 = create_inputhook_qt4(self, app) |
| 214 | self.set_inputhook(inputhook_qt4) |
| 215 | |
| 216 | self._current_gui = GUI_QT4 |
| 217 | app._in_event_loop = True |
| 218 | self._apps[GUI_QT4] = app |
| 219 | return app |
| 220 | |
| 221 | def disable_qt4(self): |
| 222 | """Disable event loop integration with PyQt4. |
no test coverage detected