8 """ |
8 """ |
9 |
9 |
10 from PyQt6.QtCore import pyqtSlot, QCoreApplication |
10 from PyQt6.QtCore import pyqtSlot, QCoreApplication |
11 from PyQt6.QtWidgets import QDialog, QTreeWidgetItem, QComboBox |
11 from PyQt6.QtWidgets import QDialog, QTreeWidgetItem, QComboBox |
12 |
12 |
13 from E5Gui import E5MessageBox |
13 from E5Gui import EricMessageBox |
14 |
14 |
15 from Ui_HgHisteditPlanEditor import Ui_HgHisteditPlanEditor |
15 from Ui_HgHisteditPlanEditor import Ui_HgHisteditPlanEditor |
16 |
16 |
17 import UI.PixmapCache |
17 import UI.PixmapCache |
18 |
18 |
104 """ |
104 """ |
105 try: |
105 try: |
106 with open(self.__fileName, "r") as f: |
106 with open(self.__fileName, "r") as f: |
107 txt = f.read() |
107 txt = f.read() |
108 except OSError as err: |
108 except OSError as err: |
109 E5MessageBox.critical( |
109 EricMessageBox.critical( |
110 self, |
110 self, |
111 self.tr("Edit Plan"), |
111 self.tr("Edit Plan"), |
112 self.tr("""<p>The file <b>{0}</b> could not be read.</p>""" |
112 self.tr("""<p>The file <b>{0}</b> could not be read.</p>""" |
113 """<p>Reason: {1}</p>""").format( |
113 """<p>Reason: {1}</p>""").format( |
114 self.__fileName, str(err))) |
114 self.__fileName, str(err))) |
234 text = self.__assembleEditPlan() |
234 text = self.__assembleEditPlan() |
235 try: |
235 try: |
236 with open(self.__fileName, "w") as f: |
236 with open(self.__fileName, "w") as f: |
237 f.write(text) |
237 f.write(text) |
238 except OSError as err: |
238 except OSError as err: |
239 E5MessageBox.critical( |
239 EricMessageBox.critical( |
240 self, |
240 self, |
241 self.tr("Edit Plan"), |
241 self.tr("Edit Plan"), |
242 self.tr("""<p>The file <b>{0}</b> could not be read.</p>""" |
242 self.tr("""<p>The file <b>{0}</b> could not be read.</p>""" |
243 """<p>Reason: {1}</p>""").format( |
243 """<p>Reason: {1}</p>""").format( |
244 self.__fileName, str(err))) |
244 self.__fileName, str(err))) |