eric7/UI/UserInterface.py

branch
eric7
changeset 8595
ce2034bc1c6e
parent 8593
1d66b6af60ed
child 8610
c9cd21bcbe33
diff -r f254ab0d42fa -r ce2034bc1c6e eric7/UI/UserInterface.py
--- a/eric7/UI/UserInterface.py	Sat Sep 11 19:59:21 2021 +0200
+++ b/eric7/UI/UserInterface.py	Sun Sep 12 17:30:38 2021 +0200
@@ -621,6 +621,9 @@
                                      self.codeDocumentationViewer)
         if self.microPythonWidget is not None:
             ericApp().registerObject("MicroPython", self.microPythonWidget)
+        ericApp().registerObject("JediAssistant", self.jediAssistant)
+        ericApp().registerObject("PluginRepositoryViewer",
+                                 self.pluginRepositoryViewer)
         
         # list of web addresses serving the versions file
         self.__httpAlternatives = Preferences.getUI("VersionsUrls7")
@@ -933,6 +936,13 @@
         from JediInterface.AssistantJedi import AssistantJedi
         self.jediAssistant = AssistantJedi(
             self, self.viewmanager, self.project)
+        
+        # Create the plug-ins repository viewer
+        from PluginManager.PluginRepositoryDialog import PluginRepositoryWidget
+        self.pluginRepositoryViewer = PluginRepositoryWidget(
+            self.pluginManager, integrated=True, parent=self)
+        self.pluginRepositoryViewer.closeAndInstall.connect(
+            self.__installDownloadedPlugins)
     
     def __createLayout(self):
         """
@@ -1053,6 +1063,10 @@
                               UI.PixmapCache.getIcon("debugViewer"),
                               self.tr("Debug-Viewer"))
         
+        self.rToolbox.addItem(self.pluginRepositoryViewer,
+                              UI.PixmapCache.getIcon("pluginRepository"),
+                              self.tr("Plugin Repository"))
+        
         if self.pipWidget:
             self.rToolbox.addItem(self.pipWidget,
                                   UI.PixmapCache.getIcon("pypi"),
@@ -1186,7 +1200,12 @@
         self.rightSidebar.addTab(
             self.debugViewer, UI.PixmapCache.getIcon("sbDebugViewer96"),
             self.tr("Debug-Viewer"))
-
+        
+        self.rightSidebar.addTab(
+            self.pluginRepositoryViewer,
+            UI.PixmapCache.getIcon("sbPluginRepository96"),
+            self.tr("Plugin Repository"))
+        
         if self.pipWidget:
             self.rightSidebar.addTab(
                 self.pipWidget, UI.PixmapCache.getIcon("sbPyPI96"),
@@ -2145,6 +2164,24 @@
             self.actions.append(self.microPythonWidgetActivateAct)
             self.addAction(self.microPythonWidgetActivateAct)
         
+        self.pluginRepositoryViewerActivateAct = EricAction(
+            self.tr('Plugin Repository'),
+            self.tr('Plugin Repository'),
+            QKeySequence(self.tr("Ctrl+Alt+Shift+R")),
+            0, self,
+            'plugin_repository_viewer_activate')
+        self.pluginRepositoryViewerActivateAct.setStatusTip(self.tr(
+            "Switch the input focus to the Plugin Repository window."))
+        self.pluginRepositoryViewerActivateAct.setWhatsThis(self.tr(
+            """<b>Plugin Repository</b>"""
+            """<p>This switches the input focus to the Plugin Repository"""
+            """ window.</p>"""
+        ))
+        self.pluginRepositoryViewerActivateAct.triggered.connect(
+            self.activatePluginRepositoryViewer)
+        self.actions.append(self.pluginRepositoryViewerActivateAct)
+        self.addAction(self.pluginRepositoryViewerActivateAct)
+        
         self.whatsThisAct = EricAction(
             self.tr('What\'s This?'),
             UI.PixmapCache.getIcon("whatsThis"),
@@ -2833,7 +2870,7 @@
             """<p>This opens a dialog, that shows a list of plugins """
             """available on the Internet.</p>"""
         ))
-        self.pluginRepoAct.triggered.connect(self.showPluginsAvailable)
+        self.pluginRepoAct.triggered.connect(self.__showPluginsAvailable)
         self.actions.append(self.pluginRepoAct)
         
         self.virtualenvManagerAct = EricAction(
@@ -3253,9 +3290,11 @@
         self.__menus["subwindow"] = QMenu(self.tr("&Windows"),
                                           self.__menus["window"])
         self.__menus["subwindow"].setTearOffEnabled(True)
+        
         # central park
         self.__menus["subwindow"].addSection(self.tr("Central Park"))
         self.__menus["subwindow"].addAction(self.viewmanagerActivateAct)
+        
         # left side
         self.__menus["subwindow"].addSection(self.tr("Left Side"))
         if self.__shellPosition == "left":
@@ -3268,6 +3307,7 @@
             self.__menus["subwindow"].addAction(self.browserActivateAct)
         if self.symbolsViewer is not None:
             self.__menus["subwindow"].addAction(self.symbolsViewerActivateAct)
+        
         # bottom side
         self.__menus["subwindow"].addSection(self.tr("Bottom Side"))
         if self.__shellPosition == "bottom":
@@ -3276,14 +3316,17 @@
         self.__menus["subwindow"].addAction(self.logViewerActivateAct)
         if self.numbersViewer is not None:
             self.__menus["subwindow"].addAction(self.numbersViewerActivateAct)
+        
+        # right side
         self.__menus["subwindow"].addSection(self.tr("Right Side"))
-        # right side
         if self.__shellPosition == "right":
             self.__menus["subwindow"].addAction(self.shellActivateAct)
         if self.codeDocumentationViewer is not None:
             self.__menus["subwindow"].addAction(
                 self.codeDocumentationViewerActivateAct)
         self.__menus["subwindow"].addAction(self.debugViewerActivateAct)
+        self.__menus["subwindow"].addAction(
+            self.pluginRepositoryViewerActivateAct)
         if self.pipWidget is not None:
             self.__menus["subwindow"].addAction(self.pipWidgetActivateAct)
         if self.condaWidget is not None:
@@ -6874,6 +6917,8 @@
             del self.__pluginInstallDialog
             self.__restart(ask=True)
         
+        self.pluginRepositoryViewer.updateList()
+        
     def __deinstallPlugin(self):
         """
         Private slot to show a dialog to uninstall a plugin.
