Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 15e452e
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions python/console/console_editor.py
Expand Up @@ -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
Expand Down

0 comments on commit 15e452e

Please sign in to comment.