Fixed an issue related to updating the plug-in repository file and the respective view. eric7

Fri, 22 Apr 2022 16:43:25 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 22 Apr 2022 16:43:25 +0200
branch
eric7
changeset 9031
8c9013b363bc
parent 9030
13a03f9eee6b
child 9032
e858ff495c1c

Fixed an issue related to updating the plug-in repository file and the respective view.

eric7/APIs/Python3/eric7.api file | annotate | diff | comparison | revisions
eric7/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
eric7/Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
eric7/Documentation/Source/eric7.PluginManager.PluginManager.html file | annotate | diff | comparison | revisions
eric7/Documentation/Source/eric7.PluginManager.PluginRepositoryDialog.html file | annotate | diff | comparison | revisions
eric7/PluginManager/PluginManager.py file | annotate | diff | comparison | revisions
eric7/PluginManager/PluginRepositoryDialog.py file | annotate | diff | comparison | revisions
eric7/UI/UserInterface.py file | annotate | diff | comparison | revisions
--- a/eric7/APIs/Python3/eric7.api	Wed Apr 20 15:10:04 2022 +0200
+++ b/eric7/APIs/Python3/eric7.api	Fri Apr 22 16:43:25 2022 +0200
@@ -3248,6 +3248,7 @@
 eric7.PluginManager.PluginManager.PluginManager.deactivatePlugin?4(name, onDemand=False)
 eric7.PluginManager.PluginManager.PluginManager.deactivateVcsPlugins?4()
 eric7.PluginManager.PluginManager.PluginManager.doShutdown?4()
+eric7.PluginManager.PluginManager.PluginManager.downLoadRepositoryFile?4(url=None)
 eric7.PluginManager.PluginManager.PluginManager.finalizeSetup?4()
 eric7.PluginManager.PluginManager.PluginManager.getPluginApiFiles?4(language)
 eric7.PluginManager.PluginManager.PluginManager.getPluginConfigData?4()
@@ -3274,6 +3275,7 @@
 eric7.PluginManager.PluginManager.PluginManager.pluginAboutToBeDeactivated?7
 eric7.PluginManager.PluginManager.PluginManager.pluginActivated?7
 eric7.PluginManager.PluginManager.PluginManager.pluginDeactivated?7
+eric7.PluginManager.PluginManager.PluginManager.pluginRepositoryFileDownloaded?7
 eric7.PluginManager.PluginManager.PluginManager.preferencesChanged?4()
 eric7.PluginManager.PluginManager.PluginManager.removePluginFromSysModules?4(pluginName, package, internalPackages)
 eric7.PluginManager.PluginManager.PluginManager.shutdown?7
@@ -3299,7 +3301,7 @@
 eric7.PluginManager.PluginRepositoryDialog.PluginRepositoryWidget.on_repositoryList_customContextMenuRequested?4(pos)
 eric7.PluginManager.PluginRepositoryDialog.PluginRepositoryWidget.on_repositoryList_itemSelectionChanged?4()
 eric7.PluginManager.PluginRepositoryDialog.PluginRepositoryWidget.on_repositoryUrlEditButton_toggled?4(checked)
-eric7.PluginManager.PluginRepositoryDialog.PluginRepositoryWidget.updateList?4()
+eric7.PluginManager.PluginRepositoryDialog.PluginRepositoryWidget.reloadList?4()
 eric7.PluginManager.PluginRepositoryDialog.PluginRepositoryWidget?1(pluginManager, integrated=False, parent=None)
 eric7.PluginManager.PluginRepositoryDialog.PluginRepositoryWindow?1(parent=None)
 eric7.PluginManager.PluginRepositoryDialog.registerPlugin?4(name, short, description, url, author, version, filename, status)
Binary file eric7/Documentation/Help/source.qch has changed
--- a/eric7/Documentation/Help/source.qhp	Wed Apr 20 15:10:04 2022 +0200
+++ b/eric7/Documentation/Help/source.qhp	Fri Apr 22 16:43:25 2022 +0200
@@ -11535,6 +11535,7 @@
       <keyword name="PluginManager.deactivatePlugin" id="PluginManager.deactivatePlugin" ref="eric7.PluginManager.PluginManager.html#PluginManager.deactivatePlugin" />
       <keyword name="PluginManager.deactivateVcsPlugins" id="PluginManager.deactivateVcsPlugins" ref="eric7.PluginManager.PluginManager.html#PluginManager.deactivateVcsPlugins" />
       <keyword name="PluginManager.doShutdown" id="PluginManager.doShutdown" ref="eric7.PluginManager.PluginManager.html#PluginManager.doShutdown" />
