Skip to content
Permalink
Browse files

[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.
  • Loading branch information
nyalldawson committed Aug 18, 2015
1 parent 7d1a8d3 commit 15e452e918bf3ee046e20bc6c0e94c44aad31c5e
Showing with 2 additions and 7 deletions.
  1. +2 −7 python/console/console_editor.py
@@ -570,15 +570,10 @@ def runScriptCode(self):
self.parent.pc.callWidgetMessageBarEditor(msgEditorBlank, 0, True)
return

if self.isModified() and not autoSave:
self.parent.pc.callWidgetMessageBarEditor(msgEditorUnsaved, 0, True)
return

if self.syntaxCheck(fromContextMenu=False):
if autoSave and filename:
if filename and self.isModified() and autoSave:
self.parent.save(filename)

if autoSave and not filename:
elif not filename or self.isModified():
# Create a new temp file if the file isn't already saved.
tmpFile = self.createTempFile()
filename = tmpFile

0 comments on commit 15e452e

Please sign in to comment.
You can’t perform that action at this time.