#============================================================================== try: import matplotlib except ImportError: matplotlib = None # analysis:ignore #============================================================================== # Monitor-based functionality #============================================================================== if os.environ.get('SPYDER_SHELL_ID') is None: monitor = None else: from spyderlib.widgets.externalshell.monitor import Monitor monitor = Monitor("127.0.0.1", int(os.environ['SPYDER_I_PORT']), int(os.environ['SPYDER_N_PORT']), os.environ['SPYDER_SHELL_ID'], float(os.environ['SPYDER_AR_TIMEOUT']), os.environ["SPYDER_AR_STATE"].lower() == "true") monitor.start() def open_in_spyder(source, lineno=1): """ Open a source file in Spyder's editor (it could be a filename or a Python module/package). If you want to use IPython's %edit use %ed instead """ try: source = sys.modules[source] except KeyError: source = source
pass try: import sitecustomize #analysis:ignore except ImportError: pass # Communication between Spyder and the remote process if os.environ.get('SPYDER_SHELL_ID') is None: monitor = None else: from spyderlib.widgets.externalshell.monitor import Monitor monitor = Monitor("127.0.0.1", int(os.environ['SPYDER_I_PORT']), int(os.environ['SPYDER_N_PORT']), os.environ['SPYDER_SHELL_ID'], float(os.environ['SPYDER_AR_TIMEOUT']), os.environ["SPYDER_AR_STATE"].lower() == "true") monitor.start() def open_in_spyder(source, lineno=1): """ Open a source file in Spyder's editor (it could be a filename or a Python module/package). If you want to use IPython's %edit use %ed instead """ try: source = sys.modules[source] except KeyError: source = source
sys.setdefaultencoding(encoding) import spyderlib.widgets.externalshell as extsh scpath = osp.dirname(osp.abspath(extsh.__file__)) if scpath in sys.path: sys.path.remove(scpath) try: import sitecustomize #@UnusedImport except ImportError: pass # Communication between ExternalShell and the QProcess from spyderlib.widgets.externalshell.monitor import Monitor monitor = Monitor("127.0.0.1", int(os.environ['SPYDER_PORT']), os.environ['SHELL_ID']) monitor.start() # Quite limited feature: notify only when a result is displayed in console # (does not notify at every prompt) def displayhook(obj): sys.__displayhook__(obj) monitor.refresh() sys.displayhook = displayhook from PyQt4.QtCore import pyqtRemoveInputHook pyqtRemoveInputHook()