eric7/UI/InstallInfoDialog.py

branch
eric7
changeset 8356
68ec9c3d4de5
parent 8318
962bce857696
child 8358
144a6b854f70
equal deleted inserted replaced
8355:8a7677a63c8d 8356:68ec9c3d4de5
11 import os 11 import os
12 12
13 from PyQt6.QtCore import pyqtSlot 13 from PyQt6.QtCore import pyqtSlot
14 from PyQt6.QtWidgets import QDialog, QDialogButtonBox 14 from PyQt6.QtWidgets import QDialog, QDialogButtonBox
15 15
16 from E5Gui import E5MessageBox 16 from E5Gui import EricMessageBox
17 17
18 from .Ui_InstallInfoDialog import Ui_InstallInfoDialog 18 from .Ui_InstallInfoDialog import Ui_InstallInfoDialog
19 19
20 import Globals 20 import Globals
21 import UI.PixmapCache 21 import UI.PixmapCache
94 self.__info["installed_on"] if self.__info["installed_on"] 94 self.__info["installed_on"] if self.__info["installed_on"]
95 else self.tr("unknown")) 95 else self.tr("unknown"))
96 96
97 self.__updateButton.setEnabled(bool(self.__info["exe"])) 97 self.__updateButton.setEnabled(bool(self.__info["exe"]))
98 except OSError as err: 98 except OSError as err:
99 E5MessageBox.critical( 99 EricMessageBox.critical(
100 self, 100 self,
101 self.tr("Load Install Information"), 101 self.tr("Load Install Information"),
102 self.tr("<p>The file containing the install information could" 102 self.tr("<p>The file containing the install information could"
103 " not be read.</p><p>Reason: {0}</p>""") 103 " not be read.</p><p>Reason: {0}</p>""")
104 .format(str(err)) 104 .format(str(err))
146 def reject(self): 146 def reject(self):
147 """ 147 """
148 Public slot handling the closing of the dialog. 148 Public slot handling the closing of the dialog.
149 """ 149 """
150 if self.__edited: 150 if self.__edited:
151 yes = E5MessageBox.yesNo( 151 yes = EricMessageBox.yesNo(
152 self, 152 self,
153 self.tr("Install Information"), 153 self.tr("Install Information"),
154 self.tr("""The install information was edited. Unsaved""" 154 self.tr("""The install information was edited. Unsaved"""
155 """ changes will be lost. Save first?"""), 155 """ changes will be lost. Save first?"""),
156 yesDefault=True) 156 yesDefault=True)
183 with open(infoFileName, "w") as infoFile: 183 with open(infoFileName, "w") as infoFile:
184 json.dump(self.__info, infoFile, indent=2) 184 json.dump(self.__info, infoFile, indent=2)
185 self.__edited = False 185 self.__edited = False
186 self.editButton.setChecked(False) 186 self.editButton.setChecked(False)
187 except OSError as err: 187 except OSError as err:
188 E5MessageBox.critical( 188 EricMessageBox.critical(
189 self, 189 self,
190 self.tr("Save Install Information"), 190 self.tr("Save Install Information"),
191 self.tr("<p>The file containing the install information could" 191 self.tr("<p>The file containing the install information could"
192 " not be written.</p><p>Reason: {0}</p>""") 192 " not be written.</p><p>Reason: {0}</p>""")
193 .format(str(err)) 193 .format(str(err))
196 @pyqtSlot() 196 @pyqtSlot()
197 def on_deleteButton_clicked(self): 197 def on_deleteButton_clicked(self):
198 """ 198 """
199 Private slot deleting the install information file. 199 Private slot deleting the install information file.
200 """ 200 """
201 res = E5MessageBox.yesNo( 201 res = EricMessageBox.yesNo(
202 self, 202 self,
203 self.tr("Delete Installation Information"), 203 self.tr("Delete Installation Information"),
204 self.tr("""Do you really want to delete the installation""" 204 self.tr("""Do you really want to delete the installation"""
205 """ information? It will be recreated at the next""" 205 """ information? It will be recreated at the next"""
206 """ start.""")) 206 """ start."""))
249 "{0}{1} {2}".format( 249 "{0}{1} {2}".format(
250 cmdPrefix, self.__info["exe"], self.__info["argv"], 250 cmdPrefix, self.__info["exe"], self.__info["argv"],
251 ) 251 )
252 ) 252 )
253 253
254 from E5Gui.E5PlainTextDialog import E5PlainTextDialog 254 from E5Gui.EricPlainTextDialog import EricPlainTextDialog
255 dlg = E5PlainTextDialog( 255 dlg = EricPlainTextDialog(
256 title=self.tr("Upgrade Instructions"), 256 title=self.tr("Upgrade Instructions"),
257 text="\n".join(updateTextList)) 257 text="\n".join(updateTextList))
258 dlg.exec() 258 dlg.exec()

eric ide

mercurial