PluginManager/PluginRepositoryDialog.py

Sat, 23 Feb 2019 16:07:02 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 23 Feb 2019 16:07:02 +0100
branch
pypi
changeset 6808
d952d3ffc50d
parent 6645
ad476851d7e0
permissions
-rw-r--r--

Development of pip interface finished.

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

eric ide

mercurial