PluginManager/PluginRepositoryDialog.py

changeset 2354
c63de4af553d
parent 2302
f29e9405c851
child 2360
b6bf3925e3e1
equal deleted inserted replaced
2352:21971ebfaaef 2354:c63de4af553d
14 14
15 from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QFile, QIODevice, QUrl, QProcess 15 from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QFile, QIODevice, QUrl, QProcess
16 from PyQt4.QtGui import QWidget, QDialogButtonBox, QAbstractButton, QTreeWidgetItem, \ 16 from PyQt4.QtGui import QWidget, QDialogButtonBox, QAbstractButton, QTreeWidgetItem, \
17 QDialog, QVBoxLayout 17 QDialog, QVBoxLayout
18 from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply 18 from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply
19
20 from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog
21
22 from E5Gui import E5MessageBox
23 from E5Gui.E5MainWindow import E5MainWindow
24 from E5Gui.E5Application import e5App
25
26 from E5XML.PluginRepositoryReader import PluginRepositoryReader
27
28 from E5Network.E5NetworkProxyFactory import proxyAuthenticationRequired
19 try: 29 try:
20 from PyQt4.QtNetwork import QSslError # __IGNORE_EXCEPTION__ __IGNORE_WARNING__ 30 from E5Network.E5SslErrorHandler import E5SslErrorHandler
21 SSL_AVAILABLE = True 31 SSL_AVAILABLE = True
22 except ImportError: 32 except ImportError:
23 SSL_AVAILABLE = False 33 SSL_AVAILABLE = False
24
25 from .Ui_PluginRepositoryDialog import Ui_PluginRepositoryDialog
26
27 from E5Gui import E5MessageBox
28 from E5Gui.E5MainWindow import E5MainWindow
29 from E5Gui.E5Application import e5App
30
31 from E5XML.PluginRepositoryReader import PluginRepositoryReader
32
33 from E5Network.E5NetworkProxyFactory import proxyAuthenticationRequired
34 34
35 import Utilities 35 import Utilities
36 import Preferences 36 import Preferences
37 37
38 import UI.PixmapCache 38 import UI.PixmapCache
92 # attributes for the network objects 92 # attributes for the network objects
93 self.__networkManager = QNetworkAccessManager(self) 93 self.__networkManager = QNetworkAccessManager(self)
94 self.__networkManager.proxyAuthenticationRequired.connect( 94 self.__networkManager.proxyAuthenticationRequired.connect(
95 proxyAuthenticationRequired) 95 proxyAuthenticationRequired)
96 if SSL_AVAILABLE: 96 if SSL_AVAILABLE:
97 self.__sslErrorHandler = E5SslErrorHandler(self)
97 self.__networkManager.sslErrors.connect(self.__sslErrors) 98 self.__networkManager.sslErrors.connect(self.__sslErrors)
98 self.__replies = [] 99 self.__replies = []
99 100
100 self.__doneMethod = None 101 self.__doneMethod = None
101 self.__inDownload = False 102 self.__inDownload = False
502 Private slot to handle SSL errors. 503 Private slot to handle SSL errors.
503 504
504 @param reply reference to the reply object (QNetworkReply) 505 @param reply reference to the reply object (QNetworkReply)
505 @param errors list of SSL errors (list of QSslError) 506 @param errors list of SSL errors (list of QSslError)
506 """ 507 """
507 errorStrings = [] 508 ignore = self.__sslErrorHandler.sslErrorsReply(reply, errors)[0]
508 if errors: 509 if not ignore:
509 for err in errors:
510 errorStrings.append(err.errorString())
511 errorString = '.<br />'.join(errorStrings)
512 ret = E5MessageBox.yesNo(self,
513 self.trUtf8("SSL Errors"),
514 self.trUtf8("""<p>SSL Errors:</p>"""
515 """<p>{0}</p>"""
516 """<p>Do you want to ignore these errors?</p>""")\
517 .format(errorString),
518 icon=E5MessageBox.Warning)
519 else:
520 ret = True
521 if ret:
522 reply.ignoreSslErrors()
523 else:
524 self.__downloadCancelled = True 510 self.__downloadCancelled = True
525 reply.abort()
526 511
527 def getDownloadedPlugins(self): 512 def getDownloadedPlugins(self):
528 """ 513 """
529 Public method to get the list of recently downloaded plugin files. 514 Public method to get the list of recently downloaded plugin files.
530 515

eric ide

mercurial