+      <keyword name="PluginManager.downLoadRepositoryFile" id="PluginManager.downLoadRepositoryFile" ref="eric7.PluginManager.PluginManager.html#PluginManager.downLoadRepositoryFile" />
       <keyword name="PluginManager.finalizeSetup" id="PluginManager.finalizeSetup" ref="eric7.PluginManager.PluginManager.html#PluginManager.finalizeSetup" />
       <keyword name="PluginManager.getPluginApiFiles" id="PluginManager.getPluginApiFiles" ref="eric7.PluginManager.PluginManager.html#PluginManager.getPluginApiFiles" />
       <keyword name="PluginManager.getPluginConfigData" id="PluginManager.getPluginConfigData" ref="eric7.PluginManager.PluginManager.html#PluginManager.getPluginConfigData" />
@@ -11609,6 +11610,7 @@
       <keyword name="PluginRepositoryWidget.__showAllPlugins" id="PluginRepositoryWidget.__showAllPlugins" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.__showAllPlugins" />
       <keyword name="PluginRepositoryWidget.__sslErrors" id="PluginRepositoryWidget.__sslErrors" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.__sslErrors" />
       <keyword name="PluginRepositoryWidget.__updateHiddenPluginsList" id="PluginRepositoryWidget.__updateHiddenPluginsList" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.__updateHiddenPluginsList" />
+      <keyword name="PluginRepositoryWidget.__updateList" id="PluginRepositoryWidget.__updateList" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.__updateList" />
       <keyword name="PluginRepositoryWidget.__updateStatus" id="PluginRepositoryWidget.__updateStatus" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.__updateStatus" />
       <keyword name="PluginRepositoryWidget.addEntry" id="PluginRepositoryWidget.addEntry" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.addEntry" />
       <keyword name="PluginRepositoryWidget.getDownloadedPlugins" id="PluginRepositoryWidget.getDownloadedPlugins" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.getDownloadedPlugins" />
@@ -11617,7 +11619,7 @@
       <keyword name="PluginRepositoryWidget.on_repositoryList_customContextMenuRequested" id="PluginRepositoryWidget.on_repositoryList_customContextMenuRequested" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.on_repositoryList_customContextMenuRequested" />
       <keyword name="PluginRepositoryWidget.on_repositoryList_itemSelectionChanged" id="PluginRepositoryWidget.on_repositoryList_itemSelectionChanged" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.on_repositoryList_itemSelectionChanged" />
       <keyword name="PluginRepositoryWidget.on_repositoryUrlEditButton_toggled" id="PluginRepositoryWidget.on_repositoryUrlEditButton_toggled" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.on_repositoryUrlEditButton_toggled" />
-      <keyword name="PluginRepositoryWidget.updateList" id="PluginRepositoryWidget.updateList" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.updateList" />
+      <keyword name="PluginRepositoryWidget.reloadList" id="PluginRepositoryWidget.reloadList" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWidget.reloadList" />
       <keyword name="PluginRepositoryWindow" id="PluginRepositoryWindow" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWindow" />
       <keyword name="PluginRepositoryWindow (Constructor)" id="PluginRepositoryWindow (Constructor)" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWindow.__init__" />
       <keyword name="PluginRepositoryWindow.__startPluginInstall" id="PluginRepositoryWindow.__startPluginInstall" ref="eric7.PluginManager.PluginRepositoryDialog.html#PluginRepositoryWindow.__startPluginInstall" />
--- a/eric7/Documentation/Source/eric7.PluginManager.PluginManager.html	Wed Apr 20 15:10:04 2022 +0200
+++ b/eric7/Documentation/Source/eric7.PluginManager.PluginManager.html	Fri Apr 22 16:43:25 2022 +0200
@@ -66,6 +66,11 @@
 emitted just after
         a plugin was deactivated
 </dd>
+<dt>pluginRepositoryFileDownloaded()</dt>
+<dd>
+emitted to indicate a completed
+        download of the plugin repository file
+</dd>
 <dt>shutdown()</dt>
 <dd>
 emitted at shutdown of the IDE
@@ -164,6 +169,10 @@
 <td>Public method called to perform actions upon shutdown of the IDE.</td>
 </tr>
 <tr>
+<td><a href="#PluginManager.downLoadRepositoryFile">downLoadRepositoryFile</a></td>
+<td>Public method to download the plugin repository file.</td>
+</tr>
+<tr>
 <td><a href="#PluginManager.finalizeSetup">finalizeSetup</a></td>
 <td>Public method to finalize the setup of the plugin manager.</td>
 </tr>
@@ -627,6 +636,21 @@
 <p>
         Public method called to perform actions upon shutdown of the IDE.
 </p>
