Skip to content

Commit

Permalink
FEM: print should use brackets for python3 compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Przemo Firszt <przemo@firszt.eu>
  • Loading branch information
PrzemoF authored and wwmayer committed Oct 19, 2015
1 parent cfc2a4d commit f095106
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Fem/_CommandQuickAnalysis.py
Expand Up @@ -48,7 +48,7 @@ def load_results(ret_code):
self.fea.load_results()
self.show_results_on_mesh()
else:
print "CalculiX failed ccx finished with error {}".format(ret_code)
print ("CalculiX failed ccx finished with error {}".format(ret_code))

self.fea = FemTools()
self.fea.reset_all()
Expand Down
21 changes: 10 additions & 11 deletions src/Mod/Fem/_JobControlTaskPanel.py
Expand Up @@ -45,7 +45,7 @@ def __init__(self, analysis_object):
ccx_binary = self.fem_prefs.GetString("ccxBinaryPath", "")
if ccx_binary:
self.CalculixBinary = ccx_binary
print "Using ccx binary path from FEM preferences: {}".format(ccx_binary)
print ("Using ccx binary path from FEM preferences: {}".format(ccx_binary))
else:
from platform import system
if system() == 'Linux':
Expand Down Expand Up @@ -109,13 +109,13 @@ def UpdateText(self):
self.form.label_Time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))

def calculixError(self, error):
print "Error()", error
print ("Error() {}".format(error))
self.femConsoleMessage("CalculiX execute error: {}".format(error), "#FF0000")

def calculixStarted(self):
print "calculixStarted()"
print self.Calculix.state()
self.form.pushButton_generate.setText("Break Calculix")
print ("calculixStarted()")
print (self.Calculix.state())

def calculixStateChanged(self, newState):
if (newState == QtCore.QProcess.ProcessState.Starting):
Expand All @@ -126,8 +126,8 @@ def calculixStateChanged(self, newState):
self.femConsoleMessage("CalculiX stopped.")

def calculixFinished(self, exitCode):
print "calculixFinished()", exitCode
print self.Calculix.state()
print ("calculixFinished() {}".format(exitCode))
print (self.Calculix.state())

# Restore previous cwd
QtCore.QDir.setCurrent(self.cwd)
Expand All @@ -138,7 +138,6 @@ def calculixFinished(self, exitCode):
self.femConsoleMessage("Calculix done!", "#00AA00")

self.form.pushButton_generate.setText("Re-run Calculix")
print "Loading results...."
self.femConsoleMessage("Loading result sets...")
self.form.label_Time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
fea = FemTools()
Expand Down Expand Up @@ -213,26 +212,26 @@ def start_ext_editor(self, ext_editor_path, filename):
self.ext_editor_process.start(ext_editor_path, [filename])

def editCalculixInputFile(self):
print 'editCalculixInputFile {}'.format(self.inp_file_name)
print ('editCalculixInputFile {}'.format(self.inp_file_name))
if self.fem_prefs.GetBool("UseInternalEditor", True):
FemGui.open(self.inp_file_name)
else:
ext_editor_path = self.fem_prefs.GetString("ExternalEditorPath", "")
if ext_editor_path:
self.start_ext_editor(ext_editor_path, self.inp_file_name)
else:
print "External editor is not defined in FEM preferences. Falling back to internal editor"
print ("External editor is not defined in FEM preferences. Falling back to internal editor")
FemGui.open(self.inp_file_name)

def runCalculix(self):
print 'runCalculix'
print ('runCalculix')
self.Start = time.time()

self.femConsoleMessage("CalculiX binary: {}".format(self.CalculixBinary))
self.femConsoleMessage("Run Calculix...")

# run Calculix
print 'run Calculix at: ', self.CalculixBinary, ' with: ', os.path.splitext(self.inp_file_name)[0]
print ('run Calculix at: {} with: {}'.format(self.CalculixBinary, os.path.splitext(self.inp_file_name)[0]))
# change cwd because ccx may crash if directory has no write permission
# there is also a limit of the length of file names so jump to the document directory
self.cwd = QtCore.QDir.currentPath()
Expand Down

0 comments on commit f095106

Please sign in to comment.