QScintilla/MiniEditor.py

changeset 537
72b32daeb8d6
parent 500
c3abc7895a01
child 539
87f9bce38a44
equal deleted inserted replaced
536:6d8d39753c82 537:72b32daeb8d6
13 from PyQt4.QtCore import * 13 from PyQt4.QtCore import *
14 from PyQt4.QtGui import * 14 from PyQt4.QtGui import *
15 from PyQt4.Qsci import QsciScintilla 15 from PyQt4.Qsci import QsciScintilla
16 16
17 from E5Gui.E5Action import E5Action, createActionGroup 17 from E5Gui.E5Action import E5Action, createActionGroup
18 from E5Gui import E5MessageBox
18 19
19 from . import Lexers 20 from . import Lexers
20 from .QsciScintillaCompat import QsciScintillaCompat 21 from .QsciScintillaCompat import QsciScintillaCompat
21 from .SearchReplaceWidget import SearchReplaceWidget 22 from .SearchReplaceWidget import SearchReplaceWidget
22 23
1501 1502
1502 try: 1503 try:
1503 txt, self.encoding = Utilities.readEncodedFile(fileName) 1504 txt, self.encoding = Utilities.readEncodedFile(fileName)
1504 except (UnicodeDecodeError, IOError) as why: 1505 except (UnicodeDecodeError, IOError) as why:
1505 QApplication.restoreOverrideCursor() 1506 QApplication.restoreOverrideCursor()
1506 QMessageBox.critical(self, self.trUtf8('Open File'), 1507 E5MessageBox.critical(self, self.trUtf8('Open File'),
1507 self.trUtf8('<p>The file <b>{0}</b> could not be opened.</p>' 1508 self.trUtf8('<p>The file <b>{0}</b> could not be opened.</p>'
1508 '<p>Reason: {1}</p>') 1509 '<p>Reason: {1}</p>')
1509 .format(fileName, str(why))) 1510 .format(fileName, str(why)))
1510 QApplication.restoreOverrideCursor() 1511 QApplication.restoreOverrideCursor()
1511 return 1512 return
1534 QApplication.setOverrideCursor(Qt.WaitCursor) 1535 QApplication.setOverrideCursor(Qt.WaitCursor)
1535 txt = self.__textEdit.text() 1536 txt = self.__textEdit.text()
1536 try: 1537 try:
1537 self.encoding = Utilities.writeEncodedFile(fileName, txt, self.encoding) 1538 self.encoding = Utilities.writeEncodedFile(fileName, txt, self.encoding)
1538 except (IOError, Utilities.CodingError, UnicodeError) as why: 1539 except (IOError, Utilities.CodingError, UnicodeError) as why:
1539 QMessageBox.critical(self, self.trUtf8('Save File'), 1540 E5MessageBox.critical(self, self.trUtf8('Save File'),
1540 self.trUtf8('<p>The file <b>{0}</b> could not be saved.<br/>' 1541 self.trUtf8('<p>The file <b>{0}</b> could not be saved.<br/>'
1541 'Reason: {1}</p>') 1542 'Reason: {1}</p>')
1542 .format(fileName, str(why))) 1543 .format(fileName, str(why)))
1543 QApplication.restoreOverrideCursor() 1544 QApplication.restoreOverrideCursor()
1544 1545

eric ide

mercurial