+<a NAME="PluginManager.downLoadRepositoryFile" ID="PluginManager.downLoadRepositoryFile"></a>
+<h4>PluginManager.downLoadRepositoryFile</h4>
+<b>downLoadRepositoryFile</b>(<i>url=None</i>)
+
+<p>
+        Public method to download the plugin repository file.
+</p>
+<dl>
+
+<dt><i>url</i> (QUrl or str (optional))</dt>
+<dd>
+URL to get the plugin repository file from
+            (defaults to None)
+</dd>
+</dl>
 <a NAME="PluginManager.finalizeSetup" ID="PluginManager.finalizeSetup"></a>
 <h4>PluginManager.finalizeSetup</h4>
 <b>finalizeSetup</b>(<i></i>)
--- a/eric7/Documentation/Source/eric7.PluginManager.PluginRepositoryDialog.html	Wed Apr 20 15:10:04 2022 +0200
+++ b/eric7/Documentation/Source/eric7.PluginManager.PluginRepositoryDialog.html	Fri Apr 22 16:43:25 2022 +0200
@@ -266,6 +266,10 @@
 <td>Private method to store the list of hidden plug-ins to the settings.</td>
 </tr>
 <tr>
+<td><a href="#PluginRepositoryWidget.__updateList">__updateList</a></td>
+<td>Private slot to download a new list and display the contents.</td>
+</tr>
+<tr>
 <td><a href="#PluginRepositoryWidget.__updateStatus">__updateStatus</a></td>
 <td>Private method to check the given archive update status.</td>
 </tr>
@@ -298,8 +302,8 @@
 <td>Private slot to set the read only status of the repository URL line edit.</td>
 </tr>
 <tr>
-<td><a href="#PluginRepositoryWidget.updateList">updateList</a></td>
-<td>Public slot to download a new list and display the contents.</td>
+<td><a href="#PluginRepositoryWidget.reloadList">reloadList</a></td>
+<td>Public method to reload the list of plugins.</td>
 </tr>
 </table>
 <h3>Static Methods</h3>
@@ -650,6 +654,13 @@
             (list of string)
 </dd>
 </dl>
+<a NAME="PluginRepositoryWidget.__updateList" ID="PluginRepositoryWidget.__updateList"></a>
+<h4>PluginRepositoryWidget.__updateList</h4>
+<b>__updateList</b>(<i></i>)
+
+<p>
+        Private slot to download a new list and display the contents.
+</p>
 <a NAME="PluginRepositoryWidget.__updateStatus" ID="PluginRepositoryWidget.__updateStatus"></a>
 <h4>PluginRepositoryWidget.__updateStatus</h4>
 <b>__updateStatus</b>(<i>filename, version</i>)
@@ -799,12 +810,12 @@
 state of the push button (boolean)
 </dd>
 </dl>
-<a NAME="PluginRepositoryWidget.updateList" ID="PluginRepositoryWidget.updateList"></a>
-<h4>PluginRepositoryWidget.updateList</h4>
-<b>updateList</b>(<i></i>)
+<a NAME="PluginRepositoryWidget.reloadList" ID="PluginRepositoryWidget.reloadList"></a>
+<h4>PluginRepositoryWidget.reloadList</h4>
+<b>reloadList</b>(<i></i>)
 
 <p>
-        Public slot to download a new list and display the contents.
+        Public method to reload the list of plugins.
 </p>
 <div align="right"><a href="#top">Up</a></div>
 <hr />
--- a/eric7/PluginManager/PluginManager.py	Wed Apr 20 15:10:04 2022 +0200
+++ b/eric7/PluginManager/PluginManager.py	Fri Apr 22 16:43:25 2022 +0200
@@ -63,6 +63,8 @@
         before a plugin is deactivated
     @signal pluginDeactivated(moduleName, pluginObject) emitted just after
         a plugin was deactivated
+    @signal pluginRepositoryFileDownloaded() emitted to indicate a completed
+        download of the plugin repository file
     """
     shutdown = pyqtSignal()
     pluginAboutToBeActivated = pyqtSignal(str, object)
@@ -70,6 +72,7 @@
     allPlugginsActivated = pyqtSignal()
     pluginAboutToBeDeactivated = pyqtSignal(str, object)
     pluginDeactivated = pyqtSignal(str, object)
+    pluginRepositoryFileDownloaded = pyqtSignal()
     
     def __init__(self, parent=None, disabledPlugins=None, doLoadPlugins=True,
                  develPlugin=None):
@@ -1231,8 +1234,15 @@
         Public method to check the availability of updates of plug-ins.
         """
         period = Preferences.getPluginManager("UpdatesCheckInterval")
