Skip to content

Commit

Permalink
Auto save Python script file
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Jul 21, 2013
1 parent ed286eb commit d0d2511
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/console/console_editor.py
Expand Up @@ -561,13 +561,20 @@ def runScriptCode(self):
if not self.isModified():
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:
if autoSave and filename:
self.parent.save(filename)

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

self.parent.pc.shell.runCommand("execfile(r'{0}')".format(filename))

def runSelectedCode(self):
Expand Down

0 comments on commit d0d2511

Please sign in to comment.