eric6/UI/InstallInfoDialog.py

Wed, 21 Oct 2020 20:00:57 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 21 Oct 2020 20:00:57 +0200
changeset 7807
5514ca6a62ca
parent 7806
b346755b09a1
child 7808
da107cd00f63
permissions
-rw-r--r--

Install Info: added the installation date and time to the install info structure.

7806
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 Module implementing a dialog to show information about the installation.
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 import json
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 from PyQt5.QtCore import pyqtSlot
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt5.QtWidgets import QDialog
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from E5Gui import E5MessageBox
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from .Ui_InstallInfoDialog import Ui_InstallInfoDialog
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import Globals
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 import UI.PixmapCache
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
7807
5514ca6a62ca Install Info: added the installation date and time to the install info structure.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7806
diff changeset
20 # TODO: add install date output
7806
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 class InstallInfoDialog(QDialog, Ui_InstallInfoDialog):
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Class documentation goes here.
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 def __init__(self, parent=None):
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 Constructor
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param parent reference to the parent widget
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @type QWidget
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 super(InstallInfoDialog, self).__init__(parent)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 self.setupUi(self)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.__edited = False
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.__loaded = True
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.editButton.setIcon(UI.PixmapCache.getIcon("infoEdit"))
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.saveButton.setIcon(UI.PixmapCache.getIcon("fileSave"))
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 infoFileName = Globals.getInstallInfoFilePath()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 try:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 with open(infoFileName, "r") as infoFile:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.__info = json.load(infoFile)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.sudoLabel.setText(
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.tr("Yes") if self.__info["sudo"] else self.tr("No"))
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.userLabel.setText(self.__info["user"])
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 self.interpreteEdit.setText(self.__info["exe"])
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.commandEdit.setText(self.__info["argv"])
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.installPathEdit.setText(self.__info["eric"])
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 self.virtenvLabel.setText(
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 self.tr("Yes") if self.__info["virtualenv"] else self.tr("No"))
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 if self.__info["pip"]:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 self.pipLabel.setText(self.tr(
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 "'eric-ide' was installed from PyPI using the pip"
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 " command."))
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 else:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 self.pipLabel.hide()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 if self.__info["guessed"]:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.guessLabel.setText(self.tr(
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 "The information shown in this dialog was guessed at"
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 " the first start of eric."))
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 else:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 self.guessLabel.hide()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.remarksEdit.setPlainText(self.__info["remarks"])
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 except EnvironmentError as err:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 E5MessageBox.critical(
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self,
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.tr("Load Install Information"),
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.tr("<p>The file containing the install information could"
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 " not be read.</p><p>Reason: {0}</p>""")
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 .format(str(err))
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 )
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 self.__loaded = False
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.__info = {}
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 def wasLoaded(self):
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 Public method to check, if the install data was loaded.
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 @return flag indicating the data was loaded
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 @rtype bool
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 return self.__loaded
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 @pyqtSlot(bool)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 def on_editButton_toggled(self, checked):
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 Private slot to switch the dialog into edit mode.
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 @param checked flag giving the button check state
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 @type bool
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 self.interpreteEdit.setReadOnly(not checked)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 self.commandEdit.setReadOnly(not checked)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 self.installPathEdit.setReadOnly(not checked)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 self.remarksEdit.setReadOnly(not checked)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 if checked:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 self.__edited = True
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 @pyqtSlot()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 def on_saveButton_clicked(self):
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 Private slot handling the save button press.
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 if self.__edited:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 self.__saveData()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 @pyqtSlot()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 def reject(self):
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 Private slot handling the closing of the dialog.
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 if self.__edited:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 yes = E5MessageBox.yesNo(
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 self,
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 self.tr("Install Information"),
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 self.tr("""The install information was edited. Unsaved"""
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 """ changes will be lost. Save first?"""),
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 yesDefault=True)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 if yes:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 self.__saveData()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 super(InstallInfoDialog, self).reject()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 def __saveData(self):
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 Private method to save the data.
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 self.__info["exe"] = self.interpreteEdit.text()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 self.__info["argv"] = self.commandEdit.text()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 self.__info["eric"] = self.installPathEdit.text()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 self.__info["remarks"] = self.remarksEdit.toPlainText()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 self.__info["edited"] = True
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 infoFileName = Globals.getInstallInfoFilePath()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 try:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 with open(infoFileName, "w") as infoFile:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 json.dump(self.__info, infoFile, indent=2)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 self.__edited = False
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 self.editButton.setChecked(False)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 except EnvironmentError as err:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 E5MessageBox.critical(
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 self,
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 self.tr("Save Install Information"),
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 self.tr("<p>The file containing the install information could"
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 " not be written.</p><p>Reason: {0}</p>""")
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 .format(str(err))
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 )

eric ide

mercurial