+        # 0 = off
+        # 1 = daily
+        # 2 = weekly
+        # 3 = monthly
+        # 4 = always
+        
         if period == 0 or not self.__ui.isOnline():
             return
+        
         elif period in [1, 2, 3]:
             lastModified = QFileInfo(self.pluginRepositoryFile).lastModified()
             if lastModified.isValid() and lastModified.date().isValid():
@@ -1247,10 +1257,21 @@
                     # daily, weekly, monthly
                     return
         
+        self.downLoadRepositoryFile()
+    
+    def downLoadRepositoryFile(self, url=None):
+        """
+        Public method to download the plugin repository file.
+        
+        @param url URL to get the plugin repository file from
+            (defaults to None)
+        @type QUrl or str (optional)
+        """
         self.__updateAvailable = False
         
-        request = QNetworkRequest(
-            QUrl(Preferences.getUI("PluginRepositoryUrl7")))
+        if url is None:
+            url = Preferences.getUI("PluginRepositoryUrl7")
+        request = QNetworkRequest(QUrl(url))
         request.setAttribute(
             QNetworkRequest.Attribute.CacheLoadControlAttribute,
             QNetworkRequest.CacheLoadControl.AlwaysNetwork)
@@ -1310,6 +1331,8 @@
                 
                 if self.__updateAvailable:
                     self.__ui.activatePluginRepositoryViewer()
+                else:
+                    self.pluginRepositoryFileDownloaded.emit()
     
     def checkPluginEntry(self, name, short, description, url, author, version,
                          filename, status):
--- a/eric7/PluginManager/PluginRepositoryDialog.py	Wed Apr 20 15:10:04 2022 +0200
+++ b/eric7/PluginManager/PluginRepositoryDialog.py	Fri Apr 22 16:43:25 2022 +0200
@@ -102,7 +102,7 @@
             self.__updateButton = QToolButton(self)
             self.__updateButton.setIcon(UI.PixmapCache.getIcon("reload"))
             self.__updateButton.setToolTip(self.tr("Update"))
-            self.__updateButton.clicked.connect(self.updateList)
+            self.__updateButton.clicked.connect(self.__updateList)
             self.__actionButtonsLayout.addWidget(self.__updateButton)
             
             self.__downloadButton = QToolButton(self)
@@ -186,6 +186,9 @@
         self.pluginRepositoryFile = os.path.join(Utilities.getConfigDir(),
                                                  "PluginRepository")
         
+        self.__pluginManager.pluginRepositoryFileDownloaded.connect(
+            self.__populateList)
+        
         # attributes for the network objects
         self.__networkManager = QNetworkAccessManager(self)
         self.__networkManager.proxyAuthenticationRequired.connect(
@@ -246,7 +249,7 @@
         @param button reference to the button pressed (QAbstractButton)
         """
         if button == self.__updateButton:
-            self.updateList()
+            self.__updateList()
         elif button == self.__downloadButton:
             self.__downloadButtonClicked()
         elif button == self.__downloadInstallButton:
@@ -373,14 +376,19 @@
         self.__downloadInstallButton.setEnabled(enable and self.__online)
         self.__installButton.setEnabled(enable)
     
-    def updateList(self):
+    def reloadList(self):
+        """
+        Public method to reload the list of plugins.
         """
-        Public slot to download a new list and display the contents.
+        self.__populateList()
+    
+    @pyqtSlot()
+    def __updateList(self):
+        """
+        Private slot to download a new list and display the contents.
         """
         url = self.repositoryUrlEdit.text()
-        self.__downloadFile(url,
-                            self.pluginRepositoryFile,
-                            self.__downloadRepositoryFileDone)
+        self.__pluginManager.downLoadRepositoryFile(url=url)
     
     def __downloadRepositoryFileDone(self, status, filename):
         """
--- a/eric7/UI/UserInterface.py	Wed Apr 20 15:10:04 2022 +0200
+++ b/eric7/UI/UserInterface.py	Fri Apr 22 16:43:25 2022 +0200
@@ -7323,7 +7323,7 @@
             del self.__pluginInstallDialog
             self.__restart(ask=True)
         
-        self.pluginRepositoryViewer.updateList()
+        self.pluginRepositoryViewer.reloadList()
         
     def __deinstallPlugin(self):
         """
@@ -7371,7 +7371,7 @@
         """
         Public slot to activate the plugin repository viewer.
         """
-        self.pluginRepositoryViewer.updateList()
+        self.pluginRepositoryViewer.reloadList()
         
         if self.__layoutType == "Toolboxes":
             self.rToolboxDock.show()

eric ide

mercurial