Sun, 16 May 2010 18:21:41 +0200
Some changes to the eric web browser.
--- a/APIs/Python3/eric5.api Sat May 15 16:13:24 2010 +0200 +++ b/APIs/Python3/eric5.api Sun May 16 18:21:41 2010 +0200 @@ -1885,6 +1885,7 @@ eric5.Helpviewer.CookieJar.CookiesExceptionsDialog.CookiesExceptionsDialog?1(cookieJar, parent = None) eric5.Helpviewer.DownloadDialog.DownloadDialog.closeEvent?4(evt) eric5.Helpviewer.DownloadDialog.DownloadDialog.done?7 +eric5.Helpviewer.DownloadDialog.DownloadDialog.initialize?4() eric5.Helpviewer.DownloadDialog.DownloadDialog.on_buttonBox_clicked?4(button) eric5.Helpviewer.DownloadDialog.DownloadDialog?1(reply = None, requestFilename = False, webPage = None, download = False, parent = None) eric5.Helpviewer.HTMLResources.notFoundPage_html?7 @@ -1992,7 +1993,7 @@ eric5.Helpviewer.HelpWindow.HelpWindow.passwordManager?4() eric5.Helpviewer.HelpWindow.HelpWindow.preferencesChanged?4() eric5.Helpviewer.HelpWindow.HelpWindow.progressBar?4() -eric5.Helpviewer.HelpWindow.HelpWindow.resetLoading?4(widget) +eric5.Helpviewer.HelpWindow.HelpWindow.resetLoading?4(widget, ok) eric5.Helpviewer.HelpWindow.HelpWindow.search?4(word) eric5.Helpviewer.HelpWindow.HelpWindow.searchEnginesAction?4() eric5.Helpviewer.HelpWindow.HelpWindow.setLoading?4(widget)
--- a/Documentation/Help/source.qhp Sat May 15 16:13:24 2010 +0200 +++ b/Documentation/Help/source.qhp Sun May 16 18:21:41 2010 +0200 @@ -2817,7 +2817,6 @@ <keyword name="HelpWindow.__openFileNewTab" id="HelpWindow.__openFileNewTab" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__openFileNewTab" /> <keyword name="HelpWindow.__openUrl" id="HelpWindow.__openUrl" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__openUrl" /> <keyword name="HelpWindow.__openUrlNewTab" id="HelpWindow.__openUrlNewTab" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__openUrlNewTab" /> - <keyword name="HelpWindow.__pathEdited" id="HelpWindow.__pathEdited" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__pathEdited" /> <keyword name="HelpWindow.__pathSelected" id="HelpWindow.__pathSelected" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__pathSelected" /> <keyword name="HelpWindow.__prevTab" id="HelpWindow.__prevTab" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__prevTab" /> <keyword name="HelpWindow.__printFile" id="HelpWindow.__printFile" ref="eric5.Helpviewer.HelpWindow.html#HelpWindow.__printFile" /> @@ -2936,7 +2935,6 @@ <keyword name="DownloadDialog.__downloading" id="DownloadDialog.__downloading" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.__downloading" /> <keyword name="DownloadDialog.__finished" id="DownloadDialog.__finished" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.__finished" /> <keyword name="DownloadDialog.__getFileName" id="DownloadDialog.__getFileName" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.__getFileName" /> - <keyword name="DownloadDialog.__initialize" id="DownloadDialog.__initialize" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.__initialize" /> <keyword name="DownloadDialog.__metaDataChanged" id="DownloadDialog.__metaDataChanged" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.__metaDataChanged" /> <keyword name="DownloadDialog.__networkError" id="DownloadDialog.__networkError" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.__networkError" /> <keyword name="DownloadDialog.__open" id="DownloadDialog.__open" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.__open" /> @@ -2946,6 +2944,7 @@ <keyword name="DownloadDialog.__tryAgain" id="DownloadDialog.__tryAgain" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.__tryAgain" /> <keyword name="DownloadDialog.__updateInfoLabel" id="DownloadDialog.__updateInfoLabel" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.__updateInfoLabel" /> <keyword name="DownloadDialog.closeEvent" id="DownloadDialog.closeEvent" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.closeEvent" /> + <keyword name="DownloadDialog.initialize" id="DownloadDialog.initialize" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.initialize" /> <keyword name="DownloadDialog.on_buttonBox_clicked" id="DownloadDialog.on_buttonBox_clicked" ref="eric5.Helpviewer.DownloadDialog.html#DownloadDialog.on_buttonBox_clicked" /> <keyword name="HelpSearchWidget (Module)" id="HelpSearchWidget (Module)" ref="eric5.Helpviewer.HelpSearchWidget.html" /> <keyword name="HelpSearchWidget" id="HelpSearchWidget" ref="eric5.Helpviewer.HelpSearchWidget.html#HelpSearchWidget" />
--- a/Documentation/Source/eric5.Helpviewer.DownloadDialog.html Sat May 15 16:13:24 2010 +0200 +++ b/Documentation/Source/eric5.Helpviewer.DownloadDialog.html Sun May 16 18:21:41 2010 +0200 @@ -78,9 +78,6 @@ <td><a href="#DownloadDialog.__getFileName">__getFileName</a></td> <td>Private method to get the filename to save to from the user.</td> </tr><tr> -<td><a href="#DownloadDialog.__initialize">__initialize</a></td> -<td>Private method to (re)initialize the dialog.</td> -</tr><tr> <td><a href="#DownloadDialog.__metaDataChanged">__metaDataChanged</a></td> <td>Private slot to handle a change of the meta data.</td> </tr><tr> @@ -108,6 +105,9 @@ <td><a href="#DownloadDialog.closeEvent">closeEvent</a></td> <td>Protected method called when the dialog is closed.</td> </tr><tr> +<td><a href="#DownloadDialog.initialize">initialize</a></td> +<td>Public method to (re)initialize the dialog.</td> +</tr><tr> <td><a href="#DownloadDialog.on_buttonBox_clicked">on_buttonBox_clicked</a></td> <td>Private slot called by a button of the button box clicked.</td> </tr> @@ -183,12 +183,12 @@ <b>__getFileName</b>(<i></i>) <p> Private method to get the filename to save to from the user. -</p><a NAME="DownloadDialog.__initialize" ID="DownloadDialog.__initialize"></a> -<h4>DownloadDialog.__initialize</h4> -<b>__initialize</b>(<i></i>) -<p> - Private method to (re)initialize the dialog. -</p><a NAME="DownloadDialog.__metaDataChanged" ID="DownloadDialog.__metaDataChanged"></a> +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating success (boolean) +</dd> +</dl><a NAME="DownloadDialog.__metaDataChanged" ID="DownloadDialog.__metaDataChanged"></a> <h4>DownloadDialog.__metaDataChanged</h4> <b>__metaDataChanged</b>(<i></i>) <p> @@ -243,7 +243,17 @@ <b>closeEvent</b>(<i>evt</i>) <p> Protected method called when the dialog is closed. -</p><a NAME="DownloadDialog.on_buttonBox_clicked" ID="DownloadDialog.on_buttonBox_clicked"></a> +</p><a NAME="DownloadDialog.initialize" ID="DownloadDialog.initialize"></a> +<h4>DownloadDialog.initialize</h4> +<b>initialize</b>(<i></i>) +<p> + Public method to (re)initialize the dialog. +</p><dl> +<dt>Returns:</dt> +<dd> +flag indicating success (boolean) +</dd> +</dl><a NAME="DownloadDialog.on_buttonBox_clicked" ID="DownloadDialog.on_buttonBox_clicked"></a> <h4>DownloadDialog.on_buttonBox_clicked</h4> <b>on_buttonBox_clicked</b>(<i>button</i>) <p>
--- a/Documentation/Source/eric5.Helpviewer.HelpWindow.html Sat May 15 16:13:24 2010 +0200 +++ b/Documentation/Source/eric5.Helpviewer.HelpWindow.html Sun May 16 18:21:41 2010 +0200 @@ -211,9 +211,6 @@ <td><a href="#HelpWindow.__openUrlNewTab">__openUrlNewTab</a></td> <td>Private slot to load a URL from the bookmarks menu or bookmarks toolbar in a new tab.</td> </tr><tr> -<td><a href="#HelpWindow.__pathEdited">__pathEdited</a></td> -<td>Private slot called, when a URL has been entered.</td> -</tr><tr> <td><a href="#HelpWindow.__pathSelected">__pathSelected</a></td> <td>Private slot called when a file is selected in the combobox.</td> </tr><tr> @@ -830,12 +827,7 @@ <dd> title of the bookmark (string) </dd> -</dl><a NAME="HelpWindow.__pathEdited" ID="HelpWindow.__pathEdited"></a> -<h4>HelpWindow.__pathEdited</h4> -<b>__pathEdited</b>(<i></i>) -<p> - Private slot called, when a URL has been entered. -</p><a NAME="HelpWindow.__pathSelected" ID="HelpWindow.__pathSelected"></a> +</dl><a NAME="HelpWindow.__pathSelected" ID="HelpWindow.__pathSelected"></a> <h4>HelpWindow.__pathSelected</h4> <b>__pathSelected</b>(<i>path</i>) <p> @@ -1387,13 +1379,16 @@ </dd> </dl><a NAME="HelpWindow.resetLoading" ID="HelpWindow.resetLoading"></a> <h4>HelpWindow.resetLoading</h4> -<b>resetLoading</b>(<i>widget</i>) +<b>resetLoading</b>(<i>widget, ok</i>) <p> Public method to reset the loading icon. </p><dl> <dt><i>widget</i></dt> <dd> reference to the widget to reset the icon for (QWidget) +</dd><dt><i>ok</i></dt> +<dd> +flag indicating the result (boolean) </dd> </dl><a NAME="HelpWindow.search" ID="HelpWindow.search"></a> <h4>HelpWindow.search</h4>
--- a/Helpviewer/DownloadDialog.py Sat May 15 16:13:24 2010 +0200 +++ b/Helpviewer/DownloadDialog.py Sun May 16 18:21:41 2010 +0200 @@ -67,12 +67,12 @@ self.__bytesReceived = 0 self.__downloadTime = QTime() self.__output = QFile() + + def initialize(self): + """ + Public method to (re)initialize the dialog. - self.__initialize() - - def __initialize(self): - """ - Private method to (re)initialize the dialog. + @return flag indicating success (boolean) """ if self.__reply is None: return @@ -94,7 +94,8 @@ # reset info self.infoLabel.clear() self.progressBar.setValue(0) - self.__getFileName() + if not self.__getFileName(): + return False # start timer for the download estimation self.__downloadTime.start() @@ -102,10 +103,15 @@ if self.__reply.error() != QNetworkReply.NoError: self.__networkError() self.__finished() + return False + + return True def __getFileName(self): """ Private method to get the filename to save to from the user. + + @return flag indicating success (boolean) """ downloadDirectory = Preferences.getUI("DownloadPath") if not downloadDirectory: @@ -130,7 +136,7 @@ if res == QMessageBox.Cancel: self.__stop() self.close() - return + return False self.__autoOpen = res == QMessageBox.Open fileName = QDesktopServices.storageLocation(QDesktopServices.TempLocation) + \ @@ -146,16 +152,19 @@ self.__reply.close() if not self.keepOpenCheckBox.isChecked(): self.close() + return False else: self.filenameLabel.setText(self.trUtf8("Download canceled: {0}")\ .format(QFileInfo(defaultFileName).fileName())) self.__stop() - return + return True self.__output.setFileName(fileName) self.filenameLabel.setText(QFileInfo(self.__output.fileName()).fileName()) if self.__requestFilename: self.__readyRead() + + return True def __saveFileName(self, directory): """ @@ -244,7 +253,7 @@ if self.__output.exists(): self.__output.remove() self.__reply = reply - self.__initialize() + self.initialize() def __readyRead(self): """ @@ -297,7 +306,7 @@ self.__url = locationHeader self.__reply = Helpviewer.HelpWindow.HelpWindow.networkAccessManager().get( QNetworkRequest(self.__url)) - self.__initialize() + self.initialize() def __downloadProgress(self, received, total): """ @@ -375,12 +384,12 @@ if size < 1024: unit = self.trUtf8("bytes") elif size < 1024 * 1024: - size //= 1024 + size /= 1024 unit = self.trUtf8("kB") else: - size //= 1024 * 1024 + size /= 1024 * 1024 unit = self.trUtf8("MB") - return "{0} {1}".format(size, unit) + return "{0:.1f} {1}".format(size, unit) def __downloading(self): """ @@ -416,4 +425,16 @@ Protected method called when the dialog is closed. """ self.__output.close() + + self.disconnect(self.__reply, SIGNAL("readyRead()"), self.__readyRead) + self.disconnect(self.__reply, SIGNAL("error(QNetworkReply::NetworkError)"), + self.__networkError) + self.disconnect(self.__reply, SIGNAL("downloadProgress(qint64, qint64)"), + self.__downloadProgress) + self.disconnect(self.__reply, SIGNAL("metaDataChanged()"), + self.__metaDataChanged) + self.disconnect(self.__reply, SIGNAL("finished()"), self.__finished) + self.__reply.close() + self.__reply.deleteLater() + self.done.emit()
--- a/Helpviewer/HTMLResources.py Sat May 15 16:13:24 2010 +0200 +++ b/Helpviewer/HTMLResources.py Sun May 16 18:21:41 2010 +0200 @@ -12,45 +12,45 @@ <head> <title>{0}</title> <style> -body { +body {{ padding: 3em 0em; background: #eeeeee; -} -hr { +}} +hr {{ color: lightgray; width: 100%; -} -img { +}} +img {{ float: left; opacity: .8; -} -#box { +}} +#box {{ background: white; border: 1px solid lightgray; width: 600px; padding: 60px; margin: auto; -} -h1 { +}} +h1 {{ font-size: 130%; font-weight: bold; border-bottom: 1px solid lightgray; margin-left: 48px; -} -h2 { +}} +h2 {{ font-size: 100%; font-weight: normal; border-bottom: 1px solid lightgray; margin-left: 48px; -} -ul { - font-size: 80%; +}} +ul {{ + font-size: 100%; padding-left: 48px; margin: 5px 0; -} -#reloadButton { +}} +#reloadButton {{ padding-left: 48px; -} +}} </style> </head> <body>
--- a/Helpviewer/HelpBrowserWV.py Sat May 15 16:13:24 2010 +0200 +++ b/Helpviewer/HelpBrowserWV.py Sun May 16 18:21:41 2010 +0200 @@ -817,11 +817,12 @@ """ self.__isLoading = False self.mw.progressBar().hide() - self.mw.resetLoading(self) + self.mw.resetLoading(self, ok) self.__iconChanged() - self.mw.passwordManager().fill(self.page()) + if ok: + self.mw.passwordManager().fill(self.page()) def isLoading(self): """ @@ -864,17 +865,17 @@ if reply.error() == QNetworkReply.NoError: if reply.url().isEmpty(): return - header = reply.header(QNetworkRequest.ContentLengthHeader) - size = header + size = reply.header(QNetworkRequest.ContentLengthHeader) if size == 0: return if requestFilename is None: requestFilename = Preferences.getUI("RequestDownloadFilename") dlg = DownloadDialog(reply, requestFilename, self.page(), download) - self.connect(dlg, SIGNAL("done()"), self.__downloadDone) - self.__downloadWindows.append(dlg) - dlg.show() + if dlg.initialize(): + self.connect(dlg, SIGNAL("done()"), self.__downloadDone) + self.__downloadWindows.append(dlg) + dlg.show() else: replyUrl = reply.url() if replyUrl.isEmpty(): @@ -914,7 +915,6 @@ dlg = self.sender() if dlg in self.__downloadWindows: self.disconnect(dlg, SIGNAL("done()"), self.__downloadDone) - self.__downloadWindows.remove(dlg) def __downloadRequested(self, request): """
--- a/Helpviewer/HelpWindow.py Sat May 15 16:13:24 2010 +0200 +++ b/Helpviewer/HelpWindow.py Sun May 16 18:21:41 2010 +0200 @@ -1291,8 +1291,6 @@ self.pathCombo.setAutoCompletion(True) self.connect(self.pathCombo, SIGNAL('activated(const QString&)'), self.__pathSelected) - self.connect(self.pathCombo.lineEdit(), SIGNAL('returnPressed()'), - self.__pathEdited) self.pathCombo.setWhatsThis(self.trUtf8( """<p>Enter the help file to be displayed directly into this""" """ edit field. Select a previously shown help file from the""" @@ -1408,13 +1406,6 @@ idx += 1 act.setIcon(HelpWindow.__getWebIcon(QUrl(hist))) - def __pathEdited(self): - """ - Private slot called, when a URL has been entered. - """ - path = self.pathCombo.currentText() - self.__pathSelected(path) - def __pathSelected(self, path): """ Private slot called when a file is selected in the combobox. @@ -2225,16 +2216,20 @@ self.__setLoadingActions(True) - def resetLoading(self, widget): + def resetLoading(self, widget, ok): """ Public method to reset the loading icon. @param widget reference to the widget to reset the icon for (QWidget) + @param ok flag indicating the result (boolean) """ index = self.tabWidget.indexOf(widget) self.tabWidget.resetAnimation(index) self.tabWidget.setTabIcon(index, widget.icon()) - self.statusBar().showMessage(self.trUtf8("Finished loading")) + if ok: + self.statusBar().showMessage(self.trUtf8("Finished loading")) + else: + self.statusBar().showMessage(self.trUtf8("Failed to load")) self.__setLoadingActions(False)
--- a/Helpviewer/Network/NetworkAccessManagerProxy.py Sat May 15 16:13:24 2010 +0200 +++ b/Helpviewer/Network/NetworkAccessManagerProxy.py Sun May 16 18:21:41 2010 +0200 @@ -8,7 +8,7 @@ """ from PyQt4.QtCore import SIGNAL -from PyQt4.QtNetwork import QNetworkAccessManager +from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest class NetworkAccessManagerProxy(QNetworkAccessManager): """ @@ -75,8 +75,8 @@ """ if self.primaryManager is not None and \ self.__webPage is not None: - pageRequest = request + pageRequest = QNetworkRequest(request) self.__webPage.populateNetworkRequest(pageRequest) - return self.primaryManager.createRequest(op, request, outgoingData) - - return QNetworkAccessManager.createRequest(self, op, request, outgoingData) + return self.primaryManager.createRequest(op, pageRequest, outgoingData) + else: + return QNetworkAccessManager.createRequest(self, op, request, outgoingData)