ViewManager/ViewManager.py

changeset 548
ac7af05dd54a
parent 540
2631831b4052
child 549
fe99d46d56c8
equal deleted inserted replaced
547:cceececd1312 548:ac7af05dd54a
3006 QMessageBox.Abort | \ 3006 QMessageBox.Abort | \
3007 QMessageBox.Discard | \ 3007 QMessageBox.Discard | \
3008 QMessageBox.Save), 3008 QMessageBox.Save),
3009 QMessageBox.Save) 3009 QMessageBox.Save)
3010 if res == QMessageBox.Save: 3010 if res == QMessageBox.Save:
3011 ok, newName = editor.saveFile() 3011 ok = editor.saveFile()
3012 if ok: 3012 if ok:
3013 self.setEditorName(editor, newName) 3013 self.setEditorName(editor, editor.getFileName())
3014 return ok 3014 return ok
3015 elif res == QMessageBox.Abort: 3015 elif res == QMessageBox.Abort:
3016 return False 3016 return False
3017 3017
3018 return True 3018 return True
3439 return True 3439 return True
3440 3440
3441 if not editor.isModified(): 3441 if not editor.isModified():
3442 return True 3442 return True
3443 else: 3443 else:
3444 ok = editor.saveFile()[0] 3444 ok = editor.saveFile()
3445 return ok 3445 return ok
3446 3446
3447 def saveEditorEd(self, ed): 3447 def saveEditorEd(self, ed):
3448 """ 3448 """
3449 Public slot to save the contents of an editor. 3449 Public slot to save the contents of an editor.
3453 """ 3453 """
3454 if ed: 3454 if ed:
3455 if not ed.isModified(): 3455 if not ed.isModified():
3456 return True 3456 return True
3457 else: 3457 else:
3458 ok, newName = ed.saveFile() 3458 ok = ed.saveFile()
3459 if ok: 3459 if ok:
3460 self.setEditorName(ed, newName) 3460 self.setEditorName(ed, ed.getFileName())
3461 return ok 3461 return ok
3462 else: 3462 else:
3463 return False 3463 return False
3464 3464
3465 def saveCurrentEditor(self): 3465 def saveCurrentEditor(self):
3494 Public slot to save a list of editors. 3494 Public slot to save a list of editors.
3495 3495
3496 @param editors list of editors to be saved 3496 @param editors list of editors to be saved
3497 """ 3497 """
3498 for editor in editors: 3498 for editor in editors:
3499 ok, newName = editor.saveFile() 3499 ok = editor.saveFile()
3500 if ok: 3500 if ok:
3501 self.setEditorName(editor, newName) 3501 self.setEditorName(editor, editor.getFileName())
3502 3502
3503 def saveAllEditors(self): 3503 def saveAllEditors(self):
3504 """ 3504 """
3505 Public slot to save the contents of all editors. 3505 Public slot to save the contents of all editors.
3506 """ 3506 """
3507 for editor in self.editors: 3507 for editor in self.editors:
3508 ok, newName = editor.saveFile() 3508 ok = editor.saveFile()
3509 if ok: 3509 if ok:
3510 self.setEditorName(editor, newName) 3510 self.setEditorName(editor, editor.getFileName())
3511 3511
3512 # restart autosave timer 3512 # restart autosave timer
3513 if self.autosaveInterval > 0: 3513 if self.autosaveInterval > 0:
3514 self.autosaveTimer.start(self.autosaveInterval * 60000) 3514 self.autosaveTimer.start(self.autosaveInterval * 60000)
3515 3515
4636 4636
4637 Only named editors will be saved by the autosave timer. 4637 Only named editors will be saved by the autosave timer.
4638 """ 4638 """
4639 for editor in self.editors: 4639 for editor in self.editors:
4640 if editor.shouldAutosave(): 4640 if editor.shouldAutosave():
4641 ok, newName = editor.saveFile() 4641 ok = editor.saveFile()
4642 if ok: 4642 if ok:
4643 self.setEditorName(editor, newName) 4643 self.setEditorName(editor, editor.getFileName())
4644 4644
4645 # restart autosave timer 4645 # restart autosave timer
4646 if self.autosaveInterval > 0: 4646 if self.autosaveInterval > 0:
4647 self.autosaveTimer.start(self.autosaveInterval * 60000) 4647 self.autosaveTimer.start(self.autosaveInterval * 60000)
4648 4648

eric ide

mercurial