From: daid303 Date: Mon, 1 Oct 2012 16:15:51 +0000 (+0200) Subject: Fix support for slicing if running from pythonw.exe X-Git-Tag: 13.03~304 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9675968b27318c791be995248a34a47948f22e1d;p=cura.git Fix support for slicing if running from pythonw.exe --- diff --git a/Cura/gui/batchRun.py b/Cura/gui/batchRun.py index 9762d6a0..295d321b 100644 --- a/Cura/gui/batchRun.py +++ b/Cura/gui/batchRun.py @@ -187,7 +187,7 @@ class BatchSliceProgressWindow(wx.Frame): self.cmdIndex += 1 wx.CallAfter(self.SetTitle, "Building: [%d/%d]" % (self.sliceCmdList.index(action) + 1, len(self.sliceCmdList))) - p = subprocess.Popen(action, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + p = sliceRun.startSliceCommandProcess(action) line = p.stdout.readline() maxValue = 1 while(len(line) > 0): diff --git a/Cura/gui/printWindow.py b/Cura/gui/printWindow.py index 1bca20ad..83642b18 100644 --- a/Cura/gui/printWindow.py +++ b/Cura/gui/printWindow.py @@ -38,7 +38,7 @@ class printProcessMonitor(): def loadFile(self, filename): if self.handle == None: - self.handle = subprocess.Popen([sys.executable, sys.argv[0], '-r', filename], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + self.handle = subprocess.Popen([sys.executable, sys.argv[0], '-r', filename], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) self.thread = threading.Thread(target=self.Monitor) self.thread.start() else: diff --git a/Cura/gui/projectPlanner.py b/Cura/gui/projectPlanner.py index c521ca55..b9652659 100644 --- a/Cura/gui/projectPlanner.py +++ b/Cura/gui/projectPlanner.py @@ -939,7 +939,7 @@ class ProjectSliceProgressWindow(wx.Frame): for action in self.actionList: wx.CallAfter(self.SetTitle, "Building: [%d/%d]" % (self.actionList.index(action) + 1, len(self.actionList))) if not action.usePreviousSlice: - p = subprocess.Popen(action.sliceCmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + p = sliceRun.startSliceCommandProcess(action.sliceCmd) line = p.stdout.readline() maxValue = 1 diff --git a/Cura/gui/sliceProgessPanel.py b/Cura/gui/sliceProgessPanel.py index bd278ccb..9cc68431 100644 --- a/Cura/gui/sliceProgessPanel.py +++ b/Cura/gui/sliceProgessPanel.py @@ -135,14 +135,7 @@ class WorkerThread(threading.Thread): self.start() def run(self): - kwargs = {} - if subprocess.mswindows: - su = subprocess.STARTUPINFO() - su.dwFlags |= subprocess.STARTF_USESHOWWINDOW - su.wShowWindow = subprocess.SW_HIDE - kwargs['startupinfo'] = su - print self.cmdList[self.fileIdx] - p = subprocess.Popen(self.cmdList[self.fileIdx], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs) + p = sliceRun.startSliceCommandProcess(self.cmdList[self.fileIdx]) line = p.stdout.readline() self.progressLog = [] maxValue = 1 diff --git a/Cura/util/sliceRun.py b/Cura/util/sliceRun.py index 824aa1e0..c4b6bf79 100644 --- a/Cura/util/sliceRun.py +++ b/Cura/util/sliceRun.py @@ -178,3 +178,11 @@ def getSliceCommand(filename): cmd.append(filename) return cmd +def startSliceCommandProcess(cmdList): + kwargs = {} + if subprocess.mswindows: + su = subprocess.STARTUPINFO() + su.dwFlags |= subprocess.STARTF_USESHOWWINDOW + su.wShowWindow = subprocess.SW_HIDE + kwargs['startupinfo'] = su + p = subprocess.Popen(cmdList, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)