mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
[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.
This commit is contained in:
parent
7d1a8d3019
commit
15e452e918
@ -570,15 +570,10 @@ class Editor(QsciScintilla):
|
|||||||
self.parent.pc.callWidgetMessageBarEditor(msgEditorBlank, 0, True)
|
self.parent.pc.callWidgetMessageBarEditor(msgEditorBlank, 0, True)
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.isModified() and not autoSave:
|
|
||||||
self.parent.pc.callWidgetMessageBarEditor(msgEditorUnsaved, 0, True)
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.syntaxCheck(fromContextMenu=False):
|
if self.syntaxCheck(fromContextMenu=False):
|
||||||
if autoSave and filename:
|
if filename and self.isModified() and autoSave:
|
||||||
self.parent.save(filename)
|
self.parent.save(filename)
|
||||||
|
elif not filename or self.isModified():
|
||||||
if autoSave and not filename:
|
|
||||||
# Create a new temp file if the file isn't already saved.
|
# Create a new temp file if the file isn't already saved.
|
||||||
tmpFile = self.createTempFile()
|
tmpFile = self.createTempFile()
|
||||||
filename = tmpFile
|
filename = tmpFile
|
||||||
|
Loading…
x
Reference in New Issue
Block a user