eric7/PluginManager/PluginManager.py

branch
eric7
changeset 8356
68ec9c3d4de5
parent 8354
12ebd3934fef
child 8358
144a6b854f70
equal deleted inserted replaced
8355:8a7677a63c8d 8356:68ec9c3d4de5
20 from PyQt6.QtGui import QPixmap 20 from PyQt6.QtGui import QPixmap
21 from PyQt6.QtNetwork import ( 21 from PyQt6.QtNetwork import (
22 QNetworkAccessManager, QNetworkRequest, QNetworkReply 22 QNetworkAccessManager, QNetworkRequest, QNetworkReply
23 ) 23 )
24 24
25 from E5Gui import E5MessageBox 25 from E5Gui import EricMessageBox
26 from E5Gui.E5Application import e5App 26 from E5Gui.EricApplication import ericApp
27 27
28 from EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired 28 from EricNetwork.EricNetworkProxyFactory import proxyAuthenticationRequired
29 try: 29 try:
30 from EricNetwork.EricSslErrorHandler import EricSslErrorHandler, EricSslErrorState 30 from EricNetwork.EricSslErrorHandler import EricSslErrorHandler, EricSslErrorState
31 SSL_AVAILABLE = True 31 SSL_AVAILABLE = True
436 importlib.reload(module) 436 importlib.reload(module)
437 self.initOnDemandPlugin(name) 437 self.initOnDemandPlugin(name)
438 with contextlib.suppress(KeyError, AttributeError): 438 with contextlib.suppress(KeyError, AttributeError):
439 pluginObject = self.__onDemandInactivePlugins[name] 439 pluginObject = self.__onDemandInactivePlugins[name]
440 pluginObject.initToolbar( 440 pluginObject.initToolbar(
441 self.__ui, e5App().getObject("ToolbarManager")) 441 self.__ui, ericApp().getObject("ToolbarManager"))
442 except PluginLoadError: 442 except PluginLoadError:
443 print("Error loading plug-in module:", name) 443 print("Error loading plug-in module:", name)
444 except Exception as err: 444 except Exception as err:
445 module = types.ModuleType(name) 445 module = types.ModuleType(name)
446 module.error = self.tr( 446 module.error = self.tr(
552 def initPluginToolbars(self, toolbarManager): 552 def initPluginToolbars(self, toolbarManager):
553 """ 553 """
554 Public method to initialize plug-in toolbars. 554 Public method to initialize plug-in toolbars.
555 555
556 @param toolbarManager reference to the toolbar manager object 556 @param toolbarManager reference to the toolbar manager object
557 (E5ToolBarManager) 557 (EricToolBarManager)
558 """ 558 """
559 self.initOnDemandPlugins() 559 self.initOnDemandPlugins()
560 for pluginObject in self.__onDemandInactivePlugins.values(): 560 for pluginObject in self.__onDemandInactivePlugins.values():
561 with contextlib.suppress(AttributeError): 561 with contextlib.suppress(AttributeError):
562 pluginObject.initToolbar(self.__ui, toolbarManager) 562 pluginObject.initToolbar(self.__ui, toolbarManager)
1198 downloadDir = self.__defaultDownloadDir 1198 downloadDir = self.__defaultDownloadDir
1199 if not os.path.exists(downloadDir): 1199 if not os.path.exists(downloadDir):
1200 try: 1200 try:
1201 os.mkdir(downloadDir, 0o755) 1201 os.mkdir(downloadDir, 0o755)
1202 except OSError as err: 1202 except OSError as err:
1203 E5MessageBox.critical( 1203 EricMessageBox.critical(
1204 self.__ui, 1204 self.__ui,
1205 self.tr("Plugin Manager Error"), 1205 self.tr("Plugin Manager Error"),
1206 self.tr( 1206 self.tr(
1207 """<p>The plugin download directory""" 1207 """<p>The plugin download directory"""
1208 """ <b>{0}</b> could not be created. Please""" 1208 """ <b>{0}</b> could not be created. Please"""
1275 """ 1275 """
1276 if reply in self.__replies: 1276 if reply in self.__replies:
1277 self.__replies.remove(reply) 1277 self.__replies.remove(reply)
1278 1278
1279 if reply.error() != QNetworkReply.NetworkError.NoError: 1279 if reply.error() != QNetworkReply.NetworkError.NoError:
1280 E5MessageBox.warning( 1280 EricMessageBox.warning(
1281 None, 1281 None,
1282 self.tr("Error downloading file"), 1282 self.tr("Error downloading file"),
1283 self.tr( 1283 self.tr(
1284 """<p>Could not download the requested file""" 1284 """<p>Could not download the requested file"""
1285 """ from {0}.</p><p>Error: {1}</p>""" 1285 """ from {0}.</p><p>Error: {1}</p>"""
1312 # redo if it is a redirect 1312 # redo if it is a redirect
1313 self.checkPluginUpdatesAvailable() 1313 self.checkPluginUpdatesAvailable()
1314 return 1314 return
1315 1315
1316 if self.__updateAvailable: 1316 if self.__updateAvailable:
1317 res = E5MessageBox.information( 1317 res = EricMessageBox.information(
1318 None, 1318 None,
1319 self.tr("New plugin versions available"), 1319 self.tr("New plugin versions available"),
1320 self.tr("<p>There are new plug-ins or plug-in" 1320 self.tr("<p>There are new plug-ins or plug-in"
1321 " updates available. Use the plug-in" 1321 " updates available. Use the plug-in"
1322 " repository dialog to get them.</p>"), 1322 " repository dialog to get them.</p>"),
1323 E5MessageBox.Ignore | E5MessageBox.Open, 1323 EricMessageBox.Ignore | EricMessageBox.Open,
1324 E5MessageBox.Open) 1324 EricMessageBox.Open)
1325 if res == E5MessageBox.Open: 1325 if res == EricMessageBox.Open:
1326 self.__ui.showPluginsAvailable() 1326 self.__ui.showPluginsAvailable()
1327 1327
1328 def checkPluginEntry(self, name, short, description, url, author, version, 1328 def checkPluginEntry(self, name, short, description, url, author, version,
1329 filename, status): 1329 filename, status):
1330 """ 1330 """
1434 1434
1435 @param packages list of packages to install 1435 @param packages list of packages to install
1436 @type list of str 1436 @type list of str
1437 """ 1437 """
1438 try: 1438 try:
1439 pip = e5App().getObject("Pip") 1439 pip = ericApp().getObject("Pip")
1440 except KeyError: 1440 except KeyError:
1441 # Installation is performed via the plug-in installation script. 1441 # Installation is performed via the plug-in installation script.
1442 from PipInterface.Pip import Pip 1442 from PipInterface.Pip import Pip
1443 pip = Pip(self) 1443 pip = Pip(self)
1444 pip.installPackages(packages, interpreter=sys.executable) 1444 pip.installPackages(packages, interpreter=sys.executable)

eric ide

mercurial