MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / enable_mac

Method enable_mac

pydev_ipython/inputhook.py:450–473  ·  view source on GitHub ↗

Enable event loop integration with MacOSX. We call function pyplot.pause, which updates and displays active figure during pause. It's not MacOSX-specific, but it enables to avoid inputhooks in native MacOSX backend. Also we shouldn't import pyplot, until user does it

(self, app=None)

Source from the content-addressed store, hash-verified

448 self.clear_inputhook()
449
450 def enable_mac(self, app=None):
451 """Enable event loop integration with MacOSX.
452
453 We call function pyplot.pause, which updates and displays active
454 figure during pause. It's not MacOSX-specific, but it enables to
455 avoid inputhooks in native MacOSX backend.
456 Also we shouldn't import pyplot, until user does it. Cause it's
457 possible to choose backend before importing pyplot for the first
458 time only.
459 """
460
461 def inputhook_mac(app=None):
462 if self.pyplot_imported:
463 pyplot = sys.modules["matplotlib.pyplot"]
464 try:
465 pyplot.pause(0.01)
466 except:
467 pass
468 else:
469 if "matplotlib.pyplot" in sys.modules:
470 self.pyplot_imported = True
471
472 self.set_inputhook(inputhook_mac)
473 self._current_gui = GUI_OSX
474
475 def disable_mac(self):
476 self.clear_inputhook()

Callers

nothing calls this directly

Calls 1

set_inputhookMethod · 0.95

Tested by

no test coverage detected