24 |
24 |
25 SSL = True |
25 SSL = True |
26 except ImportError: |
26 except ImportError: |
27 SSL = False |
27 SSL = False |
28 |
28 |
29 from EricWidgets import EricMessageBox, EricFileDialog |
29 from eric7.EricWidgets import EricMessageBox, EricFileDialog |
30 |
30 |
31 from .Ui_SiteInfoDialog import Ui_SiteInfoDialog |
31 from .Ui_SiteInfoDialog import Ui_SiteInfoDialog |
32 |
32 |
33 from ..Tools import Scripts, WebBrowserTools |
33 from ..Tools import Scripts, WebBrowserTools |
34 from ..WebBrowserPage import WebBrowserPage |
34 from ..WebBrowserPage import WebBrowserPage |
35 |
35 |
36 import UI.PixmapCache |
36 from eric7.EricGui import EricPixmapCache |
37 import Preferences |
37 from eric7 import Preferences |
38 |
38 |
39 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
39 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
40 |
40 |
41 |
41 |
42 class SiteInfoDialog(QDialog, Ui_SiteInfoDialog): |
42 class SiteInfoDialog(QDialog, Ui_SiteInfoDialog): |
43 """ |
43 """ |
44 Class implementing a dialog to show some information about a site. |
44 Class implementing a dialog to show some information about a site. |
56 super().__init__(parent) |
56 super().__init__(parent) |
57 self.setupUi(self) |
57 self.setupUi(self) |
58 self.setWindowFlags(Qt.WindowType.Window) |
58 self.setWindowFlags(Qt.WindowType.Window) |
59 |
59 |
60 # put icons |
60 # put icons |
61 self.tabWidget.setTabIcon(0, UI.PixmapCache.getIcon("siteinfo-general")) |
61 self.tabWidget.setTabIcon(0, EricPixmapCache.getIcon("siteinfo-general")) |
62 self.tabWidget.setTabIcon(1, UI.PixmapCache.getIcon("siteinfo-media")) |
62 self.tabWidget.setTabIcon(1, EricPixmapCache.getIcon("siteinfo-media")) |
63 if SSL: |
63 if SSL: |
64 self.tabWidget.setTabIcon(2, UI.PixmapCache.getIcon("siteinfo-security")) |
64 self.tabWidget.setTabIcon(2, EricPixmapCache.getIcon("siteinfo-security")) |
65 |
65 |
66 self.__imageReply = None |
66 self.__imageReply = None |
67 |
67 |
68 self.__baseUrl = browser.url() |
68 self.__baseUrl = browser.url() |
69 title = browser.title() |
69 title = browser.title() |
84 self.heading.setText("<b>{0}</b>".format(title)) |
84 self.heading.setText("<b>{0}</b>".format(title)) |
85 self.siteAddressLabel.setText(self.__baseUrl.toString()) |
85 self.siteAddressLabel.setText(self.__baseUrl.toString()) |
86 if self.__baseUrl.scheme() in ["https"]: |
86 if self.__baseUrl.scheme() in ["https"]: |
87 if WebBrowserWindow.networkManager().isInsecureHost(self.__baseUrl.host()): |
87 if WebBrowserWindow.networkManager().isInsecureHost(self.__baseUrl.host()): |
88 self.securityIconLabel.setPixmap( |
88 self.securityIconLabel.setPixmap( |
89 UI.PixmapCache.getPixmap("securityMedium") |
89 EricPixmapCache.getPixmap("securityMedium") |
90 ) |
90 ) |
91 self.securityLabel.setStyleSheet( |
91 self.securityLabel.setStyleSheet( |
92 SiteInfoDialog.securityStyleFormat.format( |
92 SiteInfoDialog.securityStyleFormat.format( |
93 Preferences.getWebBrowser("InsecureUrlColor").name() |
93 Preferences.getWebBrowser("InsecureUrlColor").name() |
94 ) |
94 ) |
96 self.securityLabel.setText( |
96 self.securityLabel.setText( |
97 self.tr("<b>Connection is encrypted but may be insecure.</b>") |
97 self.tr("<b>Connection is encrypted but may be insecure.</b>") |
98 ) |
98 ) |
99 else: |
99 else: |
100 self.securityIconLabel.setPixmap( |
100 self.securityIconLabel.setPixmap( |
101 UI.PixmapCache.getPixmap("securityHigh") |
101 EricPixmapCache.getPixmap("securityHigh") |
102 ) |
102 ) |
103 self.securityLabel.setStyleSheet( |
103 self.securityLabel.setStyleSheet( |
104 SiteInfoDialog.securityStyleFormat.format( |
104 SiteInfoDialog.securityStyleFormat.format( |
105 Preferences.getWebBrowser("SecureUrlColor").name() |
105 Preferences.getWebBrowser("SecureUrlColor").name() |
106 ) |
106 ) |
107 ) |
107 ) |
108 self.securityLabel.setText(self.tr("<b>Connection is encrypted.</b>")) |
108 self.securityLabel.setText(self.tr("<b>Connection is encrypted.</b>")) |
109 else: |
109 else: |
110 self.securityIconLabel.setPixmap(UI.PixmapCache.getPixmap("securityLow")) |
110 self.securityIconLabel.setPixmap(EricPixmapCache.getPixmap("securityLow")) |
111 self.securityLabel.setText(self.tr("<b>Connection is not encrypted.</b>")) |
111 self.securityLabel.setText(self.tr("<b>Connection is not encrypted.</b>")) |
112 browser.page().runJavaScript( |
112 browser.page().runJavaScript( |
113 "document.charset", |
113 "document.charset", |
114 WebBrowserPage.SafeJsWorld, |
114 WebBrowserPage.SafeJsWorld, |
115 lambda res: self.encodingLabel.setText(res), |
115 lambda res: self.encodingLabel.setText(res), |
228 else: |
228 else: |
229 if self.__imageReply is not None: |
229 if self.__imageReply is not None: |
230 self.__imageReply.deleteLater() |
230 self.__imageReply.deleteLater() |
231 self.__imageReply = None |
231 self.__imageReply = None |
232 |
232 |
233 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
233 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
234 |
234 |
235 self.__imageReply = WebBrowserWindow.networkManager().get( |
235 self.__imageReply = WebBrowserWindow.networkManager().get( |
236 QNetworkRequest(imageUrl) |
236 QNetworkRequest(imageUrl) |
237 ) |
237 ) |
238 self.__imageReply.finished.connect(self.__imageReplyFinished) |
238 self.__imageReply.finished.connect(self.__imageReplyFinished) |