Debugger: Delay matplot process initialization

Reduces costs in case the feature is not requested.

Change-Id: I66da6f256baaec6ef9d40bc135942551d58e83da
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-01-28 17:04:42 +01:00
parent 401d66764c
commit c5c229b48f

View File

@@ -91,7 +91,14 @@ except:
if hasSubprocess and hasPlot: if hasSubprocess and hasPlot:
matplotFigure = {} matplotFigure = {}
matplotCount = 0 matplotCount = 0
matplotProc = None
devNull = None
def matplotInit():
global matplotProc
global devNull
if matplotProc is None:
devNull = open(os.devnull) devNull = open(os.devnull)
# FIXME: That might not be the one we want. # FIXME: That might not be the one we want.
pythonExecutable = sys.executable pythonExecutable = sys.executable
@@ -109,6 +116,8 @@ if hasSubprocess and hasPlot:
global matplotFigure global matplotFigure
global matplotCount global matplotCount
matplotInit()
def s(line): def s(line):
matplotProc.stdin.write(line.encode("latin1")) matplotProc.stdin.write(line.encode("latin1"))
matplotProc.stdin.write(b"\n") matplotProc.stdin.write(b"\n")
@@ -136,6 +145,8 @@ if hasSubprocess and hasPlot:
matplotProc.stdin.flush() matplotProc.stdin.flush()
def matplotQuit(): def matplotQuit():
global matplotProc
if not matplotProc is None:
matplotProc.stdin.write(b"exit") matplotProc.stdin.write(b"exit")
matplotProc.kill() matplotProc.kill()
devNull.close() devNull.close()