ViewManager/ViewManager.py

changeset 549
fe99d46d56c8
parent 548
ac7af05dd54a
child 559
ee695ebbd6e0
equal deleted inserted replaced
548:ac7af05dd54a 549:fe99d46d56c8
12 from PyQt4.QtCore import * 12 from PyQt4.QtCore import *
13 from PyQt4.QtGui import * 13 from PyQt4.QtGui import *
14 from PyQt4.Qsci import QsciScintilla 14 from PyQt4.Qsci import QsciScintilla
15 15
16 from E5Gui.E5Application import e5App 16 from E5Gui.E5Application import e5App
17 from E5Gui import E5FileDialog 17 from E5Gui import E5FileDialog, E5MessageBox
18 18
19 from Globals import recentNameFiles 19 from Globals import recentNameFiles
20 20
21 import Preferences 21 import Preferences
22 22
2993 2993
2994 if fn is None: 2994 if fn is None:
2995 fn = editor.getNoName() 2995 fn = editor.getNoName()
2996 autosave = False 2996 autosave = False
2997 if autosave: 2997 if autosave:
2998 res = QMessageBox.Save 2998 res = editor.saveFile()
2999 else: 2999 else:
3000 res = E5MessageBox.warning(self.ui, 3000 res = E5MessageBox.okToClearData(self.ui,
3001 QApplication.translate('ViewManager', "File Modified"), 3001 QApplication.translate('ViewManager', "File Modified"),
3002 QApplication.translate('ViewManager', 3002 QApplication.translate('ViewManager',
3003 """<p>The file <b>{0}</b> has unsaved changes.</p>""") 3003 """<p>The file <b>{0}</b> has unsaved changes.</p>""")
3004 .format(fn), 3004 .format(fn),
3005 QMessageBox.StandardButtons(\ 3005 editor.saveFile)
3006 QMessageBox.Abort | \ 3006 if res:
3007 QMessageBox.Discard | \ 3007 self.setEditorName(editor, editor.getFileName())
3008 QMessageBox.Save), 3008 return res
3009 QMessageBox.Save)
3010 if res == QMessageBox.Save:
3011 ok = editor.saveFile()
3012 if ok:
3013 self.setEditorName(editor, editor.getFileName())
3014 return ok
3015 elif res == QMessageBox.Abort:
3016 return False
3017 3009
3018 return True 3010 return True
3019 3011
3020 def checkAllDirty(self): 3012 def checkAllDirty(self):
3021 """ 3013 """

eric ide

mercurial