Tue, 18 Oct 2022 16:06:21 +0200
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
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 | |
8881
54e42bc2437a
Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8358
diff
changeset
|
3 | # Copyright (c) 2020 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
7809
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
4 | # |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
5 | |
7806
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 | 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
|
8 | """ |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | import json |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
11 | import os |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
13 | from PyQt6.QtCore import pyqtSlot |
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
14 | from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
16 | from eric7.EricWidgets import EricMessageBox |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | 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
|
19 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
20 | from eric7 import Globals |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
21 | from eric7.EricGui import EricPixmapCache |
7806
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 | |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | 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
|
25 | """ |
7809
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
26 | Class implementing a dialog to show information about the installation. |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
28 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | 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
|
30 | """ |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
32 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | @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
|
34 | @type QWidget |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
36 | super().__init__(parent) |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | self.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
38 | |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
39 | self.__deleteButton = self.buttonBox.addButton( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
40 | self.tr("Delete Info"), QDialogButtonBox.ButtonRole.ActionRole |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
41 | ) |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
42 | self.__deleteButton.clicked.connect(self.on_deleteButton_clicked) |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
43 | self.__updateButton = self.buttonBox.addButton( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
44 | self.tr("Upgrade Instructions"), QDialogButtonBox.ButtonRole.ActionRole |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
45 | ) |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
46 | self.__updateButton.clicked.connect(self.on_updateButton_clicked) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
47 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | self.__edited = False |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | self.__loaded = True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
50 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
51 | self.editButton.setIcon(EricPixmapCache.getIcon("infoEdit")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
52 | self.saveButton.setIcon(EricPixmapCache.getIcon("fileSave")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
53 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | infoFileName = Globals.getInstallInfoFilePath() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
55 | |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
56 | self.__deleteButton.setEnabled(os.path.exists(infoFileName)) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
57 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | try: |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | 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
|
60 | self.__info = json.load(infoFile) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
61 | |
7808
da107cd00f63
Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7807
diff
changeset
|
62 | 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
|
63 | 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
|
64 | else: |
da107cd00f63
Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7807
diff
changeset
|
65 | 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
|
66 | self.sudoLabel2.setText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
67 | self.tr("Yes") if self.__info["sudo"] else self.tr("No") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
68 | ) |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | self.userLabel.setText(self.__info["user"]) |
7809
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
70 | self.installedFromEdit.setText(self.__info["install_cwd"]) |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | 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
|
72 | 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
|
73 | 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
|
74 | self.virtenvLabel.setText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
75 | self.tr("Yes") if self.__info["virtualenv"] else self.tr("No") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
76 | ) |
7809
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
77 | self.remarksEdit.setPlainText(self.__info["remarks"]) |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | if self.__info["pip"]: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
79 | self.pipLabel.setText( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
80 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
81 | "'eric-ide' was installed from PyPI using the pip" " command." |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
82 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
83 | ) |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | else: |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | self.pipLabel.hide() |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | if self.__info["guessed"]: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
87 | self.guessLabel.setText( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
88 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
89 | "The information shown in this dialog was guessed at" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
90 | " the first start of eric." |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
91 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
92 | ) |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | else: |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | self.guessLabel.hide() |
7809
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
95 | if self.__info["edited"]: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
96 | self.userProvidedLabel.setText( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
97 | self.tr("The installation information was provided by the user.") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
98 | ) |
7808
da107cd00f63
Install Information: added the installation date to the list of data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7807
diff
changeset
|
99 | else: |
7809
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
100 | self.userProvidedLabel.hide() |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
101 | if self.__info["installed_on"]: |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
102 | self.installDateTimeLabel.setText( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
103 | self.__info["installed_on"] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
104 | if self.__info["installed_on"] |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
105 | else self.tr("unknown") |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
106 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
107 | |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
108 | self.__updateButton.setEnabled(bool(self.__info["exe"])) |
7836
2f0d208b8137
Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7810
diff
changeset
|
109 | except OSError as err: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
110 | EricMessageBox.critical( |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | self, |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | self.tr("Load Install Information"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
113 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
114 | "<p>The file containing the install information could" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
115 | " not be read.</p><p>Reason: {0}</p>" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
116 | "" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
117 | ).format(str(err)), |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | ) |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | self.__loaded = False |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | self.__info = {} |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
121 | |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
122 | self.__updateButton.setEnabled(False) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
123 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | def wasLoaded(self): |
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 | Public method to check, if the install data was loaded. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
127 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | @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
|
129 | @rtype bool |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | """ |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | return self.__loaded |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
132 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | @pyqtSlot(bool) |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | 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
|
135 | """ |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | Private slot to switch the dialog into edit mode. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
137 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | @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
|
139 | @type bool |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | """ |
7809
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
141 | self.installedFromEdit.setReadOnly(not checked) |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | 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
|
143 | 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
|
144 | 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
|
145 | self.remarksEdit.setReadOnly(not checked) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
146 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | if checked: |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | self.__edited = True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
149 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | @pyqtSlot() |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | 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
|
152 | """ |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | 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
|
154 | """ |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | if self.__edited: |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | self.__saveData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
157 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | @pyqtSlot() |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | def reject(self): |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | """ |
7809
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
161 | Public slot handling the closing of the dialog. |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | """ |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | if self.__edited: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
164 | yes = EricMessageBox.yesNo( |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | self, |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | self.tr("Install Information"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
167 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
168 | """The install information was edited. Unsaved""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
169 | """ changes will be lost. Save first?""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
170 | ), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
171 | yesDefault=True, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
172 | ) |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
173 | if yes: |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
174 | self.__saveData() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
175 | |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
176 | super().reject() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
177 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | def __saveData(self): |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | """ |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | 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
|
181 | """ |
7809
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
182 | if self.installedFromEdit.text() != self.__info["install_cwd"]: |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
183 | self.__info["install_cwd"] = self.installedFromEdit.text() |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
184 | self.__info["install_cwd_edited"] = True |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
185 | if self.interpreteEdit.text() != self.__info["exe"]: |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
186 | self.__info["exe"] = self.interpreteEdit.text() |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
187 | self.__info["exe_edited"] = True |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
188 | if self.commandEdit.text() != self.__info["argv"]: |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
189 | self.__info["argv"] = self.commandEdit.text() |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
190 | self.__info["argv_edited"] = True |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
191 | if self.installPathEdit.text() != self.__info["eric"]: |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
192 | self.__info["eric"] = self.installPathEdit.text() |
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
193 | self.__info["eric_edited"] = True |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | 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
|
195 | self.__info["edited"] = True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
196 | |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | infoFileName = Globals.getInstallInfoFilePath() |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
198 | try: |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | with open(infoFileName, "w") as infoFile: |
7809
f5a61d073100
Added information about the directory the installation was done from.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7808
diff
changeset
|
200 | json.dump(self.__info, infoFile, indent=2) |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
201 | self.__edited = False |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
202 | self.editButton.setChecked(False) |
7836
2f0d208b8137
Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7810
diff
changeset
|
203 | except OSError as err: |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
204 | EricMessageBox.critical( |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | self, |
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | self.tr("Save Install Information"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
207 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
208 | "<p>The file containing the install information could" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
209 | " not be written.</p><p>Reason: {0}</p>" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
210 | "" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
211 | ).format(str(err)), |
7806
b346755b09a1
Main Window: added a dialog showing information about the installation process.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
213 | |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
214 | @pyqtSlot() |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
215 | def on_deleteButton_clicked(self): |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
216 | """ |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
217 | Private slot deleting the install information file. |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
218 | """ |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
219 | res = EricMessageBox.yesNo( |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
220 | self, |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
221 | self.tr("Delete Installation Information"), |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
222 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
223 | """Do you really want to delete the installation""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
224 | """ information? It will be recreated at the next""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
225 | """ start.""" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
226 | ), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
227 | ) |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
228 | if not res: |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
229 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
230 | |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
231 | infoFileName = Globals.getInstallInfoFilePath() |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
232 | os.remove(infoFileName) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
233 | |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
234 | # local data will be deleted automatically |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
235 | self.__edited = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
236 | |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
237 | self.close() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
238 | |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
239 | @pyqtSlot() |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
240 | def on_updateButton_clicked(self): |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
241 | """ |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
242 | Private slot to show some upgrade instructions. |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
243 | """ |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
244 | updateTextList = [] |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
245 | cmdPrefix = "" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
246 | |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
247 | if self.__info["sudo"]: |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
248 | if Globals.isWindowsPlatform(): |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
249 | updateTextList.append( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
250 | self.tr( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
251 | "Perform the following step(s) with Administrator" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
252 | " privileges.\n" |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
253 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
254 | ) |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
255 | else: |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
256 | cmdPrefix = "sudo " |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
257 | |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
258 | if self.__info["pip"]: |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
259 | updateTextList.append( |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
260 | "{0}{1} -m pip install --upgrade eric-ide".format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
261 | cmdPrefix, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
262 | self.__info["exe"], |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
263 | ) |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
264 | ) |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
265 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
266 | if "install_cwd" in self.__info and bool(self.__info["install_cwd"]): |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
267 | updateTextList.append("cd {0}".format(self.__info["install_cwd"])) |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
268 | updateTextList.append( |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
269 | "{0}{1} {2}".format( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
270 | cmdPrefix, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
271 | self.__info["exe"], |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
272 | self.__info["argv"], |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
273 | ) |
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
274 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
275 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
276 | from eric7.EricWidgets.EricPlainTextDialog import EricPlainTextDialog |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
277 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
278 | dlg = EricPlainTextDialog( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
279 | title=self.tr("Upgrade Instructions"), text="\n".join(updateTextList) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
280 | ) |
7810
f8afd2238723
Install Info: extended the dialog by a delete action and an action to show upgrade instructions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7809
diff
changeset
|
281 | dlg.exec() |