A function that the inputhooks can call (via inputhook.stdin_ready()) to find out if they should cede control and return
()
| 137 | from pydev_ipython.inputhook import set_return_control_callback |
| 138 | |
| 139 | def return_control(): |
| 140 | """A function that the inputhooks can call (via inputhook.stdin_ready()) to find |
| 141 | out if they should cede control and return""" |
| 142 | if _ProcessExecQueueHelper._debug_hook: |
| 143 | # Some of the input hooks check return control without doing |
| 144 | # a single operation, so we don't return True on every |
| 145 | # call when the debug hook is in place to allow the GUI to run |
| 146 | # XXX: Eventually the inputhook code will have diverged enough |
| 147 | # from the IPython source that it will be worthwhile rewriting |
| 148 | # it rather than pretending to maintain the old API |
| 149 | _ProcessExecQueueHelper._return_control_osc = not _ProcessExecQueueHelper._return_control_osc |
| 150 | if _ProcessExecQueueHelper._return_control_osc: |
| 151 | return True |
| 152 | |
| 153 | if not interpreter.exec_queue.empty(): |
| 154 | return True |
| 155 | return False |
| 156 | |
| 157 | set_return_control_callback(return_control) |
| 158 |