FEM: Add printCalculiXstdout function
That non-critical part was quite often silently crashing with UnicodeDecodeError and as a side effect FreeCAD wasn't loading perfectly valid CalculiX result file. In long run that function should be replaced with a write-to-log counterpart and the CalculiX stdout should be shown to the user only upon request. Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
parent
d693051f14
commit
ec27cbc1c6
|
@ -252,12 +252,21 @@ class _JobControlTaskPanel:
|
|||
format(time.time() - self.Start, color, message)
|
||||
self.form.textEdit_Output.setText(self.OutStr)
|
||||
|
||||
def printCalculiXstdout(self):
|
||||
#There is probably no need to show user output from CalculiX. It should be
|
||||
#written to a file in the calcs directory and shown to user upon request [BUTTON]
|
||||
out = self.Calculix.readAllStandardOutput()
|
||||
if out.isEmpty():
|
||||
self.femConsoleMessage("CalculiX stdout is empty", "#FF0000")
|
||||
else:
|
||||
try:
|
||||
self.femConsoleMessage(unicode(out).replace('\n','<br>'))
|
||||
except UnicodeDecodeError:
|
||||
self.femConsoleMessage("Error converting stdout from CalculiX", "#FF0000")
|
||||
|
||||
def UpdateText(self):
|
||||
if(self.Calculix.state() == QtCore.QProcess.ProcessState.Running):
|
||||
out = self.Calculix.readAllStandardOutput()
|
||||
#print out
|
||||
if out:
|
||||
self.femConsoleMessage(unicode(out).replace('\n','<br>'))
|
||||
self.printCalculiXstdout()
|
||||
self.form.label_Time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start) )
|
||||
|
||||
def calculixError(self, error):
|
||||
|
@ -280,11 +289,8 @@ class _JobControlTaskPanel:
|
|||
def calculixFinished(self,exitCode):
|
||||
print "calculixFinished()",exitCode
|
||||
print self.Calculix.state()
|
||||
out = self.Calculix.readAllStandardOutput()
|
||||
print out
|
||||
if out:
|
||||
self.femConsoleMessage(unicode(out).replace('\n','<br>'))
|
||||
|
||||
self.printCalculiXstdout()
|
||||
self.Timer.stop()
|
||||
|
||||
self.femConsoleMessage("Calculix done!", "#00FF00")
|
||||
|
|
Loading…
Reference in New Issue
Block a user