eric6/PluginManager/PluginRepositoryDialog.py

Sun, 03 Jan 2021 17:49:38 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 03 Jan 2021 17:49:38 +0100
changeset 7946
6901746220fc
parent 7923
91e843545d9a
child 7955
567f2ec958c3
permissions
-rw-r--r--

Removed code depending upon the automatic online check.

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
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
3 # Copyright (c) 2007 - 2021 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 sys
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import os
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 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
13 import glob
5975
3bc24855b254 Fixed an issue cleaning up the plug-in download area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5868
diff changeset
14 import re
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
16 from PyQt5.QtCore import (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
17 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
18 QCoreApplication
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
19 )
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
20 from PyQt5.QtWidgets import (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
21 QWidget, QDialogButtonBox, QAbstractButton, QTreeWidgetItem, QDialog,
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
22 QVBoxLayout, QMenu
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
23 )
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
24 from PyQt5.QtNetwork import (
7946
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
25 QNetworkAccessManager, QNetworkRequest, QNetworkReply
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
26 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7
diff changeset
28 from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 501
diff changeset
30 from E5Gui import E5MessageBox
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
31 from E5Gui.E5MainWindow import E5MainWindow
2192
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2101
diff changeset
32 from E5Gui.E5Application import e5App
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 501
diff changeset
33
286
652f5159f1c3 Prepared to have individual proxies per scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 270
diff changeset
34 from E5Network.E5NetworkProxyFactory import proxyAuthenticationRequired
2354
c63de4af553d Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
35 try:
c63de4af553d Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
36 from E5Network.E5SslErrorHandler import E5SslErrorHandler
c63de4af553d Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
37 SSL_AVAILABLE = True
c63de4af553d Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
38 except ImportError:
c63de4af553d Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
39 SSL_AVAILABLE = False
286
652f5159f1c3 Prepared to have individual proxies per scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 270
diff changeset
40
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
41 import Globals
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 import UI.PixmapCache
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
47 from eric6config import getConfig
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
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 class PluginRepositoryWidget(QWidget, Ui_PluginRepositoryDialog):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 Class implementing a dialog showing the available plugins.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
54 @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
55 pressed
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 465
diff changeset
57 closeAndInstall = pyqtSignal()
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 465
diff changeset
58
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
59 DescrRole = Qt.UserRole
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
60 UrlRole = Qt.UserRole + 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
61 FilenameRole = Qt.UserRole + 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
62 AuthorRole = Qt.UserRole + 3
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
63
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 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
65 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
66 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
67 PluginStatusRemoteUpdate = 3
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
68 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
69
6600
092cb8a3fc34 Fixed some code style issues and generated source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6599
diff changeset
70 def __init__(self, pluginManager, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73
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
74 @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
75 @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
76 @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
77 @type QWidget
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2404
diff changeset
79 super(PluginRepositoryWidget, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 self.setupUi(self)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81
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
82 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
83 # 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
84 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
85 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
86 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
87 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
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 = False
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
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
91 self.__updateButton = self.buttonBox.addButton(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
92 self.tr("Update"), QDialogButtonBox.ActionRole)
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
93 self.__downloadButton = self.buttonBox.addButton(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
94 self.tr("Download"), QDialogButtonBox.ActionRole)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 self.__downloadButton.setEnabled(False)
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
96 self.__downloadInstallButton = self.buttonBox.addButton(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
97 self.tr("Download && Install"),
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
98 QDialogButtonBox.ActionRole)
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
99 self.__downloadInstallButton.setEnabled(False)
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
100 self.__downloadCancelButton = self.buttonBox.addButton(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
101 self.tr("Cancel"), QDialogButtonBox.ActionRole)
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
102 self.__downloadCancelButton.setEnabled(False)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
103 self.__installButton = self.buttonBox.addButton(
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
104 self.tr("Close && Install"), QDialogButtonBox.ActionRole)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 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
106 self.__closeButton = self.buttonBox.button(QDialogButtonBox.Close)
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
107 self.__closeButton.setEnabled(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
109 self.repositoryUrlEdit.setText(
3676
2f62b060a931 Renamed a few excternal references.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
110 Preferences.getUI("PluginRepositoryUrl6"))
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
111
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
112 self.repositoryList.headerItem().setText(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
113 self.repositoryList.columnCount(), "")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 self.repositoryList.header().setSortIndicator(0, Qt.AscendingOrder)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115
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
116 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
117 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
118 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
119 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
120 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
121 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
122 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
123 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
124 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
125 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
126 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
127
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
128 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
129 "PluginRepository")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130
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
131 # 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
132 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
133 self.__networkManager.proxyAuthenticationRequired.connect(
286
652f5159f1c3 Prepared to have individual proxies per scheme.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 270
diff changeset
134 proxyAuthenticationRequired)
798
5c1786fad576 Fixed an issue with Qt installations that don't support SSL.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
135 if SSL_AVAILABLE:
2354
c63de4af553d Centralized the SSL error handling in E5SslErrorHandler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
136 self.__sslErrorHandler = E5SslErrorHandler(self)
798
5c1786fad576 Fixed an issue with Qt installations that don't support SSL.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
137 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
138 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
139
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 self.__pluginsToDownload = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 self.__pluginsDownloaded = []
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
142 self.__isDownloadInstall = False
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
143 self.__allDownloadedOk = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144
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
145 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
146
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 self.__populateList()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 @pyqtSlot(QAbstractButton)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 def on_buttonBox_clicked(self, button):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 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
153
9453efa25fd5 Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2824
diff changeset
154 @param button reference to the button pressed (QAbstractButton)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 if button == self.__updateButton:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 self.__updateList()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 elif button == self.__downloadButton:
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
159 self.__isDownloadInstall = False
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
160 self.__downloadPlugins()
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
161 elif button == self.__downloadInstallButton:
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
162 self.__isDownloadInstall = True
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
163 self.__allDownloadedOk = True
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 self.__downloadPlugins()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 elif button == self.__downloadCancelButton:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 self.__downloadCancel()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 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
168 self.__closeAndInstall()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 def __formatDescription(self, lines):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 Private method to format the description.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 @param lines lines of the description (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 @return formatted description (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 # remove empty line at start and end
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 newlines = lines[:]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 if len(newlines) and newlines[0] == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 del newlines[0]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 if len(newlines) and newlines[-1] == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 del newlines[-1]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 # replace empty lines by newline character
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 index = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 while index < len(newlines):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 if newlines[index] == '':
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 newlines[index] = '\n'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 index += 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 # join lines by a blank
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 return ' '.join(newlines)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193
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
194 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
195 """
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
196 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
197
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
198 @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
199 @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
200 @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
201 @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
202 @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
203 """
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
204 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
205 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
206
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
207 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
208
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
209 @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
210 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
211 """
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
212 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
213
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
214 @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
215 """
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
216 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
217 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
218 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
219 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
220 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
221 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
222 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
223
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 def on_repositoryList_currentItemChanged(self, current, previous):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 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
228
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 @param current reference to the new current item (QTreeWidgetItem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 @param previous reference to the old current item (QTreeWidgetItem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 if self.__repositoryMissing or current is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234
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
235 url = current.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
236 if url is None:
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
237 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
238 else:
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
239 url = self.__changeScheme(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
240 self.urlEdit.setText(url)
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
241 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
242 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
243 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
244 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
245 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
246 current.data(0, PluginRepositoryWidget.AuthorRole) or "")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 def __selectedItems(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 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
251
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 @return list of selected items (list)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 ql = self.repositoryList.selectedItems()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 for index in range(self.repositoryList.topLevelItemCount()):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 ti = self.repositoryList.topLevelItem(index)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 if ti in ql:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 ql.remove(ti)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 return ql
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 def on_repositoryList_itemSelectionChanged(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 Private slot to handle a change of the selection.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 """
7946
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
266 enable = bool(self.__selectedItems())
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
267 self.__downloadButton.setEnabled(enable)
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
268 self.__downloadInstallButton.setEnabled(enable)
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
269 self.__installButton.setEnabled(enable)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 def __updateList(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 Private slot to download a new list and display the contents.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 """
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
275 url = self.repositoryUrlEdit.text()
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
276 self.__downloadFile(url,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
277 self.pluginRepositoryFile,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 self.__downloadRepositoryFileDone)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 def __downloadRepositoryFileDone(self, status, filename):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 Private method called after the repository file was downloaded.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 @param status flaging indicating a successful download (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 @param filename full path of the downloaded file (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 self.__populateList()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 def __downloadPluginDone(self, status, filename):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 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
292
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
293 @param status flag indicating a successful download (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 @param filename full path of the downloaded file (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 if status:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 self.__pluginsDownloaded.append(filename)
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
298 if self.__isDownloadInstall:
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
299 self.__allDownloadedOk &= status
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300
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
301 self.__pluginsToDownload.pop(0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 if len(self.__pluginsToDownload):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 self.__downloadPlugin()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 self.__downloadPluginsDone()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 def __downloadPlugin(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 Private method to download the next plugin.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
311 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
312 self.__pluginsToDownload[0][1],
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 self.__downloadPluginDone)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 def __downloadPlugins(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 Private slot to download the selected plugins.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 self.__pluginsDownloaded = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 self.__pluginsToDownload = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 self.__downloadButton.setEnabled(False)
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
322 self.__downloadInstallButton.setEnabled(False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 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
324
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
325 newScheme = self.repositoryUrlEdit.text().split("//", 1)[0]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 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
327 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
328 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
329 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
330 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
331 newScheme)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 filename = os.path.join(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 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
334 itm.data(0, PluginRepositoryWidget.FilenameRole))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 self.__pluginsToDownload.append((url, filename))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 self.__downloadPlugin()
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 def __downloadPluginsDone(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 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
341 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 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
343 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
344 self.__installButton.setEnabled(len(self.__selectedItems()))
2192
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2101
diff changeset
345 if not self.__external:
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2101
diff changeset
346 ui = e5App().getObject("UserInterface")
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2101
diff changeset
347 else:
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2101
diff changeset
348 ui = None
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2101
diff changeset
349 if ui and ui.notificationsEnabled():
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
350 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
351 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
352 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
353 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
354
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
355 if self.__isDownloadInstall:
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
356 self.closeAndInstall.emit()
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
357 else:
2192
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2101
diff changeset
358 if ui is None or not ui.notificationsEnabled():
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
359 E5MessageBox.information(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
360 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
361 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
362 self.tr("""The requested plugins were downloaded."""))
1364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
363 self.downloadProgress.setValue(0)
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
364
a2e74a43fadc Added code to download and install plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1310
diff changeset
365 # 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
366 self.__populateList()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 def __resortRepositoryList(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 Private method to resort the tree.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 """
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
372 self.repositoryList.sortItems(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
373 self.repositoryList.sortColumn(),
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
374 self.repositoryList.header().sortIndicatorOrder())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 def __populateList(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 Private method to populate the list of available plugins.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 self.repositoryList.clear()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 self.__stableItem = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 self.__unstableItem = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 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
384 self.__obsoleteItem = None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385
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
386 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
387 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
388 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
389
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 self.downloadProgress.setValue(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 if os.path.exists(self.pluginRepositoryFile):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 self.__repositoryMissing = False
580
45c38566b001 Implemented the plug-in repository reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
394 f = QFile(self.pluginRepositoryFile)
45c38566b001 Implemented the plug-in repository reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
395 if f.open(QIODevice.ReadOnly):
2404
cba0ff902c2b Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2360
diff changeset
396 from E5XML.PluginRepositoryReader import PluginRepositoryReader
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
397 reader = PluginRepositoryReader(f, self.addEntry)
580
45c38566b001 Implemented the plug-in repository reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
398 reader.readXML()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 self.repositoryList.resizeColumnToContents(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 self.repositoryList.resizeColumnToContents(1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 self.repositoryList.resizeColumnToContents(2)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 self.__resortRepositoryList()
3676
2f62b060a931 Renamed a few excternal references.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3670
diff changeset
403 url = Preferences.getUI("PluginRepositoryUrl6")
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
404 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
405 self.repositoryUrlEdit.setText(url)
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
406 E5MessageBox.warning(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
407 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
408 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
409 self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
410 """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
411 """ 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
412 """ the new repository file."""))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
414 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
415 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
416 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
417 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
418 "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
419 .format(self.pluginRepositoryFile))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 self.__repositoryMissing = True
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
422 QTreeWidgetItem(
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
423 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
424 ["", self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
425 "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
426 ])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 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
428
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
429 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
430 .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
431 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
432 .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
433 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
434 .format(self.__updateRemoteItems))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
436 def __downloadFile(self, url, filename, doneMethod=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 Private slot to download the given file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 @param url URL for the download (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 @param filename local name of the file (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 @param doneMethod method to be called when done
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 """
7946
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
444 self.__updateButton.setEnabled(False)
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
445 self.__downloadButton.setEnabled(False)
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
446 self.__downloadInstallButton.setEnabled(False)
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
447 self.__closeButton.setEnabled(False)
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
448 self.__downloadCancelButton.setEnabled(True)
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
449
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
450 self.statusLabel.setText(url)
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
451
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
452 request = QNetworkRequest(QUrl(url))
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
453 request.setAttribute(QNetworkRequest.CacheLoadControlAttribute,
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
454 QNetworkRequest.AlwaysNetwork)
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
455 reply = self.__networkManager.get(request)
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
456 reply.finished.connect(
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
457 lambda: self.__downloadFileDone(reply, filename, doneMethod))
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
458 reply.downloadProgress.connect(self.__downloadProgress)
6901746220fc Removed code depending upon the automatic online check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
459 self.__replies.append(reply)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460
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
461 def __downloadFileDone(self, reply, fileName, doneMethod):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 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
464 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
465
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
466 @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
467 @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
468 @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
469 @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
470 @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
471 @type func
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
472 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 self.__updateButton.setEnabled(True)
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
474 self.__closeButton.setEnabled(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 self.__downloadCancelButton.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
476
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
477 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
478 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
479 self.__replies.remove(reply)
41505c92ac31 Added code to enhance the proxy configuration and removed the usage of QHttp.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 80
diff changeset
480 if reply.error() != QNetworkReply.NoError:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 ok = False
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
482 if reply.error() != QNetworkReply.OperationCanceledError:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
483 E5MessageBox.warning(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
484 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
485 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
486 self.tr(
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
487 """<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
488 """ 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
489 ).format(reply.url().toString(), reply.errorString())
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 self.downloadProgress.setValue(0)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492 if self.repositoryList.topLevelItemCount():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
493 if self.repositoryList.currentItem() is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
494 self.repositoryList.setCurrentItem(
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495 self.repositoryList.topLevelItem(0))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 else:
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
497 self.__downloadButton.setEnabled(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
498 len(self.__selectedItems()))
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
499 self.__downloadInstallButton.setEnabled(
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
500 len(self.__selectedItems()))
4626
c891c7ad6b60 Added some missing deleteLater() calls.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
501 reply.deleteLater()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503
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
504 downloadIODevice = QFile(fileName + ".tmp")
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
505 downloadIODevice.open(QIODevice.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
506 # 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
507 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
508 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
509 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
510 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
511 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
512 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
513 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
514 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
515 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
516 downloadIODevice.rename(fileName)
4626
c891c7ad6b60 Added some missing deleteLater() calls.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
517 reply.deleteLater()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518
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
519 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
520 doneMethod(ok, fileName)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521
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
522 def __downloadCancel(self, reply=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 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
525
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
526 @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
527 @type QNetworkReply
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528 """
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
529 if reply is 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
530 if self.__replies:
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
531 reply = self.__replies[0]
ac12549e521a PluginRepositoryWidget: Did some code optimizations in order to get rid of status attributes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6088
diff changeset
532 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
533 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
534 reply.abort()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
535
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
536 def __downloadProgress(self, done, total):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
538 Private slot to show the download progress.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540 @param done number of bytes downloaded so far (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 @param total total bytes to be downloaded (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 """
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
543 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
544 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
545 self.downloadProgress.setValue(done)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
547 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
548 filename, status):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 Public method to add an entry to the list.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 @param name data for the name field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 @param short data for the short field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 @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
555 @param url data for the url field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 @param author data for the author field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 @param version data for the version field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 @param filename data for the filename field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 @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
560 """
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
561 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
562 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
563 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
564
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 if status == "stable":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 if self.__stableItem is None:
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
567 self.__stableItem = QTreeWidgetItem(
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
568 self.repositoryList, [self.tr("Stable")])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 self.__stableItem.setExpanded(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570 parent = self.__stableItem
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
571 elif status == "unstable":
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572 if self.__unstableItem is None:
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
573 self.__unstableItem = QTreeWidgetItem(
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
574 self.repositoryList, [self.tr("Unstable")])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
575 self.__unstableItem.setExpanded(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
576 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
577 elif status == "obsolete":
c6dabc972560 Added an "obsolete" category to the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5975
diff changeset
578 if self.__obsoleteItem is None:
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
579 self.__obsoleteItem = QTreeWidgetItem(
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
580 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
581 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
582 parent = self.__obsoleteItem
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 if self.__unknownItem is None:
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
585 self.__unknownItem = QTreeWidgetItem(
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
586 self.repositoryList, [self.tr("Unknown")])
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
587 self.__unknownItem.setExpanded(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
588 parent = self.__unknownItem
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 itm = QTreeWidgetItem(parent, [name, version, short])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590
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
591 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
592 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
593 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
594 itm.setData(0, PluginRepositoryWidget.DescrRole, description)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595
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
596 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
597 if updateStatus == PluginRepositoryWidget.PluginStatusUpToDate:
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
598 itm.setIcon(1, UI.PixmapCache.getIcon("empty"))
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
599 itm.setToolTip(1, self.tr("up-to-date"))
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
600 elif updateStatus == PluginRepositoryWidget.PluginStatusNew:
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
601 itm.setIcon(1, UI.PixmapCache.getIcon("download"))
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
602 itm.setToolTip(1, 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
603 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
604 elif updateStatus == PluginRepositoryWidget.PluginStatusLocalUpdate:
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
605 itm.setIcon(1, UI.PixmapCache.getIcon("updateLocal"))
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
606 itm.setToolTip(1, 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
607 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
608 elif updateStatus == PluginRepositoryWidget.PluginStatusRemoteUpdate:
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
609 itm.setIcon(1, UI.PixmapCache.getIcon("updateRemote"))
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
610 itm.setToolTip(1, 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
611 self.__updateRemoteItems += 1
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
612 elif updateStatus == PluginRepositoryWidget.PluginStatusError:
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
613 itm.setIcon(1, UI.PixmapCache.getIcon("warning"))
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
614 itm.setToolTip(1, self.tr("error determining status"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615
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
616 def __updateStatus(self, filename, version):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617 """
5868
c1a98c164cd3 Started implementing a downloader and installer for web browser spell check dictionaries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5854
diff changeset
618 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
619
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 @param filename data for the filename field (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 @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
622 @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
623 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
624 PluginStatusRemoteUpdate)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 archive = os.path.join(Preferences.getPluginManager("DownloadPath"),
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 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
628
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
629 # 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
630 # 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
631 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
632 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
633 # 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
634 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
635 pluginDetails = self.__pluginManager.getPluginDetails(pluginName)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
636 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
637 pluginDetails is None or
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
638 pluginDetails["moduleName"] != pluginName
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
639 ):
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
640 return PluginRepositoryWidget.PluginStatusNew
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
641 if pluginDetails["error"]:
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
642 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
643 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
644 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
645 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
646 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
647 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
648 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
649 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
650
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 # check, if the archive exists
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652 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
653 return PluginRepositoryWidget.PluginStatusRemoteUpdate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 # check, if the archive is a valid zip file
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 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
657 return PluginRepositoryWidget.PluginStatusRemoteUpdate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
658
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
659 zipFile = zipfile.ZipFile(archive, "r")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 try:
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
661 aversion = zipFile.read("VERSION").decode("utf-8")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 except KeyError:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 aversion = ""
5588
6ba512d9f46a Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5395
diff changeset
664 zipFile.close()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665
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
666 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
667 # 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
668 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
669 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
670 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
671 return PluginRepositoryWidget.PluginStatusLocalUpdate
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
672 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
673 Globals.versionToTuple(pluginDetails["version"])[:3] <
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
674 Globals.versionToTuple(version)[:3]
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
675 ):
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
676 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
677 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
678 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
679 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
680 return PluginRepositoryWidget.PluginStatusRemoteUpdate
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681
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
682 def __sslErrors(self, reply, errors):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684 Private slot to handle SSL errors.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
685
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
686 @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
687 @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
688 """
2360
b6bf3925e3e1 Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2354
diff changeset
689 ignored = self.__sslErrorHandler.sslErrorsReply(reply, errors)[0]
b6bf3925e3e1 Improved the SSL error handling logic a bit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2354
diff changeset
690 if ignored == E5SslErrorHandler.NotIgnored:
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
691 self.__downloadCancel(reply)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
692
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 def getDownloadedPlugins(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
694 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695 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
696
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
697 @return list of plugin filenames (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
698 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 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
700
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
701 @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
702 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
703 """
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
704 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
705 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
706
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
707 @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
708 """
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
709 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
710
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
711 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
712 """
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
713 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
714 """
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
715 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
716 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
717 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
718 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
719 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
720 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
721 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
722
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
723 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
724 """
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
725 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
726 """
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
727 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
728 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
729 .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
730 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
731
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 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
733 """
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
734 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
735 """
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 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
737 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
738 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
739 .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
740 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
741 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
742
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
743 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
744 """
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
745 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
746 """
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
747 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
748 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
749
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
750 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
751 """
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
752 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
753
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
754 @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
755 """
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 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
757
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
758 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
759 """
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
760 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
761
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 @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
763 (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
764 """
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
765 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
766 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
767 [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
768 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
769 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
770
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 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
772 """
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
773 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
774 """
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
775 PluginRepositoryDownloadCleanup()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
777
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 class PluginRepositoryDialog(QDialog):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
779 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 Class for the dialog variant.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 """
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
782 def __init__(self, pluginManager, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785
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
786 @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
787 @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
788 @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
789 @type QWidget
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
790 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2404
diff changeset
791 super(PluginRepositoryDialog, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
792 self.setSizeGripEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
793
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
794 self.__layout = QVBoxLayout(self)
2824
858412c29c34 Replaced the obsoleted method setMargin() with setContentsMargins().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2404
diff changeset
795 self.__layout.setContentsMargins(0, 0, 0, 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
796 self.setLayout(self.__layout)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797
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
798 self.cw = PluginRepositoryWidget(pluginManager, self)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
799 size = self.cw.size()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
800 self.__layout.addWidget(self.cw)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
801 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
802 self.setWindowTitle(self.cw.windowTitle())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3246
diff changeset
804 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
805 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
806 self.cw.closeAndInstall.connect(self.__closeAndInstall)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
807
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
808 def __closeAndInstall(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
809 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
810 Private slot to handle the closeAndInstall signal.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
811 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
812 self.done(QDialog.Accepted + 1)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
813
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
814 def getDownloadedPlugins(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
815 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
816 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
817
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
818 @return list of plugin filenames (list of strings)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
819 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
820 return self.cw.getDownloadedPlugins()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
821
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
822
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
823 class PluginRepositoryWindow(E5MainWindow):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
824 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
825 Main window class for the standalone dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
826 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 896
diff changeset
827 def __init__(self, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
828 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
829 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
830
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
831 @param parent reference to the parent widget (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
832 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2404
diff changeset
833 super(PluginRepositoryWindow, self).__init__(parent)
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
834 self.cw = PluginRepositoryWidget(None, self)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
835 size = self.cw.size()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
836 self.setCentralWidget(self.cw)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
837 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
838 self.setWindowTitle(self.cw.windowTitle())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
839
2992
dbdf27746da5 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2960
diff changeset
840 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
841 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
842
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3246
diff changeset
843 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
844 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
845 self.cw.closeAndInstall.connect(self.__startPluginInstall)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
846
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
847 def __startPluginInstall(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
848 """
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
849 Private slot to start the eric6 plugin installation dialog.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
850 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
851 proc = QProcess()
3670
f0cb7579c0b4 Finished renaming eric5 for PyQt5 to eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
852 applPath = os.path.join(getConfig("ericDir"), "eric6_plugininstall.py")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
853
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
854 args = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
855 args.append(applPath)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
856 args += self.cw.getDownloadedPlugins()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
857
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
858 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
859 not os.path.isfile(applPath) or
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
860 not proc.startDetached(sys.executable, args)
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
861 ):
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
862 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2992
diff changeset
863 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3189
diff changeset
864 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
865 self.tr(
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
866 '<p>Could not start the process.<br>'
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
867 '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
868 ).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
869 self.tr('OK'))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
870
580
45c38566b001 Implemented the plug-in repository reader.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 553
diff changeset
871 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
872
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
873
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
874 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
875 """
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
876 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
877
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
878 @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
879 @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
880 """
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
881 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
882
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
883 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
884 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
885 """
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
886 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
887
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
888 @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
889 @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
890 @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
891 @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
892 @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
893 @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
894 @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
895 @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
896 """
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
897 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
898 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
899 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
900
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
901 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
902 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
903
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
904 # 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
905 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
906 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
907 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
908
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
909 try:
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
910 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
911 pluginFile.replace(".zip", "").rsplit("-", 1)
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
912 )
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
913 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
914 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
915 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
916 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
917 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
918 # 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
919 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
920 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
921 # 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
922 # 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
923 # => 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
924 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
925 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
926
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
927 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
928 downloads[pluginName] = []
5975
3bc24855b254 Fixed an issue cleaning up the plug-in download area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5868
diff changeset
929 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
930
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
931 # 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
932 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
933 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
934 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
935
7255
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
936 if (
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
937 pluginName in hiddenPlugins and
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
938 not Preferences.getPluginManager("KeepHidden")
d595f6f9cbf8 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
939 ):
6024
e5a2b8b613dd Fix for the plug-in repository dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6023
diff changeset
940 removeFiles = [f[0] for f in downloads[pluginName]]
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
941 else:
5975
3bc24855b254 Fixed an issue cleaning up the plug-in download area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5868
diff changeset
942 removeFiles = [f[0] for f in downloads[pluginName][
3bc24855b254 Fixed an issue cleaning up the plug-in download area.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5868
diff changeset
943 :-Preferences.getPluginManager("KeepGenerations")]]
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
944 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
945 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
946 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
947 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
948 if not quiet:
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
949 E5MessageBox.critical(
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
950 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
951 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
952 "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
953 "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
954 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
955 "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
956 """<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
957 """ 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
958 .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
959
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
960 # 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
961 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
962 "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
963 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
964 f = QFile(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
965 if f.open(QIODevice.ReadOnly):
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
966 from E5XML.PluginRepositoryReader import PluginRepositoryReader
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
967 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
968 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
969
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
970 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
971 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
972 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
973 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
974 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
975 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
976 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
977 if not quiet:
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
978 E5MessageBox.critical(
87984e7f11d9 PluginRepositoryDialog: added code to cleanup downloaded plug-in archives of obsolete plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6608
diff changeset
979 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
980 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
981 "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
982 "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
983 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
984 "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
985 "<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
986 " 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
987 "<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
988 .format(removeFile, str(err)))

eric ide

mercurial