42 """ |
42 """ |
43 Class implementing a dialog showing the available plugins. |
43 Class implementing a dialog showing the available plugins. |
44 |
44 |
45 @signal closeAndInstall emitted when the Close & Install button is pressed |
45 @signal closeAndInstall emitted when the Close & Install button is pressed |
46 """ |
46 """ |
|
47 closeAndInstall = pyqtSignal() |
|
48 |
47 def __init__(self, parent = None): |
49 def __init__(self, parent = None): |
48 """ |
50 """ |
49 Constructor |
51 Constructor |
50 |
52 |
51 @param parent parent of this dialog (QWidget) |
53 @param parent parent of this dialog (QWidget) |
72 self.pluginRepositoryFile = \ |
74 self.pluginRepositoryFile = \ |
73 os.path.join(Utilities.getConfigDir(), "PluginRepository") |
75 os.path.join(Utilities.getConfigDir(), "PluginRepository") |
74 |
76 |
75 # attributes for the network objects |
77 # attributes for the network objects |
76 self.__networkManager = QNetworkAccessManager(self) |
78 self.__networkManager = QNetworkAccessManager(self) |
77 self.connect(self.__networkManager, |
79 self.__networkManager.proxyAuthenticationRequired.connect( |
78 SIGNAL('proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)'), |
|
79 proxyAuthenticationRequired) |
80 proxyAuthenticationRequired) |
80 self.connect(self.__networkManager, |
81 self.__networkManager.sslErrors.connect(self.__sslErrors) |
81 SIGNAL('sslErrors(QNetworkReply *, const QList<QSslError> &)'), |
|
82 self.__sslErrors) |
|
83 self.__replies = [] |
82 self.__replies = [] |
84 |
83 |
85 self.__doneMethod = None |
84 self.__doneMethod = None |
86 self.__inDownload = False |
85 self.__inDownload = False |
87 self.__pluginsToDownload = [] |
86 self.__pluginsToDownload = [] |
99 elif button == self.__downloadButton: |
98 elif button == self.__downloadButton: |
100 self.__downloadPlugins() |
99 self.__downloadPlugins() |
101 elif button == self.__downloadCancelButton: |
100 elif button == self.__downloadCancelButton: |
102 self.__downloadCancel() |
101 self.__downloadCancel() |
103 elif button == self.__installButton: |
102 elif button == self.__installButton: |
104 self.emit(SIGNAL("closeAndInstall")) |
103 self.closeAndInstall.emit() |
105 |
104 |
106 def __formatDescription(self, lines): |
105 def __formatDescription(self, lines): |
107 """ |
106 """ |
108 Private method to format the description. |
107 Private method to format the description. |
109 |
108 |
343 self.__downloadIODevice = QFile(self.__downloadFileName + ".tmp") |
342 self.__downloadIODevice = QFile(self.__downloadFileName + ".tmp") |
344 self.__downloadCancelled = False |
343 self.__downloadCancelled = False |
345 |
344 |
346 reply = self.__networkManager.get(QNetworkRequest(QUrl(url))) |
345 reply = self.__networkManager.get(QNetworkRequest(QUrl(url))) |
347 reply.finished[()].connect(self.__downloadFileDone) |
346 reply.finished[()].connect(self.__downloadFileDone) |
348 self.connect(reply, SIGNAL("downloadProgress(qint64, qint64)"), |
347 reply.downloadProgress.connect(self.__downloadProgress) |
349 self.__downloadProgress) |
|
350 self.__replies.append(reply) |
348 self.__replies.append(reply) |
351 |
349 |
352 def __downloadFileDone(self): |
350 def __downloadFileDone(self): |
353 """ |
351 """ |
354 Private method called, after the file has been downloaded |
352 Private method called, after the file has been downloaded |
545 self.__layout.addWidget(self.cw) |
543 self.__layout.addWidget(self.cw) |
546 self.resize(size) |
544 self.resize(size) |
547 |
545 |
548 self.cw.buttonBox.accepted[()].connect(self.accept) |
546 self.cw.buttonBox.accepted[()].connect(self.accept) |
549 self.cw.buttonBox.rejected[()].connect(self.reject) |
547 self.cw.buttonBox.rejected[()].connect(self.reject) |
550 self.connect(self.cw, SIGNAL("closeAndInstall"), self.__closeAndInstall) |
548 self.cw.closeAndInstall.connect(self.__closeAndInstall) |
551 |
549 |
552 def __closeAndInstall(self): |
550 def __closeAndInstall(self): |
553 """ |
551 """ |
554 Private slot to handle the closeAndInstall signal. |
552 Private slot to handle the closeAndInstall signal. |
555 """ |
553 """ |
579 self.setCentralWidget(self.cw) |
577 self.setCentralWidget(self.cw) |
580 self.resize(size) |
578 self.resize(size) |
581 |
579 |
582 self.cw.buttonBox.accepted[()].connect(self.close) |
580 self.cw.buttonBox.accepted[()].connect(self.close) |
583 self.cw.buttonBox.rejected[()].connect(self.close) |
581 self.cw.buttonBox.rejected[()].connect(self.close) |
584 self.connect(self.cw, SIGNAL("closeAndInstall"), self.__startPluginInstall) |
582 self.cw.closeAndInstall.connect(self.__startPluginInstall) |
585 |
583 |
586 def __startPluginInstall(self): |
584 def __startPluginInstall(self): |
587 """ |
585 """ |
588 Private slot to start the eric5 plugin installation dialog. |
586 Private slot to start the eric5 plugin installation dialog. |
589 """ |
587 """ |