src/eric7/PluginManager/PluginRepositoryDialog.py

Thu, 07 Jul 2022 11:23:56 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 07 Jul 2022 11:23:56 +0200
branch
eric7
changeset 9209
b99e7fd55fd3
parent 9031
eric7/PluginManager/PluginRepositoryDialog.py@8c9013b363bc
child 9221
bf71ee032bb4
permissions
-rw-r--r--

Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8663
diff changeset
3 # Copyright (c) 2007 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog showing the available plugins.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import zipfile
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
12 import glob
5975
3bc24855b254 Fixed an issue cleaning up the plug-in download area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5868
diff changeset
13 import re
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
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: 8314
diff changeset
15 from PyQt6.QtCore import (
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
16 pyqtSignal, pyqtSlot, Qt, QFile, QIODevice, QUrl, QProcess, QPoint,
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
17 QCoreApplication
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
18 )
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: 8314
diff changeset
19 from PyQt6.QtWidgets import (
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
20 QWidget, QDialogButtonBox, QAbstractButton, QTreeWidgetItem, QDialog,
8644
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
21 QVBoxLayout, QHBoxLayout, QMenu, QLabel, QToolButton
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
22 )
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: 8314
diff changeset
23 from PyQt6.QtNetwork import (
8580
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
24 QNetworkAccessManager, QNetworkRequest, QNetworkReply, QNetworkInformation
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
25 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
27 from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
8358
144a6b854f70 Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8356
diff changeset
29 from EricWidgets import EricMessageBox
144a6b854f70 Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8356
diff changeset
30 from EricWidgets.EricMainWindow import EricMainWindow
144a6b854f70 Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8356
diff changeset
31 from EricWidgets.EricApplication import ericApp
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 501
diff changeset
32
8354
12ebd3934fef Renamed 'E5Utilities' to 'EricUtilities' and 'E5Network' to 'EricNetwork'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8351
diff changeset
33 from EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired
2354
c63de4af553d Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
34 try:
8366
2a9f5153c438 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
35 from EricNetwork.EricSslErrorHandler import (
2a9f5153c438 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
36 EricSslErrorHandler, EricSslErrorState
2a9f5153c438 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
37 )
2354
c63de4af553d Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
38 SSL_AVAILABLE = True
c63de4af553d Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
39 except ImportError:
c63de4af553d Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
40 SSL_AVAILABLE = False
286
652f5159f1c3 Prepared to have individual proxies per scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 270
diff changeset
41
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
42 import Globals
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 import UI.PixmapCache
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
48 from eric7config import getConfig
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 class PluginRepositoryWidget(QWidget, Ui_PluginRepositoryDialog):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 Class implementing a dialog showing the available plugins.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
55 @signal closeAndInstall() emitted when the Close & Install button is
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
56 pressed
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 """
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 465
diff changeset
58 closeAndInstall = pyqtSignal()
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 465
diff changeset
59
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
60 DescrRole = Qt.ItemDataRole.UserRole
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
61 UrlRole = Qt.ItemDataRole.UserRole + 1
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
62 FilenameRole = Qt.ItemDataRole.UserRole + 2
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
63 AuthorRole = Qt.ItemDataRole.UserRole + 3
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
64
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
65 PluginStatusUpToDate = 0
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
66 PluginStatusNew = 1
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
67 PluginStatusLocalUpdate = 2
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
68 PluginStatusRemoteUpdate = 3
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
69 PluginStatusError = 4
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
70
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
71 def __init__(self, pluginManager, integrated=False, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
75 @param pluginManager reference to the plugin manager object
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
76 @type PluginManager
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
77 @param integrated flag indicating the integration into the sidebar
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
78 @type bool
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
79 @param parent parent of this dialog
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
80 @type QWidget
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 """
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
82 super().__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
85 if pluginManager is None:
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
86 # started as external plug-in repository dialog
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
87 from .PluginManager import PluginManager
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
88 self.__pluginManager = PluginManager()
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
89 self.__external = True
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
90 else:
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
91 self.__pluginManager = pluginManager
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
92 self.__external = False
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
93 self.__integratedWidget = integrated
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
94
8604
d25390ea2f19 Changed the margins of some right side bar managed items to (0, 3, 0, 0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8597
diff changeset
95 if integrated:
d25390ea2f19 Changed the margins of some right side bar managed items to (0, 3, 0, 0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8597
diff changeset
96 self.layout().setContentsMargins(0, 3, 0, 0)
d25390ea2f19 Changed the margins of some right side bar managed items to (0, 3, 0, 0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8597
diff changeset
97
8644
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
98 if self.__integratedWidget:
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
99 self.__actionButtonsLayout = QHBoxLayout()
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
100 self.__actionButtonsLayout.addStretch()
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
101
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
102 self.__updateButton = QToolButton(self)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
103 self.__updateButton.setIcon(UI.PixmapCache.getIcon("reload"))
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
104 self.__updateButton.setToolTip(self.tr("Update"))
9031
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
105 self.__updateButton.clicked.connect(self.__updateList)
8644
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
106 self.__actionButtonsLayout.addWidget(self.__updateButton)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
107
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
108 self.__downloadButton = QToolButton(self)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
109 self.__downloadButton.setIcon(UI.PixmapCache.getIcon("download"))
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
110 self.__downloadButton.setToolTip(self.tr("Download"))
8930
5e3bd6f49a84 PluginRepositoryDialog: fixed a copy & paste issue causing a faulty signal-slot connection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
111 self.__downloadButton.clicked.connect(self.__downloadButtonClicked)
8644
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
112 self.__actionButtonsLayout.addWidget(self.__downloadButton)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
113
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
114 self.__downloadInstallButton = QToolButton(self)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
115 self.__downloadInstallButton.setIcon(
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
116 UI.PixmapCache.getIcon("downloadPlus"))
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
117 self.__downloadInstallButton.setToolTip(
8651
ce4c3c401482 Updated translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8645
diff changeset
118 self.tr("Download & Install"))
8644
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
119 self.__downloadInstallButton.clicked.connect(
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
120 self.__downloadInstallButtonClicked)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
121 self.__actionButtonsLayout.addWidget(self.__downloadInstallButton)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
122
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
123 self.__downloadCancelButton = QToolButton(self)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
124 self.__downloadCancelButton.setIcon(
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
125 UI.PixmapCache.getIcon("cancel"))
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
126 self.__downloadCancelButton.setToolTip(self.tr("Cancel"))
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
127 self.__downloadCancelButton.clicked.connect(self.__downloadCancel)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
128 self.__actionButtonsLayout.addWidget(self.__downloadCancelButton)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
129
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
130 self.__installButton = QToolButton(self)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
131 self.__installButton.setIcon(UI.PixmapCache.getIcon("plus"))
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
132 self.__installButton.setToolTip(self.tr("Install"))
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
133 self.__installButton.clicked.connect(self.__closeAndInstall)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
134 self.__actionButtonsLayout.addWidget(self.__installButton)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
135
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
136 self.__actionButtonsLayout.addStretch()
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
137
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
138 self.layout().addLayout(self.__actionButtonsLayout)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
139 self.buttonBox.hide()
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
140 else:
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
141 self.__updateButton = self.buttonBox.addButton(
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
142 self.tr("Update"), QDialogButtonBox.ButtonRole.ActionRole)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
143 self.__downloadButton = self.buttonBox.addButton(
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
144 self.tr("Download"), QDialogButtonBox.ButtonRole.ActionRole)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
145 self.__downloadInstallButton = self.buttonBox.addButton(
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
146 self.tr("Download && Install"),
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
147 QDialogButtonBox.ButtonRole.ActionRole)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
148 self.__downloadCancelButton = self.buttonBox.addButton(
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
149 self.tr("Cancel"), QDialogButtonBox.ButtonRole.ActionRole)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
150 self.__installButton = self.buttonBox.addButton(
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
151 self.tr("Close && Install"),
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
152 QDialogButtonBox.ButtonRole.ActionRole)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
153 if not self.__integratedWidget:
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
154 self.__closeButton = self.buttonBox.addButton(
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
155 self.tr("Close"), QDialogButtonBox.ButtonRole.RejectRole)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
156 self.__closeButton.setEnabled(True)
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
157
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 self.__downloadButton.setEnabled(False)
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
159 self.__downloadInstallButton.setEnabled(False)
7049
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
160 self.__downloadCancelButton.setEnabled(False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 self.__installButton.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
163 self.repositoryUrlEdit.setText(
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: 8314
diff changeset
164 Preferences.getUI("PluginRepositoryUrl7"))
1763
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
165
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
166 if self.__integratedWidget:
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
167 self.repositoryList.setHeaderHidden(True)
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
168 else:
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
169 self.repositoryList.headerItem().setText(
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
170 self.repositoryList.columnCount(), "")
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
171 self.repositoryList.header().setSortIndicator(
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
172 0, Qt.SortOrder.AscendingOrder)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
174 self.__pluginContextMenu = QMenu(self)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
175 self.__hideAct = self.__pluginContextMenu.addAction(
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
176 self.tr("Hide"), self.__hidePlugin)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
177 self.__hideSelectedAct = self.__pluginContextMenu.addAction(
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
178 self.tr("Hide Selected"), self.__hideSelectedPlugins)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
179 self.__pluginContextMenu.addSeparator()
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
180 self.__showAllAct = self.__pluginContextMenu.addAction(
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
181 self.tr("Show All"), self.__showAllPlugins)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
182 self.__pluginContextMenu.addSeparator()
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
183 self.__pluginContextMenu.addAction(
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
184 self.tr("Cleanup Downloads"), self.__cleanupDownloads)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
185
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
186 self.pluginRepositoryFile = os.path.join(Utilities.getConfigDir(),
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
187 "PluginRepository")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188
9031
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
189 self.__pluginManager.pluginRepositoryFileDownloaded.connect(
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
190 self.__populateList)
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
191
270
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
192 # attributes for the network objects
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
193 self.__networkManager = QNetworkAccessManager(self)
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 465
diff changeset
194 self.__networkManager.proxyAuthenticationRequired.connect(
286
652f5159f1c3 Prepared to have individual proxies per scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 270
diff changeset
195 proxyAuthenticationRequired)
798
5c1786fad576 Fixed an issue with Qt installations that don't support SSL.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
196 if SSL_AVAILABLE:
8354
12ebd3934fef Renamed 'E5Utilities' to 'EricUtilities' and 'E5Network' to 'EricNetwork'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8351
diff changeset
197 self.__sslErrorHandler = EricSslErrorHandler(self)
798
5c1786fad576 Fixed an issue with Qt installations that don't support SSL.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
198 self.__networkManager.sslErrors.connect(self.__sslErrors)
270
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
199 self.__replies = []
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
200
8580
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
201 if (
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
202 Preferences.getUI("DynamicOnlineCheck") and
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
203 QNetworkInformation.load(QNetworkInformation.Feature.Reachability)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
204 ):
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
205 self.__reachabilityChanged(
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
206 QNetworkInformation.instance().reachability())
8663
a925267d1545 Adapted to the official PyQt6 6.2.0 release.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8651
diff changeset
207 QNetworkInformation.instance().reachabilityChanged.connect(
a925267d1545 Adapted to the official PyQt6 6.2.0 release.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8651
diff changeset
208 self.__reachabilityChanged)
8580
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
209 else:
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
210 # assume to be 'always online' if no backend could be loaded or
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
211 # dynamic online check is switched of
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
212 self.__reachabilityChanged(QNetworkInformation.Reachability.Online)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
213
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 self.__pluginsToDownload = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 self.__pluginsDownloaded = []
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
216 self.__isDownloadInstall = False
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
217 self.__allDownloadedOk = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
219 self.__hiddenPlugins = Preferences.getPluginManager("HiddenPlugins")
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
220
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 self.__populateList()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222
8580
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
223 def __reachabilityChanged(self, reachability):
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
224 """
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
225 Private slot handling reachability state changes.
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
226
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
227 @param reachability new reachability state
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
228 @type QNetworkInformation.Reachability
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
229 """
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
230 online = reachability == QNetworkInformation.Reachability.Online
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
231 self.__online = online
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
232
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
233 self.__updateButton.setEnabled(online)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
234 self.on_repositoryList_itemSelectionChanged()
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
235
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
236 if not self.__integratedWidget:
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
237 msg = (
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
238 self.tr("Internet Reachability Status: Reachable")
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
239 if online else
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
240 self.tr("Internet Reachability Status: Not Reachable")
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
241 )
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
242 self.statusLabel.setText(msg)
8580
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
243
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 @pyqtSlot(QAbstractButton)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 def on_buttonBox_clicked(self, button):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 Private slot to handle the click of a button of the button box.
2960
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2824
diff changeset
248
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2824
diff changeset
249 @param button reference to the button pressed (QAbstractButton)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 if button == self.__updateButton:
9031
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
252 self.__updateList()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 elif button == self.__downloadButton:
8644
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
254 self.__downloadButtonClicked()
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
255 elif button == self.__downloadInstallButton:
8644
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
256 self.__downloadInstallButtonClicked()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 elif button == self.__downloadCancelButton:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 self.__downloadCancel()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 elif button == self.__installButton:
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
260 self.__closeAndInstall()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261
8644
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
262 @pyqtSlot()
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
263 def __downloadButtonClicked(self):
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
264 """
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
265 Private slot to handle a click of the Download button.
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
266 """
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
267 self.__isDownloadInstall = False
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
268 self.__downloadPlugins()
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
269
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
270 @pyqtSlot()
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
271 def __downloadInstallButtonClicked(self):
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
272 """
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
273 Private slot to handle a click of the Download & Install button.
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
274 """
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
275 self.__isDownloadInstall = True
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
276 self.__allDownloadedOk = True
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
277 self.__downloadPlugins()
4a84adb1216a Changed the button layout of the Plugin Repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8604
diff changeset
278
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 def __formatDescription(self, lines):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 Private method to format the description.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 @param lines lines of the description (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 @return formatted description (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 # remove empty line at start and end
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 newlines = lines[:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 if len(newlines) and newlines[0] == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 del newlines[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 if len(newlines) and newlines[-1] == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 del newlines[-1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 # replace empty lines by newline character
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 index = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 while index < len(newlines):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 if newlines[index] == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 newlines[index] = '\n'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 index += 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 # join lines by a blank
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 return ' '.join(newlines)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302
7049
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
303 def __changeScheme(self, url, newScheme=""):
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
304 """
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
305 Private method to change the scheme of the given URL.
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
306
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
307 @param url URL to be modified
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
308 @type str
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
309 @param newScheme scheme to be set for the given URL
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
310 @return modified URL
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
311 @rtype str
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
312 """
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
313 if not newScheme:
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
314 newScheme = self.repositoryUrlEdit.text().split("//", 1)[0]
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
315
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
316 return newScheme + "//" + url.split("//", 1)[1]
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
317
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
318 @pyqtSlot(QPoint)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
319 def on_repositoryList_customContextMenuRequested(self, pos):
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
320 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
321 Private slot to show the context menu.
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
322
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
323 @param pos position to show the menu (QPoint)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
324 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
325 self.__hideAct.setEnabled(
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
326 self.repositoryList.currentItem() is not None and
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
327 len(self.__selectedItems()) == 1)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
328 self.__hideSelectedAct.setEnabled(
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
329 len(self.__selectedItems()) > 1)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
330 self.__showAllAct.setEnabled(bool(self.__hasHiddenPlugins()))
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
331 self.__pluginContextMenu.popup(self.repositoryList.mapToGlobal(pos))
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
332
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 def on_repositoryList_currentItemChanged(self, current, previous):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 Private slot to handle the change of the current item.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 @param current reference to the new current item (QTreeWidgetItem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 @param previous reference to the old current item (QTreeWidgetItem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 if self.__repositoryMissing or current is None:
8597
57cdd880326b PluginRepositoryDialog: added lines to clear some form elements after the list of available plugins was repopulated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8595
diff changeset
342 self.descriptionEdit.clear()
57cdd880326b PluginRepositoryDialog: added lines to clear some form elements after the list of available plugins was repopulated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8595
diff changeset
343 self.authorEdit.clear()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345
7049
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
346 url = current.data(0, PluginRepositoryWidget.UrlRole)
8234
fcb6b4b96274 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8222
diff changeset
347 url = "" if url is None else self.__changeScheme(url)
7049
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
348 self.urlEdit.setText(url)
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
349 self.descriptionEdit.setPlainText(
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
350 current.data(0, PluginRepositoryWidget.DescrRole) and
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
351 self.__formatDescription(
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
352 current.data(0, PluginRepositoryWidget.DescrRole)) or "")
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
353 self.authorEdit.setText(
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
354 current.data(0, PluginRepositoryWidget.AuthorRole) or "")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 def __selectedItems(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 Private method to get all selected items without the toplevel ones.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 @return list of selected items (list)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 ql = self.repositoryList.selectedItems()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 for index in range(self.repositoryList.topLevelItemCount()):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 ti = self.repositoryList.topLevelItem(index)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365 if ti in ql:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 ql.remove(ti)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 return ql
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 def on_repositoryList_itemSelectionChanged(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 Private slot to handle a change of the selection.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 """
7946
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
374 enable = bool(self.__selectedItems())
8580
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
375 self.__downloadButton.setEnabled(enable and self.__online)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
376 self.__downloadInstallButton.setEnabled(enable and self.__online)
7946
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
377 self.__installButton.setEnabled(enable)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378
9031
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
379 def reloadList(self):
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
380 """
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
381 Public method to reload the list of plugins.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 """
9031
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
383 self.__populateList()
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
384
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
385 @pyqtSlot()
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
386 def __updateList(self):
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
387 """
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
388 Private slot to download a new list and display the contents.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 """
1763
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
390 url = self.repositoryUrlEdit.text()
9031
8c9013b363bc Fixed an issue related to updating the plug-in repository file and the respective view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9016
diff changeset
391 self.__pluginManager.downLoadRepositoryFile(url=url)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 def __downloadRepositoryFileDone(self, status, filename):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 Private method called after the repository file was downloaded.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 @param status flaging indicating a successful download (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 @param filename full path of the downloaded file (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 self.__populateList()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 def __downloadPluginDone(self, status, filename):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 Private method called, when the download of a plugin is finished.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
406 @param status flag indicating a successful download (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 @param filename full path of the downloaded file (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 if status:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 self.__pluginsDownloaded.append(filename)
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
411 if self.__isDownloadInstall:
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
412 self.__allDownloadedOk &= status
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413
8930
5e3bd6f49a84 PluginRepositoryDialog: fixed a copy & paste issue causing a faulty signal-slot connection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
414 if len(self.__pluginsToDownload):
5e3bd6f49a84 PluginRepositoryDialog: fixed a copy & paste issue causing a faulty signal-slot connection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
415 self.__pluginsToDownload.pop(0)
5e3bd6f49a84 PluginRepositoryDialog: fixed a copy & paste issue causing a faulty signal-slot connection.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
416
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 if len(self.__pluginsToDownload):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 self.__downloadPlugin()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 self.__downloadPluginsDone()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 def __downloadPlugin(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 Private method to download the next plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
426 self.__downloadFile(self.__pluginsToDownload[0][0],
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
427 self.__pluginsToDownload[0][1],
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 self.__downloadPluginDone)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 def __downloadPlugins(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 Private slot to download the selected plugins.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 self.__pluginsDownloaded = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 self.__pluginsToDownload = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 self.__downloadButton.setEnabled(False)
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
437 self.__downloadInstallButton.setEnabled(False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 self.__installButton.setEnabled(False)
7049
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
439
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
440 newScheme = self.repositoryUrlEdit.text().split("//", 1)[0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 for itm in self.repositoryList.selectedItems():
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
442 if itm not in [self.__stableItem, self.__unstableItem,
6023
c6dabc972560 Added an "obsolete" category to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5975
diff changeset
443 self.__unknownItem, self.__obsoleteItem]:
7049
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
444 url = self.__changeScheme(
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
445 itm.data(0, PluginRepositoryWidget.UrlRole),
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
446 newScheme)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 filename = os.path.join(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 Preferences.getPluginManager("DownloadPath"),
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
449 itm.data(0, PluginRepositoryWidget.FilenameRole))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450 self.__pluginsToDownload.append((url, filename))
8645
67eb147b3531 Fixed an issue in the plugin repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8644
diff changeset
451 if self.__pluginsToDownload:
67eb147b3531 Fixed an issue in the plugin repository widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8644
diff changeset
452 self.__downloadPlugin()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 def __downloadPluginsDone(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
455 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 Private method called, when the download of the plugins is finished.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458 self.__downloadButton.setEnabled(len(self.__selectedItems()))
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
459 self.__downloadInstallButton.setEnabled(len(self.__selectedItems()))
7049
0a8a9bd15242 PluginRepositoryDialog: implemented a workaround for the SSL issue with Qt 5.12.4 and Python < 3.7.4 to allow overwriting the URL scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
460 self.__installButton.setEnabled(len(self.__selectedItems()))
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: 8354
diff changeset
461 ui = (ericApp().getObject("UserInterface")
8234
fcb6b4b96274 Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8222
diff changeset
462 if not self.__external else None)
7955
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7946
diff changeset
463 if ui is not None:
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
464 ui.showNotification(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
465 UI.PixmapCache.getPixmap("plugin48"),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
466 self.tr("Download Plugin Files"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
467 self.tr("""The requested plugins were downloaded."""))
2192
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2101
diff changeset
468
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
469 if self.__isDownloadInstall:
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
470 self.closeAndInstall.emit()
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
471 else:
7955
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7946
diff changeset
472 if ui is None:
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: 8354
diff changeset
473 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
474 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
475 self.tr("Download Plugin Files"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
476 self.tr("""The requested plugins were downloaded."""))
7955
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7946
diff changeset
477
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
478 self.downloadProgress.setValue(0)
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
479
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
480 # repopulate the list to update the refresh icons
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
481 self.__populateList()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 def __resortRepositoryList(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485 Private method to resort the tree.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 """
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
487 self.repositoryList.sortItems(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
488 self.repositoryList.sortColumn(),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
489 self.repositoryList.header().sortIndicatorOrder())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
490
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491 def __populateList(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 Private method to populate the list of available plugins.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 self.repositoryList.clear()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 self.__stableItem = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 self.__unstableItem = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 self.__unknownItem = None
6023
c6dabc972560 Added an "obsolete" category to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5975
diff changeset
499 self.__obsoleteItem = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
500
5854
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
501 self.__newItems = 0
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
502 self.__updateLocalItems = 0
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
503 self.__updateRemoteItems = 0
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
504
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
505 self.downloadProgress.setValue(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 if os.path.exists(self.pluginRepositoryFile):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 self.__repositoryMissing = False
580
45c38566b001 Implemented the plug-in repository reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
509 f = QFile(self.pluginRepositoryFile)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
510 if f.open(QIODevice.OpenModeFlag.ReadOnly):
8366
2a9f5153c438 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
511 from EricXML.PluginRepositoryReader import (
2a9f5153c438 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
512 PluginRepositoryReader
2a9f5153c438 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
513 )
3113
2780e230f129 Continued implementing the automatic plug-in update check in the plug-in manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3112
diff changeset
514 reader = PluginRepositoryReader(f, self.addEntry)
580
45c38566b001 Implemented the plug-in repository reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
515 reader.readXML()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 self.repositoryList.resizeColumnToContents(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 self.repositoryList.resizeColumnToContents(1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 self.repositoryList.resizeColumnToContents(2)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 self.__resortRepositoryList()
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: 8314
diff changeset
520 url = Preferences.getUI("PluginRepositoryUrl7")
1763
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
521 if url != self.repositoryUrlEdit.text():
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
522 self.repositoryUrlEdit.setText(url)
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: 8354
diff changeset
523 EricMessageBox.warning(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
524 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
525 self.tr("Plugins Repository URL Changed"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
526 self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
527 """The URL of the Plugins Repository has"""
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
528 """ changed. Select the "Update" button to get"""
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
529 """ the new repository file."""))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 else:
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: 8354
diff changeset
531 EricMessageBox.critical(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
532 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
533 self.tr("Read plugins repository file"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
534 self.tr("<p>The plugins repository file <b>{0}</b> "
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
535 "could not be read. Select Update</p>")
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
536 .format(self.pluginRepositoryFile))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 self.__repositoryMissing = True
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
539 QTreeWidgetItem(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
540 self.repositoryList,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
541 ["", self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
542 "No plugin repository file available.\nSelect Update.")
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
543 ])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 self.repositoryList.resizeColumnToContents(1)
5854
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
545
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
546 self.newLabel.setText(self.tr("New: <b>{0}</b>")
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
547 .format(self.__newItems))
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
548 self.updateLocalLabel.setText(self.tr("Local Updates: <b>{0}</b>")
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
549 .format(self.__updateLocalItems))
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
550 self.updateRemoteLabel.setText(self.tr("Remote Updates: <b>{0}</b>")
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
551 .format(self.__updateRemoteItems))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
553 def __downloadFile(self, url, filename, doneMethod=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 Private slot to download the given file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 @param url URL for the download (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 @param filename local name of the file (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 @param doneMethod method to be called when done
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 """
8580
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
561 if self.__online:
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
562 self.__updateButton.setEnabled(False)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
563 self.__downloadButton.setEnabled(False)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
564 self.__downloadInstallButton.setEnabled(False)
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
565 if not self.__integratedWidget:
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
566 self.__closeButton.setEnabled(False)
8580
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
567 self.__downloadCancelButton.setEnabled(True)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
568
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
569 self.statusLabel.setText(url)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
570
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
571 request = QNetworkRequest(QUrl(url))
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
572 request.setAttribute(
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
573 QNetworkRequest.Attribute.CacheLoadControlAttribute,
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
574 QNetworkRequest.CacheLoadControl.AlwaysNetwork)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
575 reply = self.__networkManager.get(request)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
576 reply.finished.connect(
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
577 lambda: self.__downloadFileDone(reply, filename, doneMethod))
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
578 reply.downloadProgress.connect(self.__downloadProgress)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
579 self.__replies.append(reply)
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
580 else:
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
581 EricMessageBox.warning(
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
582 self,
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
583 self.tr("Error downloading file"),
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
584 self.tr(
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
585 """<p>Could not download the requested file"""
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
586 """ from {0}.</p><p>Error: {1}</p>"""
e91b276e0771 Re-introduced the Internet reachability checks.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8366
diff changeset
587 ).format(url, self.tr("No connection to Internet.")))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588
6156
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
589 def __downloadFileDone(self, reply, fileName, doneMethod):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
591 Private method called, after the file has been downloaded
5868
c1a98c164cd3 Started implementing a downloader and installer for web browser spell check dictionaries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5854
diff changeset
592 from the Internet.
6088
b7fdd0db835e Removed use of sender() in the plug-in repository dialog and the plug-in manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6064
diff changeset
593
b7fdd0db835e Removed use of sender() in the plug-in repository dialog and the plug-in manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6064
diff changeset
594 @param reply reference to the reply object of the download
b7fdd0db835e Removed use of sender() in the plug-in repository dialog and the plug-in manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6064
diff changeset
595 @type QNetworkReply
6156
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
596 @param fileName local name of the file
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
597 @type str
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
598 @param doneMethod method to be called when done
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
599 @type func
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
600 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 self.__updateButton.setEnabled(True)
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
602 if not self.__integratedWidget:
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
603 self.__closeButton.setEnabled(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 self.__downloadCancelButton.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 ok = True
270
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
607 if reply in self.__replies:
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
608 self.__replies.remove(reply)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
609 if reply.error() != QNetworkReply.NetworkError.NoError:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 ok = False
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
611 if (
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
612 reply.error() !=
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
613 QNetworkReply.NetworkError.OperationCanceledError
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
614 ):
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: 8354
diff changeset
615 EricMessageBox.warning(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
616 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
617 self.tr("Error downloading file"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
618 self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
619 """<p>Could not download the requested file"""
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
620 """ from {0}.</p><p>Error: {1}</p>"""
6156
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
621 ).format(reply.url().toString(), reply.errorString())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 )
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 self.downloadProgress.setValue(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624 if self.repositoryList.topLevelItemCount():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 if self.repositoryList.currentItem() is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 self.repositoryList.setCurrentItem(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 self.repositoryList.topLevelItem(0))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 else:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
629 self.__downloadButton.setEnabled(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
630 len(self.__selectedItems()))
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
631 self.__downloadInstallButton.setEnabled(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
632 len(self.__selectedItems()))
4626
c891c7ad6b60 Added some missing deleteLater() calls.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
633 reply.deleteLater()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635
6156
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
636 downloadIODevice = QFile(fileName + ".tmp")
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
637 downloadIODevice.open(QIODevice.OpenModeFlag.WriteOnly)
5755
83fe98028532 Fixed an issue causing the downloading of Plug-in archives bigger than 128MB to fail on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5739
diff changeset
638 # read data in chunks
83fe98028532 Fixed an issue causing the downloading of Plug-in archives bigger than 128MB to fail on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5739
diff changeset
639 chunkSize = 64 * 1024 * 1024
83fe98028532 Fixed an issue causing the downloading of Plug-in archives bigger than 128MB to fail on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5739
diff changeset
640 while True:
83fe98028532 Fixed an issue causing the downloading of Plug-in archives bigger than 128MB to fail on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5739
diff changeset
641 data = reply.read(chunkSize)
83fe98028532 Fixed an issue causing the downloading of Plug-in archives bigger than 128MB to fail on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5739
diff changeset
642 if data is None or len(data) == 0:
83fe98028532 Fixed an issue causing the downloading of Plug-in archives bigger than 128MB to fail on Windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5739
diff changeset
643 break
6156
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
644 downloadIODevice.write(data)
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
645 downloadIODevice.close()
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
646 if QFile.exists(fileName):
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
647 QFile.remove(fileName)
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
648 downloadIODevice.rename(fileName)
4626
c891c7ad6b60 Added some missing deleteLater() calls.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
649 reply.deleteLater()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
650
6156
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
651 if doneMethod is not None:
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
652 doneMethod(ok, fileName)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653
6156
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
654 def __downloadCancel(self, reply=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 Private slot to cancel the current download.
6156
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
657
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
658 @param reply reference to the network reply
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
659 @type QNetworkReply
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 """
8222
5994b80b8760 Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
661 if reply is None and bool(self.__replies):
5994b80b8760 Applied some more code simplifications suggested by the new Simplify checker (Y102: use single if) (batch 1).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
662 reply = self.__replies[0]
6156
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
663 self.__pluginsToDownload = []
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
664 if reply is not None:
270
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
665 reply.abort()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666
270
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
667 def __downloadProgress(self, done, total):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 Private slot to show the download progress.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 @param done number of bytes downloaded so far (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 @param total total bytes to be downloaded (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
673 """
270
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
674 if total:
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
675 self.downloadProgress.setMaximum(total)
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
676 self.downloadProgress.setValue(done)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
678 def addEntry(self, name, short, description, url, author, version,
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
679 filename, status):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
680 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681 Public method to add an entry to the list.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 @param name data for the name field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 @param short data for the short field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685 @param description data for the description field (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
686 @param url data for the url field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
687 @param author data for the author field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
688 @param version data for the version field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
689 @param filename data for the filename field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690 @param status status of the plugin (string [stable, unstable, unknown])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691 """
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
692 pluginName = filename.rsplit("-", 1)[0]
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
693 if pluginName in self.__hiddenPlugins:
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
694 return
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
695
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
696 if status == "stable":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 if self.__stableItem is None:
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
698 self.__stableItem = QTreeWidgetItem(
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
699 self.repositoryList, [self.tr("Stable")])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700 self.__stableItem.setExpanded(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
701 parent = self.__stableItem
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
702 elif status == "unstable":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
703 if self.__unstableItem is None:
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
704 self.__unstableItem = QTreeWidgetItem(
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
705 self.repositoryList, [self.tr("Unstable")])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
706 self.__unstableItem.setExpanded(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
707 parent = self.__unstableItem
6023
c6dabc972560 Added an "obsolete" category to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5975
diff changeset
708 elif status == "obsolete":
c6dabc972560 Added an "obsolete" category to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5975
diff changeset
709 if self.__obsoleteItem is None:
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
710 self.__obsoleteItem = QTreeWidgetItem(
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
711 self.repositoryList, [self.tr("Obsolete")])
6023
c6dabc972560 Added an "obsolete" category to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5975
diff changeset
712 self.__obsoleteItem.setExpanded(True)
c6dabc972560 Added an "obsolete" category to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5975
diff changeset
713 parent = self.__obsoleteItem
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 if self.__unknownItem is None:
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
716 self.__unknownItem = QTreeWidgetItem(
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
717 self.repositoryList, [self.tr("Unknown")])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
718 self.__unknownItem.setExpanded(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719 parent = self.__unknownItem
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
720
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
721 if self.__integratedWidget:
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
722 entryFormat = "<b>{0}</b> - Version: <i>{1}</i><br/>{2}"
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
723 itm = QTreeWidgetItem(parent)
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
724 itm.setFirstColumnSpanned(True)
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
725 label = QLabel(entryFormat.format(name, version, short))
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
726 self.repositoryList.setItemWidget(itm, 0, label)
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
727 else:
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
728 itm = QTreeWidgetItem(parent, [name, version, short])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
729
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
730 itm.setData(0, PluginRepositoryWidget.UrlRole, url)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
731 itm.setData(0, PluginRepositoryWidget.FilenameRole, filename)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
732 itm.setData(0, PluginRepositoryWidget.AuthorRole, author)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
733 itm.setData(0, PluginRepositoryWidget.DescrRole, description)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
734
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
735 iconColumn = 0 if self.__integratedWidget else 1
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
736 updateStatus = self.__updateStatus(filename, version)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
737 if updateStatus == PluginRepositoryWidget.PluginStatusUpToDate:
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
738 itm.setIcon(iconColumn, UI.PixmapCache.getIcon("empty"))
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
739 itm.setToolTip(iconColumn, self.tr("up-to-date"))
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
740 elif updateStatus == PluginRepositoryWidget.PluginStatusNew:
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
741 itm.setIcon(iconColumn, UI.PixmapCache.getIcon("download"))
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
742 itm.setToolTip(iconColumn, self.tr("new download available"))
5854
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
743 self.__newItems += 1
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
744 elif updateStatus == PluginRepositoryWidget.PluginStatusLocalUpdate:
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
745 itm.setIcon(iconColumn, UI.PixmapCache.getIcon("updateLocal"))
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
746 itm.setToolTip(iconColumn, self.tr("update installable"))
5854
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
747 self.__updateLocalItems += 1
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
748 elif updateStatus == PluginRepositoryWidget.PluginStatusRemoteUpdate:
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
749 itm.setIcon(iconColumn, UI.PixmapCache.getIcon("updateRemote"))
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
750 itm.setToolTip(iconColumn, self.tr("updated download available"))
5854
be976799b8c0 Added a bar with counts for new/local updates/remote updates to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5755
diff changeset
751 self.__updateRemoteItems += 1
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
752 elif updateStatus == PluginRepositoryWidget.PluginStatusError:
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
753 itm.setIcon(iconColumn, UI.PixmapCache.getIcon("warning"))
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
754 itm.setToolTip(iconColumn, self.tr("error determining status"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
755
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
756 def __updateStatus(self, filename, version):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
757 """
5868
c1a98c164cd3 Started implementing a downloader and installer for web browser spell check dictionaries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5854
diff changeset
758 Private method to check the given archive update status.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
759
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
760 @param filename data for the filename field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
761 @param version data for the version field (string)
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
762 @return plug-in update status (integer, one of PluginStatusNew,
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
763 PluginStatusUpToDate, PluginStatusLocalUpdate,
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
764 PluginStatusRemoteUpdate)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 archive = os.path.join(Preferences.getPluginManager("DownloadPath"),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
767 filename)
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
768
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
769 # check, if it is an update (i.e. we already have archives
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
770 # with the same pattern)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
771 archivesPattern = archive.rsplit('-', 1)[0] + "-*.zip"
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
772 if len(glob.glob(archivesPattern)) == 0:
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
773 # Check against installed/loaded plug-ins
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
774 pluginName = filename.rsplit('-', 1)[0]
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
775 pluginDetails = self.__pluginManager.getPluginDetails(pluginName)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
776 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
777 pluginDetails is None or
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
778 pluginDetails["moduleName"] != pluginName
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
779 ):
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
780 return PluginRepositoryWidget.PluginStatusNew
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
781 if pluginDetails["error"]:
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
782 return PluginRepositoryWidget.PluginStatusError
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
783 pluginVersionTuple = Globals.versionToTuple(
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
784 pluginDetails["version"])[:3]
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
785 versionTuple = Globals.versionToTuple(version)[:3]
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
786 if pluginVersionTuple < versionTuple:
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
787 return PluginRepositoryWidget.PluginStatusRemoteUpdate
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
788 else:
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
789 return PluginRepositoryWidget.PluginStatusUpToDate
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
790
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 # check, if the archive exists
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 if not os.path.exists(archive):
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
793 return PluginRepositoryWidget.PluginStatusRemoteUpdate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
795 # check, if the archive is a valid zip file
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796 if not zipfile.is_zipfile(archive):
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
797 return PluginRepositoryWidget.PluginStatusRemoteUpdate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
799 zipFile = zipfile.ZipFile(archive, "r")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
800 try:
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
801 aversion = zipFile.read("VERSION").decode("utf-8")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
802 except KeyError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803 aversion = ""
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
804 zipFile.close()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
805
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
806 if aversion == version:
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
807 # Check against installed/loaded plug-ins
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
808 pluginName = filename.rsplit('-', 1)[0]
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
809 pluginDetails = self.__pluginManager.getPluginDetails(pluginName)
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
810 if pluginDetails is None:
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
811 return PluginRepositoryWidget.PluginStatusLocalUpdate
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
812 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
813 Globals.versionToTuple(pluginDetails["version"])[:3] <
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
814 Globals.versionToTuple(version)[:3]
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
815 ):
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
816 return PluginRepositoryWidget.PluginStatusLocalUpdate
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
817 else:
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
818 return PluginRepositoryWidget.PluginStatusUpToDate
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
819 else:
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
820 return PluginRepositoryWidget.PluginStatusRemoteUpdate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821
270
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
822 def __sslErrors(self, reply, errors):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
823 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
824 Private slot to handle SSL errors.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
825
270
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
826 @param reply reference to the reply object (QNetworkReply)
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
827 @param errors list of SSL errors (list of QSslError)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
828 """
2360
b6bf3925e3e1 Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2354
diff changeset
829 ignored = self.__sslErrorHandler.sslErrorsReply(reply, errors)[0]
8354
12ebd3934fef Renamed 'E5Utilities' to 'EricUtilities' and 'E5Network' to 'EricNetwork'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8351
diff changeset
830 if ignored == EricSslErrorState.NOT_IGNORED:
6156
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
831 self.__downloadCancel(reply)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
833 def getDownloadedPlugins(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
834 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
835 Public method to get the list of recently downloaded plugin files.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837 @return list of plugin filenames (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
838 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
839 return self.__pluginsDownloaded
1763
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
840
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
841 @pyqtSlot(bool)
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
842 def on_repositoryUrlEditButton_toggled(self, checked):
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
843 """
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
844 Private slot to set the read only status of the repository URL line
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
845 edit.
1763
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
846
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
847 @param checked state of the push button (boolean)
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
848 """
25a83ac16a5e Extended the Plugin Repository dialog to allow to change the repository URL manually and to show a message, if the URL has changed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1582
diff changeset
849 self.repositoryUrlEdit.setReadOnly(not checked)
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
850
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
851 def __closeAndInstall(self):
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
852 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
853 Private method to close the dialog and invoke the install dialog.
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
854 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
855 if not self.__pluginsDownloaded and self.__selectedItems():
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
856 for itm in self.__selectedItems():
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
857 filename = os.path.join(
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
858 Preferences.getPluginManager("DownloadPath"),
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
859 itm.data(0, PluginRepositoryWidget.FilenameRole))
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
860 self.__pluginsDownloaded.append(filename)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
861 self.closeAndInstall.emit()
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
862
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
863 def __hidePlugin(self):
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
864 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
865 Private slot to hide the current plug-in.
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
866 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
867 itm = self.__selectedItems()[0]
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
868 pluginName = (itm.data(0, PluginRepositoryWidget.FilenameRole)
3246
4cd58a0d6c28 Some code style fixes and renaming of UtilitiesPython2.py2flakes to UtilitiesPython2.pyflakes to make it clear, that it is just a copy of the one in Utilities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3200
diff changeset
869 .rsplit("-", 1)[0])
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
870 self.__updateHiddenPluginsList([pluginName])
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
871
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
872 def __hideSelectedPlugins(self):
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
873 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
874 Private slot to hide all selected plug-ins.
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
875 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
876 hideList = []
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
877 for itm in self.__selectedItems():
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
878 pluginName = (itm.data(0, PluginRepositoryWidget.FilenameRole)
3246
4cd58a0d6c28 Some code style fixes and renaming of UtilitiesPython2.py2flakes to UtilitiesPython2.pyflakes to make it clear, that it is just a copy of the one in Utilities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3200
diff changeset
879 .rsplit("-", 1)[0])
3200
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
880 hideList.append(pluginName)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
881 self.__updateHiddenPluginsList(hideList)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
882
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
883 def __showAllPlugins(self):
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
884 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
885 Private slot to show all plug-ins.
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
886 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
887 self.__hiddenPlugins = []
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
888 self.__updateHiddenPluginsList([])
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
889
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
890 def __hasHiddenPlugins(self):
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
891 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
892 Private method to check, if there are any hidden plug-ins.
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
893
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
894 @return flag indicating the presence of hidden plug-ins (boolean)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
895 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
896 return bool(self.__hiddenPlugins)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
897
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
898 def __updateHiddenPluginsList(self, hideList):
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
899 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
900 Private method to store the list of hidden plug-ins to the settings.
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
901
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
902 @param hideList list of plug-ins to add to the list of hidden ones
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
903 (list of string)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
904 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
905 if hideList:
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
906 self.__hiddenPlugins.extend(
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
907 [p for p in hideList if p not in self.__hiddenPlugins])
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
908 Preferences.setPluginManager("HiddenPlugins", self.__hiddenPlugins)
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
909 self.__populateList()
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
910
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
911 def __cleanupDownloads(self):
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
912 """
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
913 Private slot to cleanup the plug-in downloads area.
83bde5e6f146 Extended the plugin repository dialog to allow to hide unwanted entries and cleanup the plugin downloads area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
914 """
5739
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
915 PluginRepositoryDownloadCleanup()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
916
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
917
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
918 class PluginRepositoryDialog(QDialog):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
919 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
920 Class for the dialog variant.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
921 """
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
922 def __init__(self, pluginManager, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
923 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
924 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
925
6599
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
926 @param pluginManager reference to the plugin manager object
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
927 @type PluginManager
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
928 @param parent reference to the parent widget
419f36a46608 PluginRepositoryDialog: added version check for situation, where the downloaded files have been deleted already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6156
diff changeset
929 @type QWidget
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
930 """
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
931 super().__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
932 self.setSizeGripEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
933
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
934 self.__layout = QVBoxLayout(self)
2824
858412c29c34 Replaced the obsoleted method setMargin() with setContentsMargins().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2404
diff changeset
935 self.__layout.setContentsMargins(0, 0, 0, 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
936 self.setLayout(self.__layout)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
937
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
938 self.cw = PluginRepositoryWidget(pluginManager, parent=self)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
939 size = self.cw.size()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
940 self.__layout.addWidget(self.cw)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
941 self.resize(size)
3189
9a21c547de5f Fixed issues showing the correct window title for some dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
942 self.setWindowTitle(self.cw.windowTitle())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
943
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3246
diff changeset
944 self.cw.buttonBox.accepted.connect(self.accept)
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3246
diff changeset
945 self.cw.buttonBox.rejected.connect(self.reject)
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 465
diff changeset
946 self.cw.closeAndInstall.connect(self.__closeAndInstall)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
947
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
948 def __closeAndInstall(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
949 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
950 Private slot to handle the closeAndInstall signal.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
951 """
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
952 self.done(QDialog.DialogCode.Accepted + 1)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
953
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
954 def getDownloadedPlugins(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
955 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
956 Public method to get the list of recently downloaded plugin files.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
957
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
958 @return list of plugin filenames (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
959 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
960 return self.cw.getDownloadedPlugins()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
961
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
962
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: 8354
diff changeset
963 class PluginRepositoryWindow(EricMainWindow):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
964 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
965 Main window class for the standalone dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
966 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
967 def __init__(self, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
968 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
969 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
970
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
971 @param parent reference to the parent widget (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
972 """
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
973 super().__init__(parent)
8595
ce2034bc1c6e Plugin Repository: added an integrated plugin repository viewer (right side).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8586
diff changeset
974 self.cw = PluginRepositoryWidget(None, parent=self)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
975 size = self.cw.size()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
976 self.setCentralWidget(self.cw)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
977 self.resize(size)
3189
9a21c547de5f Fixed issues showing the correct window title for some dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
978 self.setWindowTitle(self.cw.windowTitle())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
979
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
980 self.setStyle(Preferences.getUI("Style"),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
981 Preferences.getUI("StyleSheet"))
2101
5bac7dee9e1a Introduced the E5MainWindow class allowing to set a style for all the main windows.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2094
diff changeset
982
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3246
diff changeset
983 self.cw.buttonBox.accepted.connect(self.close)
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3246
diff changeset
984 self.cw.buttonBox.rejected.connect(self.close)
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 465
diff changeset
985 self.cw.closeAndInstall.connect(self.__startPluginInstall)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
986
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
987 def __startPluginInstall(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
988 """
7960
e8fc383322f7 Harmonized some user visible strings and changed the term 'eric6' to the more generic 'eric'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7955
diff changeset
989 Private slot to start the eric plugin installation dialog.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
990 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
991 proc = QProcess()
8314
e3642a6a1e71 Finished renaming eric6 to eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
992 applPath = os.path.join(getConfig("ericDir"), "eric7_plugininstall.py")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
993
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
994 args = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
995 args.append(applPath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
996 args += self.cw.getDownloadedPlugins()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
997
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
998 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
999 not os.path.isfile(applPath) or
9016
6f079c524e99 Changed occurrences of sys.executable with a method to get rid of the "w" on Windows and macOS systems (i.e. change pythonw to python).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8930
diff changeset
1000 not proc.startDetached(Globals.getPythonExecutable(), args)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1001 ):
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: 8354
diff changeset
1002 EricMessageBox.critical(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
1003 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
1004 self.tr('Process Generation Error'),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
1005 self.tr(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1006 '<p>Could not start the process.<br>'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1007 'Ensure that it is available as <b>{0}</b>.</p>'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1008 ).format(applPath),
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
1009 self.tr('OK'))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1010
580
45c38566b001 Implemented the plug-in repository reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
1011 self.close()
5739
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1012
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1013
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1014 def PluginRepositoryDownloadCleanup(quiet=False):
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1015 """
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1016 Module function to clean up the plug-in downloads area.
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1017
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1018 @param quiet flag indicating quiet operations
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1019 @type bool
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1020 """
6612
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1021 pluginsRegister = [] # list of plug-ins contained in the repository
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1022
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1023 def registerPlugin(name, short, description, url, author, version,
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1024 filename, status):
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1025 """
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1026 Method to register a plug-in's data.
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1027
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1028 @param name data for the name field (string)
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1029 @param short data for the short field (string)
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1030 @param description data for the description field (list of strings)
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1031 @param url data for the url field (string)
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1032 @param author data for the author field (string)
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1033 @param version data for the version field (string)
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1034 @param filename data for the filename field (string)
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1035 @param status status of the plugin (string [stable, unstable, unknown])
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1036 """
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1037 pluginName = os.path.splitext(url.rsplit("/", 1)[1])[0]
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1038 if pluginName not in pluginsRegister:
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1039 pluginsRegister.append(pluginName)
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1040
5739
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1041 downloadPath = Preferences.getPluginManager("DownloadPath")
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1042 downloads = {} # plug-in name as key, file name as value
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1043
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1044 # step 1: extract plug-ins and downloaded files
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1045 for pluginFile in os.listdir(downloadPath):
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1046 if not os.path.isfile(os.path.join(downloadPath, pluginFile)):
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1047 continue
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1048
6064
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1049 try:
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1050 pluginName, pluginVersion = (
6064
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1051 pluginFile.replace(".zip", "").rsplit("-", 1)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
1052 )
6064
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1053 pluginVersionList = re.split("[._-]", pluginVersion)
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1054 for index in range(len(pluginVersionList)):
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1055 try:
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1056 pluginVersionList[index] = int(pluginVersionList[index])
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1057 except ValueError:
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1058 # use default of 0
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1059 pluginVersionList[index] = 0
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1060 except ValueError:
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1061 # rsplit() returned just one entry, i.e. file name doesn't contain
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1062 # version info separated by '-'
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1063 # => assume version 0.0.0
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1064 pluginName = pluginFile.replace(".zip", "")
32a8b51c89da Fixed a bug in the plug-in repository dialog causing the cleanup function to fail, if the download directory contains a file without version info seperated by '-'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
1065 pluginVersionList = [0, 0, 0]
5975
3bc24855b254 Fixed an issue cleaning up the plug-in download area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5868
diff changeset
1066
5739
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1067 if pluginName not in downloads:
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1068 downloads[pluginName] = []
5975
3bc24855b254 Fixed an issue cleaning up the plug-in download area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5868
diff changeset
1069 downloads[pluginName].append((pluginFile, tuple(pluginVersionList)))
5739
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1070
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1071 # step 2: delete old entries
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1072 hiddenPlugins = Preferences.getPluginManager("HiddenPlugins")
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1073 for pluginName in downloads:
5975
3bc24855b254 Fixed an issue cleaning up the plug-in download area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5868
diff changeset
1074 downloads[pluginName].sort(key=lambda x: x[1])
5739
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1075
8259
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8234
diff changeset
1076 removeFiles = (
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8234
diff changeset
1077 [f[0] for f in downloads[pluginName]]
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8234
diff changeset
1078 if (pluginName in hiddenPlugins and
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8234
diff changeset
1079 not Preferences.getPluginManager("KeepHidden")) else
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8234
diff changeset
1080 [f[0] for f in downloads[pluginName][
5975
3bc24855b254 Fixed an issue cleaning up the plug-in download area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5868
diff changeset
1081 :-Preferences.getPluginManager("KeepGenerations")]]
8259
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8234
diff changeset
1082 )
5739
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1083 for removeFile in removeFiles:
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1084 try:
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1085 os.remove(os.path.join(downloadPath, removeFile))
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: 7780
diff changeset
1086 except OSError as err:
5739
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1087 if not quiet:
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: 8354
diff changeset
1088 EricMessageBox.critical(
5739
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1089 None,
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1090 QCoreApplication.translate(
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1091 "PluginRepositoryWidget",
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1092 "Cleanup of Plugin Downloads"),
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1093 QCoreApplication.translate(
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1094 "PluginRepositoryWidget",
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1095 """<p>The plugin download <b>{0}</b> could"""
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1096 """ not be deleted.</p><p>Reason: {1}</p>""")
a870f5f03baa Added an option to the plug-in manager to cleanup the plug-ins download area during startup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5588
diff changeset
1097 .format(removeFile, str(err)))
6612
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1098
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1099 # step 3: delete entries of obsolete plug-ins
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1100 pluginRepositoryFile = os.path.join(Utilities.getConfigDir(),
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1101 "PluginRepository")
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1102 if os.path.exists(pluginRepositoryFile):
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1103 f = QFile(pluginRepositoryFile)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7960
diff changeset
1104 if f.open(QIODevice.OpenModeFlag.ReadOnly):
8351
7d13e08ddb3f Removed for writing old style XML files and renamed E5XML to EricXML.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
1105 from EricXML.PluginRepositoryReader import PluginRepositoryReader
6612
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1106 reader = PluginRepositoryReader(f, registerPlugin)
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1107 reader.readXML()
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1108
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1109 for pluginName in downloads:
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1110 if pluginName not in pluginsRegister:
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1111 removeFiles = [f[0] for f in downloads[pluginName]]
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1112 for removeFile in removeFiles:
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1113 try:
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1114 os.remove(os.path.join(downloadPath, removeFile))
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: 7780
diff changeset
1115 except OSError as err:
6612
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1116 if not quiet:
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: 8354
diff changeset
1117 EricMessageBox.critical(
6612
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1118 None,
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1119 QCoreApplication.translate(
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1120 "PluginRepositoryWidget",
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1121 "Cleanup of Plugin Downloads"),
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1122 QCoreApplication.translate(
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1123 "PluginRepositoryWidget",
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1124 "<p>The plugin download <b>{0}</b>"
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1125 " could not be deleted.</p>"
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1126 "<p>Reason: {1}</p>""")
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
1127 .format(removeFile, str(err)))

eric ide

mercurial