eric6/UI/InstallInfoDialog.py

Thu, 22 Oct 2020 17:59:54 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 22 Oct 2020 17:59:54 +0200
changeset 7808
da107cd00f63
parent 7807
5514ca6a62ca
child 7809
f5a61d073100
permissions
-rw-r--r--

Install Information: added the installation date to the list of data.

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
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 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
21 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 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
23 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 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
25 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 Constructor
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @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
29 @type QWidget
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 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
32 self.setupUi(self)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 self.__edited = False
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.__loaded = True
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 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
38 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
39
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 infoFileName = Globals.getInstallInfoFilePath()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 try:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 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
43 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
44
7808
da107cd00f63 Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7807
diff changeset
45 if Globals.isWindowsPlatform():
da107cd00f63 Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7807
diff changeset
46 self.sudoLabel1.setText(self.tr("Installed as Administrator:"))
da107cd00f63 Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7807
diff changeset
47 else:
da107cd00f63 Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7807
diff changeset
48 self.sudoLabel1.setText(self.tr("Installed with sudo:"))
da107cd00f63 Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7807
diff changeset
49 self.sudoLabel2.setText(
7806
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 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
51 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
52 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
53 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
54 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
55 self.virtenvLabel.setText(
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 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
57 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
58 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
59 "'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
60 " command."))
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 else:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 self.pipLabel.hide()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 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
64 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
65 "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
66 " 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
67 else:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.guessLabel.hide()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.remarksEdit.setPlainText(self.__info["remarks"])
7808
da107cd00f63 Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7807
diff changeset
70 if "installed_on" in self.__info:
da107cd00f63 Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7807
diff changeset
71 self.installDateTimeLabel.setText(self.__info["installed_on"])
da107cd00f63 Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7807
diff changeset
72 else:
da107cd00f63 Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7807
diff changeset
73 self.installDateTimeLabel.setText(self.tr("unknown"))
7806
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 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
75 E5MessageBox.critical(
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self,
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 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
78 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
79 " 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
80 .format(str(err))
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 self.__loaded = False
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 self.__info = {}
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 def wasLoaded(self):
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 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
88
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 @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
90 @rtype bool
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 return self.__loaded
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 @pyqtSlot(bool)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 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
96 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 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
98
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 @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
100 @type bool
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 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
103 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
104 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
105 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
106
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 if checked:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 self.__edited = True
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 @pyqtSlot()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 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
112 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 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
114 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 if self.__edited:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 self.__saveData()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 @pyqtSlot()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 def reject(self):
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 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
122 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 if self.__edited:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 yes = E5MessageBox.yesNo(
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 self,
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 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
127 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
128 """ 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
129 yesDefault=True)
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 if yes:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 self.__saveData()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 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
134
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 def __saveData(self):
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 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
138 """
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 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
140 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
141 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
142 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
143 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
144
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 infoFileName = Globals.getInstallInfoFilePath()
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 try:
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 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
148 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
149 self.__edited = False
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 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
151 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
152 E5MessageBox.critical(
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 self,
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 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
155 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
156 " 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
157 .format(str(err))
b346755b09a1 Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 )

eric ide

mercurial