@@ -6881,10 +6926,11 @@
         from PluginManager.PluginUninstallDialog import PluginUninstallDialog
         dlg = PluginUninstallDialog(self.pluginManager, self)
         dlg.exec()
-        
-    def showPluginsAvailable(self):
-        """
-        Public slot to show the plugins available for download.
+    
+    @pyqtSlot()
+    def __showPluginsAvailable(self):
+        """
+        Private slot to show the plugins available for download.
         """
         from PluginManager.PluginRepositoryDialog import PluginRepositoryDialog
         dlg = PluginRepositoryDialog(self.pluginManager, self)
@@ -6905,6 +6951,31 @@
         if self.isOnline():
             self.pluginManager.checkPluginUpdatesAvailable()
     
+    @pyqtSlot()
+    def __installDownloadedPlugins(self):
+        """
+        Private slot to handle the installation of plugins downloaded via the
+        plugin repository viewer.
+        """
+        self.__installPlugins(
+            self.pluginRepositoryViewer.getDownloadedPlugins())
+    
+    @pyqtSlot()
+    def activatePluginRepositoryViewer(self):
+        """
+        Public slot to activate the plugin repository viewer.
+        """
+        self.pluginRepositoryViewer.updateList()
+        
+        if self.__layoutType == "Toolboxes":
+            self.rToolboxDock.show()
+            self.rToolbox.setCurrentWidget(self.pluginRepositoryViewer)
+        elif self.__layoutType == "Sidebars":
+            self.rightSidebar.show()
+            self.rightSidebar.setCurrentWidget(self.pluginRepositoryViewer)
+        self.pluginRepositoryViewer.setFocus(
+            Qt.FocusReason.ActiveWindowFocusReason)
+    
     #################################################################
     ## Drag and Drop Support
     #################################################################

eric ide

mercurial