(self)
| 1637 | _init_stderr_redirect() |
| 1638 | |
| 1639 | def init_gui_support(self): |
| 1640 | if self._installed_gui_support: |
| 1641 | return |
| 1642 | self._installed_gui_support = True |
| 1643 | |
| 1644 | # enable_gui and enable_gui_function in activate_matplotlib should be called in main thread. Unlike integrated console, |
| 1645 | # in the debug console we have no interpreter instance with exec_queue, but we run this code in the main |
| 1646 | # thread and can call it directly. |
| 1647 | class _ReturnGuiLoopControlHelper: |
| 1648 | _return_control_osc = False |
| 1649 | |
| 1650 | def return_control(): |
| 1651 | # Some of the input hooks (e.g. Qt4Agg) check return control without doing |
| 1652 | # a single operation, so we don't return True on every |
| 1653 | # call when the debug hook is in place to allow the GUI to run |
| 1654 | _ReturnGuiLoopControlHelper._return_control_osc = not _ReturnGuiLoopControlHelper._return_control_osc |
| 1655 | return _ReturnGuiLoopControlHelper._return_control_osc |
| 1656 | |
| 1657 | from pydev_ipython.inputhook import set_return_control_callback, enable_gui |
| 1658 | |
| 1659 | set_return_control_callback(return_control) |
| 1660 | |
| 1661 | if self._gui_event_loop == "matplotlib": |
| 1662 | # prepare debugger for matplotlib integration with GUI event loop |
| 1663 | from pydev_ipython.matplotlibtools import activate_matplotlib, activate_pylab, activate_pyplot, do_enable_gui |
| 1664 | |
| 1665 | self.mpl_modules_for_patching = { |
| 1666 | "matplotlib": lambda: activate_matplotlib(do_enable_gui), |
| 1667 | "matplotlib.pyplot": activate_pyplot, |
| 1668 | "pylab": activate_pylab, |
| 1669 | } |
| 1670 | else: |
| 1671 | self.activate_gui_function = enable_gui |
| 1672 | |
| 1673 | def _activate_gui_if_needed(self): |
| 1674 | if self.gui_in_use: |
no test coverage detected