--- a/Helpviewer/UrlBar/UrlBar.py Tue Oct 15 22:03:54 2013 +0200 +++ b/Helpviewer/UrlBar/UrlBar.py Fri Oct 18 23:00:41 2013 +0200 @@ -14,7 +14,8 @@ pass from PyQt4.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime, qVersion -from PyQt4.QtGui import QColor, QPalette, QLinearGradient, QIcon, QDialog, QApplication +from PyQt4.QtGui import QColor, QPalette, QLinearGradient, QIcon, QDialog, \ + QApplication try: from PyQt4.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__ except ImportError: @@ -55,7 +56,8 @@ QWebSettings.PrivateBrowsingEnabled) self.__bmActiveIcon = UI.PixmapCache.getIcon("bookmark16.png") - self.__bmInactiveIcon = QIcon(self.__bmActiveIcon.pixmap(16, 16, QIcon.Disabled)) + self.__bmInactiveIcon = QIcon( + self.__bmActiveIcon.pixmap(16, 16, QIcon.Disabled)) self.__favicon = FavIconLabel(self) self.addWidget(self.__favicon, E5LineEdit.LeftSide) @@ -65,7 +67,8 @@ self.__sslLabel.setVisible(False) self.__privacyButton = E5LineEditButton(self) - self.__privacyButton.setIcon(UI.PixmapCache.getIcon("privateBrowsing.png")) + self.__privacyButton.setIcon( + UI.PixmapCache.getIcon("privateBrowsing.png")) self.addWidget(self.__privacyButton, E5LineEdit.RightSide) self.__privacyButton.setVisible(self.__privateMode) @@ -90,12 +93,12 @@ self.__mw.privacyChanged.connect(self.__privacyButton.setVisible) self.textChanged.connect(self.__textChanged) - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().entryChanged.connect( - self.__bookmarkChanged) - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().entryAdded.connect( - self.__bookmarkChanged) - Helpviewer.HelpWindow.HelpWindow.bookmarksManager().entryRemoved.connect( - self.__bookmarkChanged) + Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ + .entryChanged.connect(self.__bookmarkChanged) + Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ + .entryAdded.connect(self.__bookmarkChanged) + Helpviewer.HelpWindow.HelpWindow.bookmarksManager()\ + .entryRemoved.connect(self.__bookmarkChanged) Helpviewer.HelpWindow.HelpWindow.speedDial().pagesChanged.connect( self.__bookmarkChanged) @@ -117,7 +120,9 @@ def browser(self): """ - Public method to get the associated browser (HelpBrowser) + Public method to get the associated browser. + + @return reference to the associated browser (HelpBrowser) """ return self.__browser @@ -182,18 +187,20 @@ sslInfo = self.__browser.page().getSslCertificate() if sslInfo is not None: if qVersion() >= "5.0.0": - org = Utilities.decodeString( - ", ".join(sslInfo.subjectInfo(QSslCertificate.Organization))) + org = Utilities.decodeString(", ".join( + sslInfo.subjectInfo(QSslCertificate.Organization))) else: org = Utilities.decodeString( sslInfo.subjectInfo(QSslCertificate.Organization)) if org == "": if qVersion() >= "5.0.0": cn = Utilities.decodeString(", ".join( - sslInfo.subjectInfo(QSslCertificate.CommonName))) + sslInfo.subjectInfo( + QSslCertificate.CommonName))) else: cn = Utilities.decodeString( - sslInfo.subjectInfo(QSslCertificate.CommonName)) + sslInfo.subjectInfo( + QSslCertificate.CommonName)) if cn != "": org = cn.split(".", 1)[1] if org == "": @@ -248,7 +255,8 @@ """ Private slot to show a dialog with some bookmark info. """ - from .BookmarkActionSelectionDialog import BookmarkActionSelectionDialog + from .BookmarkActionSelectionDialog import \ + BookmarkActionSelectionDialog url = self.__browser.url() dlg = BookmarkActionSelectionDialog(url) if dlg.exec_() == QDialog.Accepted: @@ -294,7 +302,8 @@ if self.__browser.url().scheme() == "https": if QSslCertificate is not None: if self.__browser.page().hasValidSslInfo(): - backgroundColor = Preferences.getHelp("SaveUrlColor") + backgroundColor = Preferences.getHelp( + "SaveUrlColor") else: backgroundColor = Preferences.getHelp("SaveUrlColor") p.setBrush(QPalette.Base, backgroundColor) @@ -303,7 +312,8 @@ if self.__browser.url().scheme() == "https": if QSslCertificate is not None: if self.__browser.page().hasValidSslInfo(): - backgroundColor = Preferences.getHelp("SaveUrlColor") + backgroundColor = Preferences.getHelp( + "SaveUrlColor") else: backgroundColor = Preferences.getHelp("SaveUrlColor") highlight = QApplication.palette().color(QPalette.Highlight) @@ -312,14 +322,16 @@ b = (highlight.blue() + 2 * backgroundColor.blue()) // 3 loadingColor = QColor(r, g, b) - if abs(loadingColor.lightness() - backgroundColor.lightness()) < 20: + if abs(loadingColor.lightness() - + backgroundColor.lightness()) < 20: # special handling for special color schemes (e.g Gaia) r = (2 * highlight.red() + backgroundColor.red()) // 3 g = (2 * highlight.green() + backgroundColor.green()) // 3 b = (2 * highlight.blue() + backgroundColor.blue()) // 3 loadingColor = QColor(r, g, b) - gradient = QLinearGradient(QPointF(0, 0), QPointF(self.width(), 0)) + gradient = QLinearGradient( + QPointF(0, 0), QPointF(self.width(), 0)) gradient.setColorAt(0, loadingColor) gradient.setColorAt(progress / 100.0 - 0.000001, loadingColor) gradient.setColorAt(progress / 100.0, backgroundColor) @@ -370,7 +382,8 @@ @param evt reference to the key press event (QKeyEvent) """ if evt.key() == Qt.Key_Escape and self.__browser is not None: - self.setText(str(self.__browser.url().toEncoded(), encoding="utf-8")) + self.setText( + str(self.__browser.url().toEncoded(), encoding="utf-8")) self.selectAll() return @@ -380,8 +393,8 @@ append = "" if evt.modifiers() == Qt.KeyboardModifiers(Qt.ControlModifier): append = ".com" - elif evt.modifiers() == \ - Qt.KeyboardModifiers(Qt.ControlModifier | Qt.ShiftModifier): + elif evt.modifiers() == Qt.KeyboardModifiers( + Qt.ControlModifier | Qt.ShiftModifier): append = ".org" elif evt.modifiers() == Qt.KeyboardModifiers(Qt.ShiftModifier): append = ".net"