Skip to content

Commit d0d2511

Browse files
committedJul 21, 2013
Auto save Python script file
1 parent ed286eb commit d0d2511

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎python/console/console_editor.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,13 +561,20 @@ def runScriptCode(self):
561561
if not self.isModified():
562562
self.parent.pc.callWidgetMessageBarEditor(msgEditorBlank, 0, True)
563563
return
564+
564565
if self.isModified() and not autoSave:
565566
self.parent.pc.callWidgetMessageBarEditor(msgEditorUnsaved, 0, True)
566567
return
568+
567569
if self.syntaxCheck(fromContextMenu=False):
568-
if autoSave:
570+
if autoSave and filename:
571+
self.parent.save(filename)
572+
573+
if autoSave and not filename:
574+
# Create a new temp file if the file isn't already saved.
569575
tmpFile = self.createTempFile()
570576
filename = tmpFile
577+
571578
self.parent.pc.shell.runCommand("execfile(r'{0}')".format(filename))
572579

573580
def runSelectedCode(self):

0 commit comments

Comments
 (0)
Please sign in to comment.