eric6/ViewManager/ViewManager.py

changeset 7836
2f0d208b8137
parent 7785
9978016560ec
child 7849
70e464748aaa
equal deleted inserted replaced
7835:0835ed67714b 7836:2f0d208b8137
4710 @rtype Editor 4710 @rtype Editor
4711 """ 4711 """
4712 try: 4712 try:
4713 newWin, editor = self.getEditor(fn, filetype=filetype, 4713 newWin, editor = self.getEditor(fn, filetype=filetype,
4714 addNext=addNext, indexes=indexes) 4714 addNext=addNext, indexes=indexes)
4715 except (IOError, UnicodeDecodeError): 4715 except (OSError, UnicodeDecodeError):
4716 return None 4716 return None
4717 4717
4718 if newWin: 4718 if newWin:
4719 self._modificationStatusChanged(editor.isModified(), editor) 4719 self._modificationStatusChanged(editor.isModified(), editor)
4720 self._checkActions(editor) 4720 self._checkActions(editor)
4879 @param error flag indicating an error highlight (boolean) 4879 @param error flag indicating an error highlight (boolean)
4880 @param syntaxError flag indicating a syntax error 4880 @param syntaxError flag indicating a syntax error
4881 """ 4881 """
4882 try: 4882 try:
4883 newWin, self.currentEditor = self.getEditor(fn) 4883 newWin, self.currentEditor = self.getEditor(fn)
4884 except (IOError, UnicodeDecodeError): 4884 except (OSError, UnicodeDecodeError):
4885 return 4885 return
4886 4886
4887 enc = self.currentEditor.getEncoding() 4887 enc = self.currentEditor.getEncoding()
4888 lang = self.currentEditor.getLanguage() 4888 lang = self.currentEditor.getLanguage()
4889 eol = self.currentEditor.getEolIndicator() 4889 eol = self.currentEditor.getEolIndicator()
6583 """ 6583 """
6584 if os.path.exists(dictionaryFile): 6584 if os.path.exists(dictionaryFile):
6585 try: 6585 try:
6586 with open(dictionaryFile, "r", encoding="utf-8") as f: 6586 with open(dictionaryFile, "r", encoding="utf-8") as f:
6587 data = f.read() 6587 data = f.read()
6588 except (IOError, OSError) as err: 6588 except OSError as err:
6589 E5MessageBox.critical( 6589 E5MessageBox.critical(
6590 self.ui, 6590 self.ui,
6591 QCoreApplication.translate( 6591 QCoreApplication.translate(
6592 'ViewManager', "Edit Spelling Dictionary"), 6592 'ViewManager', "Edit Spelling Dictionary"),
6593 QCoreApplication.translate( 6593 QCoreApplication.translate(
6612 if dlg.exec() == QDialog.Accepted: 6612 if dlg.exec() == QDialog.Accepted:
6613 data = dlg.getData() 6613 data = dlg.getData()
6614 try: 6614 try:
6615 with open(dictionaryFile, "w", encoding="utf-8") as f: 6615 with open(dictionaryFile, "w", encoding="utf-8") as f:
6616 f.write(data) 6616 f.write(data)
6617 except (IOError, OSError) as err: 6617 except OSError as err:
6618 E5MessageBox.critical( 6618 E5MessageBox.critical(
6619 self.ui, 6619 self.ui,
6620 QCoreApplication.translate( 6620 QCoreApplication.translate(
6621 'ViewManager', "Edit Spelling Dictionary"), 6621 'ViewManager', "Edit Spelling Dictionary"),
6622 QCoreApplication.translate( 6622 QCoreApplication.translate(

eric ide

mercurial