eric7/UI/UserInterface.py

branch
eric7
changeset 8595
ce2034bc1c6e
parent 8593
1d66b6af60ed
child 8610
c9cd21bcbe33
equal deleted inserted replaced
8594:f254ab0d42fa 8595:ce2034bc1c6e
619 if self.codeDocumentationViewer is not None: 619 if self.codeDocumentationViewer is not None:
620 ericApp().registerObject("DocuViewer", 620 ericApp().registerObject("DocuViewer",
621 self.codeDocumentationViewer) 621 self.codeDocumentationViewer)
622 if self.microPythonWidget is not None: 622 if self.microPythonWidget is not None:
623 ericApp().registerObject("MicroPython", self.microPythonWidget) 623 ericApp().registerObject("MicroPython", self.microPythonWidget)
624 ericApp().registerObject("JediAssistant", self.jediAssistant)
625 ericApp().registerObject("PluginRepositoryViewer",
626 self.pluginRepositoryViewer)
624 627
625 # list of web addresses serving the versions file 628 # list of web addresses serving the versions file
626 self.__httpAlternatives = Preferences.getUI("VersionsUrls7") 629 self.__httpAlternatives = Preferences.getUI("VersionsUrls7")
627 self.__inVersionCheck = False 630 self.__inVersionCheck = False
628 self.__versionCheckProgress = None 631 self.__versionCheckProgress = None
931 # Create the Jedi Assistant 934 # Create the Jedi Assistant
932 logging.debug("Creating Jedi Assistant...") 935 logging.debug("Creating Jedi Assistant...")
933 from JediInterface.AssistantJedi import AssistantJedi 936 from JediInterface.AssistantJedi import AssistantJedi
934 self.jediAssistant = AssistantJedi( 937 self.jediAssistant = AssistantJedi(
935 self, self.viewmanager, self.project) 938 self, self.viewmanager, self.project)
939
940 # Create the plug-ins repository viewer
941 from PluginManager.PluginRepositoryDialog import PluginRepositoryWidget
942 self.pluginRepositoryViewer = PluginRepositoryWidget(
943 self.pluginManager, integrated=True, parent=self)
944 self.pluginRepositoryViewer.closeAndInstall.connect(
945 self.__installDownloadedPlugins)
936 946
937 def __createLayout(self): 947 def __createLayout(self):
938 """ 948 """
939 Private method to create the layout of the various windows. 949 Private method to create the layout of the various windows.
940 950
1051 1061
1052 self.rToolbox.addItem(self.debugViewer, 1062 self.rToolbox.addItem(self.debugViewer,
1053 UI.PixmapCache.getIcon("debugViewer"), 1063 UI.PixmapCache.getIcon("debugViewer"),
1054 self.tr("Debug-Viewer")) 1064 self.tr("Debug-Viewer"))
1055 1065
1066 self.rToolbox.addItem(self.pluginRepositoryViewer,
1067 UI.PixmapCache.getIcon("pluginRepository"),
1068 self.tr("Plugin Repository"))
1069
1056 if self.pipWidget: 1070 if self.pipWidget:
1057 self.rToolbox.addItem(self.pipWidget, 1071 self.rToolbox.addItem(self.pipWidget,
1058 UI.PixmapCache.getIcon("pypi"), 1072 UI.PixmapCache.getIcon("pypi"),
1059 self.tr("PyPI")) 1073 self.tr("PyPI"))
1060 1074
1184 self.tr("Code Documentation Viewer")) 1198 self.tr("Code Documentation Viewer"))
1185 1199
1186 self.rightSidebar.addTab( 1200 self.rightSidebar.addTab(
1187 self.debugViewer, UI.PixmapCache.getIcon("sbDebugViewer96"), 1201 self.debugViewer, UI.PixmapCache.getIcon("sbDebugViewer96"),
1188 self.tr("Debug-Viewer")) 1202 self.tr("Debug-Viewer"))
1189 1203
1204 self.rightSidebar.addTab(
1205 self.pluginRepositoryViewer,
1206 UI.PixmapCache.getIcon("sbPluginRepository96"),
1207 self.tr("Plugin Repository"))
1208
1190 if self.pipWidget: 1209 if self.pipWidget:
1191 self.rightSidebar.addTab( 1210 self.rightSidebar.addTab(
1192 self.pipWidget, UI.PixmapCache.getIcon("sbPyPI96"), 1211 self.pipWidget, UI.PixmapCache.getIcon("sbPyPI96"),
1193 self.tr("PyPI")) 1212 self.tr("PyPI"))
1194 1213
2143 self.microPythonWidgetActivateAct.triggered.connect( 2162 self.microPythonWidgetActivateAct.triggered.connect(
2144 self.__activateMicroPython) 2163 self.__activateMicroPython)
2145 self.actions.append(self.microPythonWidgetActivateAct) 2164 self.actions.append(self.microPythonWidgetActivateAct)
2146 self.addAction(self.microPythonWidgetActivateAct) 2165 self.addAction(self.microPythonWidgetActivateAct)
2147 2166
2167 self.pluginRepositoryViewerActivateAct = EricAction(
2168 self.tr('Plugin Repository'),
2169 self.tr('Plugin Repository'),
2170 QKeySequence(self.tr("Ctrl+Alt+Shift+R")),
2171 0, self,
2172 'plugin_repository_viewer_activate')
2173 self.pluginRepositoryViewerActivateAct.setStatusTip(self.tr(
2174 "Switch the input focus to the Plugin Repository window."))
2175 self.pluginRepositoryViewerActivateAct.setWhatsThis(self.tr(
2176 """<b>Plugin Repository</b>"""
2177 """<p>This switches the input focus to the Plugin Repository"""
2178 """ window.</p>"""
2179 ))
2180 self.pluginRepositoryViewerActivateAct.triggered.connect(
2181 self.activatePluginRepositoryViewer)
2182 self.actions.append(self.pluginRepositoryViewerActivateAct)
2183 self.addAction(self.pluginRepositoryViewerActivateAct)
2184
2148 self.whatsThisAct = EricAction( 2185 self.whatsThisAct = EricAction(
2149 self.tr('What\'s This?'), 2186 self.tr('What\'s This?'),
2150 UI.PixmapCache.getIcon("whatsThis"), 2187 UI.PixmapCache.getIcon("whatsThis"),
2151 self.tr('&What\'s This?'), 2188 self.tr('&What\'s This?'),
2152 QKeySequence(self.tr("Shift+F1")), 2189 QKeySequence(self.tr("Shift+F1")),
2831 self.pluginRepoAct.setWhatsThis(self.tr( 2868 self.pluginRepoAct.setWhatsThis(self.tr(
2832 """<b>Plugin Repository...</b>""" 2869 """<b>Plugin Repository...</b>"""
2833 """<p>This opens a dialog, that shows a list of plugins """ 2870 """<p>This opens a dialog, that shows a list of plugins """
2834 """available on the Internet.</p>""" 2871 """available on the Internet.</p>"""
2835 )) 2872 ))
2836 self.pluginRepoAct.triggered.connect(self.showPluginsAvailable) 2873 self.pluginRepoAct.triggered.connect(self.__showPluginsAvailable)
2837 self.actions.append(self.pluginRepoAct) 2874 self.actions.append(self.pluginRepoAct)
2838 2875
2839 self.virtualenvManagerAct = EricAction( 2876 self.virtualenvManagerAct = EricAction(
2840 self.tr('Virtualenv Manager'), 2877 self.tr('Virtualenv Manager'),
2841 UI.PixmapCache.getIcon("virtualenv"), 2878 UI.PixmapCache.getIcon("virtualenv"),
3251 ############################################################## 3288 ##############################################################
3252 3289
3253 self.__menus["subwindow"] = QMenu(self.tr("&Windows"), 3290 self.__menus["subwindow"] = QMenu(self.tr("&Windows"),
3254 self.__menus["window"]) 3291 self.__menus["window"])
3255 self.__menus["subwindow"].setTearOffEnabled(True) 3292 self.__menus["subwindow"].setTearOffEnabled(True)
3293
3256 # central park 3294 # central park
3257 self.__menus["subwindow"].addSection(self.tr("Central Park")) 3295 self.__menus["subwindow"].addSection(self.tr("Central Park"))
3258 self.__menus["subwindow"].addAction(self.viewmanagerActivateAct) 3296 self.__menus["subwindow"].addAction(self.viewmanagerActivateAct)
3297
3259 # left side 3298 # left side
3260 self.__menus["subwindow"].addSection(self.tr("Left Side")) 3299 self.__menus["subwindow"].addSection(self.tr("Left Side"))
3261 if self.__shellPosition == "left": 3300 if self.__shellPosition == "left":
3262 self.__menus["subwindow"].addAction(self.shellActivateAct) 3301 self.__menus["subwindow"].addAction(self.shellActivateAct)
3263 self.__menus["subwindow"].addAction(self.pbActivateAct) 3302 self.__menus["subwindow"].addAction(self.pbActivateAct)
3266 self.__menus["subwindow"].addAction(self.templateViewerActivateAct) 3305 self.__menus["subwindow"].addAction(self.templateViewerActivateAct)
3267 if self.browser is not None: 3306 if self.browser is not None:
3268 self.__menus["subwindow"].addAction(self.browserActivateAct) 3307 self.__menus["subwindow"].addAction(self.browserActivateAct)
3269 if self.symbolsViewer is not None: 3308 if self.symbolsViewer is not None:
3270 self.__menus["subwindow"].addAction(self.symbolsViewerActivateAct) 3309 self.__menus["subwindow"].addAction(self.symbolsViewerActivateAct)
3310
3271 # bottom side 3311 # bottom side
3272 self.__menus["subwindow"].addSection(self.tr("Bottom Side")) 3312 self.__menus["subwindow"].addSection(self.tr("Bottom Side"))
3273 if self.__shellPosition == "bottom": 3313 if self.__shellPosition == "bottom":
3274 self.__menus["subwindow"].addAction(self.shellActivateAct) 3314 self.__menus["subwindow"].addAction(self.shellActivateAct)
3275 self.__menus["subwindow"].addAction(self.taskViewerActivateAct) 3315 self.__menus["subwindow"].addAction(self.taskViewerActivateAct)
3276 self.__menus["subwindow"].addAction(self.logViewerActivateAct) 3316 self.__menus["subwindow"].addAction(self.logViewerActivateAct)
3277 if self.numbersViewer is not None: 3317 if self.numbersViewer is not None:
3278 self.__menus["subwindow"].addAction(self.numbersViewerActivateAct) 3318 self.__menus["subwindow"].addAction(self.numbersViewerActivateAct)
3319
3320 # right side
3279 self.__menus["subwindow"].addSection(self.tr("Right Side")) 3321 self.__menus["subwindow"].addSection(self.tr("Right Side"))
3280 # right side
3281 if self.__shellPosition == "right": 3322 if self.__shellPosition == "right":
3282 self.__menus["subwindow"].addAction(self.shellActivateAct) 3323 self.__menus["subwindow"].addAction(self.shellActivateAct)
3283 if self.codeDocumentationViewer is not None: 3324 if self.codeDocumentationViewer is not None:
3284 self.__menus["subwindow"].addAction( 3325 self.__menus["subwindow"].addAction(
3285 self.codeDocumentationViewerActivateAct) 3326 self.codeDocumentationViewerActivateAct)
3286 self.__menus["subwindow"].addAction(self.debugViewerActivateAct) 3327 self.__menus["subwindow"].addAction(self.debugViewerActivateAct)
3328 self.__menus["subwindow"].addAction(
3329 self.pluginRepositoryViewerActivateAct)
3287 if self.pipWidget is not None: 3330 if self.pipWidget is not None:
3288 self.__menus["subwindow"].addAction(self.pipWidgetActivateAct) 3331 self.__menus["subwindow"].addAction(self.pipWidgetActivateAct)
3289 if self.condaWidget is not None: 3332 if self.condaWidget is not None:
3290 self.__menus["subwindow"].addAction(self.condaWidgetActivateAct) 3333 self.__menus["subwindow"].addAction(self.condaWidgetActivateAct)
3291 if self.cooperation is not None: 3334 if self.cooperation is not None:
6872 if self.__pluginInstallDialog.restartNeeded(): 6915 if self.__pluginInstallDialog.restartNeeded():
6873 self.__pluginInstallDialog.deleteLater() 6916 self.__pluginInstallDialog.deleteLater()
6874 del self.__pluginInstallDialog 6917 del self.__pluginInstallDialog
6875 self.__restart(ask=True) 6918 self.__restart(ask=True)
6876 6919
6920 self.pluginRepositoryViewer.updateList()
6921
6877 def __deinstallPlugin(self): 6922 def __deinstallPlugin(self):
6878 """ 6923 """
6879 Private slot to show a dialog to uninstall a plugin. 6924 Private slot to show a dialog to uninstall a plugin.
6880 """ 6925 """
6881 from PluginManager.PluginUninstallDialog import PluginUninstallDialog 6926 from PluginManager.PluginUninstallDialog import PluginUninstallDialog
6882 dlg = PluginUninstallDialog(self.pluginManager, self) 6927 dlg = PluginUninstallDialog(self.pluginManager, self)
6883 dlg.exec() 6928 dlg.exec()
6884 6929
6885 def showPluginsAvailable(self): 6930 @pyqtSlot()
6886 """ 6931 def __showPluginsAvailable(self):
6887 Public slot to show the plugins available for download. 6932 """
6933 Private slot to show the plugins available for download.
6888 """ 6934 """
6889 from PluginManager.PluginRepositoryDialog import PluginRepositoryDialog 6935 from PluginManager.PluginRepositoryDialog import PluginRepositoryDialog
6890 dlg = PluginRepositoryDialog(self.pluginManager, self) 6936 dlg = PluginRepositoryDialog(self.pluginManager, self)
6891 res = dlg.exec() 6937 res = dlg.exec()
6892 if res == (QDialog.DialogCode.Accepted + 1): 6938 if res == (QDialog.DialogCode.Accepted + 1):
6902 """ 6948 """
6903 Public method to check the availability of updates of plug-ins. 6949 Public method to check the availability of updates of plug-ins.
6904 """ 6950 """
6905 if self.isOnline(): 6951 if self.isOnline():
6906 self.pluginManager.checkPluginUpdatesAvailable() 6952 self.pluginManager.checkPluginUpdatesAvailable()
6953
6954 @pyqtSlot()
6955 def __installDownloadedPlugins(self):
6956 """
6957 Private slot to handle the installation of plugins downloaded via the
6958 plugin repository viewer.
6959 """
6960 self.__installPlugins(
6961 self.pluginRepositoryViewer.getDownloadedPlugins())
6962
6963 @pyqtSlot()
6964 def activatePluginRepositoryViewer(self):
6965 """
6966 Public slot to activate the plugin repository viewer.
6967 """
6968 self.pluginRepositoryViewer.updateList()
6969
6970 if self.__layoutType == "Toolboxes":
6971 self.rToolboxDock.show()
6972 self.rToolbox.setCurrentWidget(self.pluginRepositoryViewer)
6973 elif self.__layoutType == "Sidebars":
6974 self.rightSidebar.show()
6975 self.rightSidebar.setCurrentWidget(self.pluginRepositoryViewer)
6976 self.pluginRepositoryViewer.setFocus(
6977 Qt.FocusReason.ActiveWindowFocusReason)
6907 6978
6908 ################################################################# 6979 #################################################################
6909 ## Drag and Drop Support 6980 ## Drag and Drop Support
6910 ################################################################# 6981 #################################################################
6911 6982

eric ide

mercurial