6 """ |
6 """ |
7 Module implementing the URL bar widget. |
7 Module implementing the URL bar widget. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime, qVersion |
10 from PyQt4.QtCore import pyqtSlot, Qt, QPointF, QUrl, QDateTime, qVersion |
11 from PyQt4.QtGui import QColor, QPalette, QLinearGradient, QIcon, QDialog |
11 from PyQt4.QtGui import QColor, QPalette, QLinearGradient, QIcon, QDialog, QApplication |
12 try: |
12 try: |
13 from PyQt4.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__ |
13 from PyQt4.QtNetwork import QSslCertificate # __IGNORE_EXCEPTION__ |
14 except ImportError: |
14 except ImportError: |
15 QSslCertificate = None # __IGNORE_WARNING__ |
15 QSslCertificate = None # __IGNORE_WARNING__ |
16 from PyQt4.QtWebKit import QWebSettings, QWebPage |
16 from PyQt4.QtWebKit import QWebSettings, QWebPage |
17 |
17 |
18 from E5Gui.E5LineEdit import E5LineEdit |
18 from E5Gui.E5LineEdit import E5LineEdit |
19 from E5Gui.E5LineEditButton import E5LineEditButton |
19 from E5Gui.E5LineEditButton import E5LineEditButton |
20 from E5Gui.E5Application import E5Application |
|
21 |
20 |
22 import Helpviewer.HelpWindow |
21 import Helpviewer.HelpWindow |
23 |
22 |
24 from .FavIconLabel import FavIconLabel |
23 from .FavIconLabel import FavIconLabel |
25 from .SslLabel import SslLabel |
24 from .SslLabel import SslLabel |
276 """ |
275 """ |
277 if self.__privateMode: |
276 if self.__privateMode: |
278 backgroundColor = QColor(220, 220, 220) # light gray |
277 backgroundColor = QColor(220, 220, 220) # light gray |
279 foregroundColor = Qt.black |
278 foregroundColor = Qt.black |
280 else: |
279 else: |
281 backgroundColor = E5Application.palette().color(QPalette.Base) |
280 backgroundColor = QApplication.palette().color(QPalette.Base) |
282 foregroundColor = E5Application.palette().color(QPalette.Text) |
281 foregroundColor = QApplication.palette().color(QPalette.Text) |
283 |
282 |
284 if self.__browser is not None: |
283 if self.__browser is not None: |
285 p = self.palette() |
284 p = self.palette() |
286 progress = self.__browser.progress() |
285 progress = self.__browser.progress() |
287 if progress == 0 or progress == 100: |
286 if progress == 0 or progress == 100: |
298 if QSslCertificate is not None: |
297 if QSslCertificate is not None: |
299 if self.__browser.page().hasValidSslInfo(): |
298 if self.__browser.page().hasValidSslInfo(): |
300 backgroundColor = Preferences.getHelp("SaveUrlColor") |
299 backgroundColor = Preferences.getHelp("SaveUrlColor") |
301 else: |
300 else: |
302 backgroundColor = Preferences.getHelp("SaveUrlColor") |
301 backgroundColor = Preferences.getHelp("SaveUrlColor") |
303 highlight = E5Application.palette().color(QPalette.Highlight) |
302 highlight = QApplication.palette().color(QPalette.Highlight) |
304 r = (highlight.red() + 2 * backgroundColor.red()) // 3 |
303 r = (highlight.red() + 2 * backgroundColor.red()) // 3 |
305 g = (highlight.green() + 2 * backgroundColor.green()) // 3 |
304 g = (highlight.green() + 2 * backgroundColor.green()) // 3 |
306 b = (highlight.blue() + 2 * backgroundColor.blue()) // 3 |
305 b = (highlight.blue() + 2 * backgroundColor.blue()) // 3 |
307 |
306 |
308 loadingColor = QColor(r, g, b) |
307 loadingColor = QColor(r, g, b) |