4493 """ |
4493 """ |
4494 Public slot to open some files. |
4494 Public slot to open some files. |
4495 |
4495 |
4496 @param prog name of file to be opened (string) |
4496 @param prog name of file to be opened (string) |
4497 """ |
4497 """ |
4498 prog = Utilities.normabspath(prog) |
4498 prog = os.path.abspath(prog) |
4499 # Open up the new files. |
4499 # Open up the new files. |
4500 self.openSourceFile(prog) |
4500 self.openSourceFile(prog) |
4501 |
4501 |
4502 def checkDirty(self, editor, autosave=False): |
4502 def checkDirty(self, editor, autosave=False): |
4503 """ |
4503 """ |
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( |