Fixed the temp module bug that had popped up in the newest versions of FreeCAD and fixed the extra newlines in the output.
This commit is contained in:
parent
00f5bf8f66
commit
3f1bd3b70f
|
@ -163,7 +163,6 @@ class CadQueryExecuteScript:
|
|||
tempFile = tempfile.NamedTemporaryFile(delete=False)
|
||||
tempFile.write(cqCodePane.toPlainText().encode('utf-8'))
|
||||
tempFile.close()
|
||||
FreeCAD.Console.PrintMessage("\r\n")
|
||||
|
||||
docname = os.path.splitext(os.path.basename(cqCodePane.file.path))[0]
|
||||
|
||||
|
@ -173,16 +172,15 @@ class CadQueryExecuteScript:
|
|||
except:
|
||||
FreeCAD.newDocument(docname)
|
||||
|
||||
|
||||
#We import this way because using execfile() causes non-standard script execution in some situations
|
||||
imp.load_source('temp.module', tempFile.name)
|
||||
imp.load_source('temp_module', tempFile.name)
|
||||
|
||||
msg = QtGui.QApplication.translate(
|
||||
"cqCodeWidget",
|
||||
"Executed ",
|
||||
None,
|
||||
QtGui.QApplication.UnicodeUTF8)
|
||||
FreeCAD.Console.PrintMessage("\r\n" + msg + cqCodePane.file.path)
|
||||
FreeCAD.Console.PrintMessage(msg + cqCodePane.file.path + "\r\n")
|
||||
|
||||
|
||||
class CadQueryNewScript:
|
||||
|
@ -279,7 +277,7 @@ class CadQuerySaveScript:
|
|||
#If the code pane doesn't have a filename, we need to present the save as dialog
|
||||
if len(cqCodePane.file.path) == 0 or os.path.basename(cqCodePane.file.path) == 'script_template.py' \
|
||||
or os.path.split(cqCodePane.file.path)[-2].endswith('Examples'):
|
||||
FreeCAD.Console.PrintError("\r\nYou cannot save over a blank file, example file or template file.")
|
||||
FreeCAD.Console.PrintError("You cannot save over a blank file, example file or template file.\r\n")
|
||||
|
||||
CadQuerySaveAsScript().Activated()
|
||||
|
||||
|
|
|
@ -28,4 +28,4 @@ def save(filename=None):
|
|||
"Saved ",
|
||||
None,
|
||||
QtGui.QApplication.UnicodeUTF8)
|
||||
FreeCAD.Console.PrintMessage("\r\n" + msg + cqCodePane.file.path)
|
||||
FreeCAD.Console.PrintMessage(msg + cqCodePane.file.path + "\r\n")
|
||||
|
|
|
@ -27,6 +27,6 @@ def open(filename):
|
|||
"Opened ",
|
||||
None,
|
||||
QtGui.QApplication.UnicodeUTF8)
|
||||
FreeCAD.Console.PrintMessage("\r\n" + msg + filename)
|
||||
FreeCAD.Console.PrintMessage(msg + filename + "\r\n")
|
||||
|
||||
return
|
||||
|
|
|
@ -95,7 +95,7 @@ class CadQueryWorkbench (Workbench):
|
|||
"Please install Python 2.7",
|
||||
None,
|
||||
QtGui.QApplication.UnicodeUTF8)
|
||||
FreeCAD.Console.PrintError("\r\n" + msg)
|
||||
FreeCAD.Console.PrintError(msg + "\r\n")
|
||||
|
||||
#The extra version numbers won't work on Windows
|
||||
if sys.platform.startswith('win'):
|
||||
|
@ -104,8 +104,6 @@ class CadQueryWorkbench (Workbench):
|
|||
#Getting the main window will allow us to start setting things up the way we want
|
||||
mw = FreeCADGui.getMainWindow()
|
||||
|
||||
# TODO: Fix the extra newline foolishness with the output in the report view
|
||||
|
||||
dockWidgets = mw.findChildren(QtGui.QDockWidget)
|
||||
|
||||
for widget in dockWidgets:
|
||||
|
|
Loading…
Reference in New Issue
Block a user