Skip to content

Commit 15e452e

Browse files
committedAug 18, 2015
[console] Allow running unsaved script files
Previously a (non-default) option existed for auto-saving scripts on run, which would overwrite the existing script file if set, or save the script to a temporary file before running. Now, the auto-save option only applies to scripts which have already been saved an have a filename. By default the console now can run scripts without filenames, or scripts with changes by transparently saving them out to a temporary file.
1 parent 7d1a8d3 commit 15e452e

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed
 

‎python/console/console_editor.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -570,15 +570,10 @@ def runScriptCode(self):
570570
self.parent.pc.callWidgetMessageBarEditor(msgEditorBlank, 0, True)
571571
return
572572

573-
if self.isModified() and not autoSave:
574-
self.parent.pc.callWidgetMessageBarEditor(msgEditorUnsaved, 0, True)
575-
return
576-
577573
if self.syntaxCheck(fromContextMenu=False):
578-
if autoSave and filename:
574+
if filename and self.isModified() and autoSave:
579575
self.parent.save(filename)
580-
581-
if autoSave and not filename:
576+
elif not filename or self.isModified():
582577
# Create a new temp file if the file isn't already saved.
583578
tmpFile = self.createTempFile()
584579
filename = tmpFile

0 commit comments

Comments
 (0)
Please sign in to comment.