eric6/WebBrowser/SiteInfo/SiteInfoWidget.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
41 layout = QGridLayout(self) 41 layout = QGridLayout(self)
42 rows = 0 42 rows = 0
43 43
44 titleLabel = QLabel(self) 44 titleLabel = QLabel(self)
45 titleLabel.setText(self.tr("<b>Site {0}</b>").format(url.host())) 45 titleLabel.setText(self.tr("<b>Site {0}</b>").format(url.host()))
46 layout.addWidget(titleLabel, rows, 0, 1, -1, Qt.AlignCenter) 46 layout.addWidget(titleLabel, rows, 0, 1, -1,
47 Qt.AlignmentFlag.AlignCenter)
47 rows += 1 48 rows += 1
48 49
49 line = QFrame(self) 50 line = QFrame(self)
50 line.setLineWidth(1) 51 line.setLineWidth(1)
51 line.setFrameStyle(QFrame.HLine | QFrame.Sunken) 52 line.setFrameStyle(QFrame.Shape.HLine | QFrame.Shadow.Sunken)
52 layout.addWidget(line, rows, 0, 1, -1) 53 layout.addWidget(line, rows, 0, 1, -1)
53 rows += 1 54 rows += 1
54 55
55 secureIcon = QLabel() 56 secureIcon = QLabel()
56 layout.addWidget(secureIcon, rows, 0, Qt.AlignCenter) 57 layout.addWidget(secureIcon, rows, 0, Qt.AlignmentFlag.AlignCenter)
57 secureLabel = QLabel() 58 secureLabel = QLabel()
58 secureLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) 59 secureLabel.setSizePolicy(QSizePolicy.Policy.Expanding,
60 QSizePolicy.Policy.Preferred)
59 layout.addWidget(secureLabel, rows, 1) 61 layout.addWidget(secureLabel, rows, 1)
60 if url.scheme() in ["https"]: 62 if url.scheme() in ["https"]:
61 if WebBrowserWindow.networkManager().isInsecureHost(url.host()): 63 if WebBrowserWindow.networkManager().isInsecureHost(url.host()):
62 secureLabel.setText( 64 secureLabel.setText(
63 self.tr("Your connection to this site " 65 self.tr("Your connection to this site "
77 rows += 1 79 rows += 1
78 80
79 visits = WebBrowserWindow.historyManager().siteVisitsCount( 81 visits = WebBrowserWindow.historyManager().siteVisitsCount(
80 url.scheme(), url.host()) 82 url.scheme(), url.host())
81 historyIcon = QLabel() 83 historyIcon = QLabel()
82 layout.addWidget(historyIcon, rows, 0, Qt.AlignCenter) 84 layout.addWidget(historyIcon, rows, 0, Qt.AlignmentFlag.AlignCenter)
83 historyLabel = QLabel() 85 historyLabel = QLabel()
84 historyLabel.setSizePolicy(QSizePolicy.Expanding, 86 historyLabel.setSizePolicy(QSizePolicy.Policy.Expanding,
85 QSizePolicy.Preferred) 87 QSizePolicy.Policy.Preferred)
86 layout.addWidget(historyLabel, rows, 1) 88 layout.addWidget(historyLabel, rows, 1)
87 if visits > 3: 89 if visits > 3:
88 historyLabel.setText( 90 historyLabel.setText(
89 self.tr("This is your <b>{0}.</b> visit of this site.") 91 self.tr("This is your <b>{0}.</b> visit of this site.")
90 .format(visits)) 92 .format(visits))
110 .format(visitStr)) 112 .format(visitStr))
111 rows += 1 113 rows += 1
112 114
113 line = QFrame(self) 115 line = QFrame(self)
114 line.setLineWidth(1) 116 line.setLineWidth(1)
115 line.setFrameStyle(QFrame.HLine | QFrame.Sunken) 117 line.setFrameStyle(QFrame.Shape.HLine | QFrame.Shadow.Sunken)
116 layout.addWidget(line, rows, 0, 1, -1) 118 layout.addWidget(line, rows, 0, 1, -1)
117 rows += 1 119 rows += 1
118 120
119 page = self.__browser.page() 121 page = self.__browser.page()
120 scheme = page.registerProtocolHandlerRequestScheme() 122 scheme = page.registerProtocolHandlerRequestScheme()
127 ): 129 ):
128 horizontalLayout = QHBoxLayout() 130 horizontalLayout = QHBoxLayout()
129 protocolHandlerLabel = QLabel( 131 protocolHandlerLabel = QLabel(
130 self.tr("Register as <b>{0}</b> links handler.") 132 self.tr("Register as <b>{0}</b> links handler.")
131 .format(scheme), self) 133 .format(scheme), self)
132 protocolHandlerLabel.setSizePolicy(QSizePolicy.Expanding, 134 protocolHandlerLabel.setSizePolicy(QSizePolicy.Policy.Expanding,
133 QSizePolicy.Preferred) 135 QSizePolicy.Policy.Preferred)
134 136
135 horizontalLayout.addWidget(protocolHandlerLabel) 137 horizontalLayout.addWidget(protocolHandlerLabel)
136 protocolHandlerButton = QPushButton(self.tr("Register"), self) 138 protocolHandlerButton = QPushButton(self.tr("Register"), self)
137 horizontalLayout.addWidget(protocolHandlerButton) 139 horizontalLayout.addWidget(protocolHandlerButton)
138 protocolHandlerButton.clicked.connect( 140 protocolHandlerButton.clicked.connect(
140 layout.addLayout(horizontalLayout, rows, 0, 1, -1) 142 layout.addLayout(horizontalLayout, rows, 0, 1, -1)
141 rows += 1 143 rows += 1
142 144
143 protocolHandlerLine = QFrame(self) 145 protocolHandlerLine = QFrame(self)
144 protocolHandlerLine.setLineWidth(1) 146 protocolHandlerLine.setLineWidth(1)
145 protocolHandlerLine.setFrameStyle(QFrame.HLine | QFrame.Sunken) 147 protocolHandlerLine.setFrameStyle(
148 QFrame.Shape.HLine | QFrame.Shadow.Sunken)
146 layout.addWidget(protocolHandlerLine, rows, 0, 1, -1) 149 layout.addWidget(protocolHandlerLine, rows, 0, 1, -1)
147 rows += 1 150 rows += 1
148 151
149 horizontalLayout = QHBoxLayout() 152 horizontalLayout = QHBoxLayout()
150 spacerItem = QSpacerItem( 153 spacerItem = QSpacerItem(
151 40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) 154 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
152 horizontalLayout.addItem(spacerItem) 155 horizontalLayout.addItem(spacerItem)
153 moreButton = QPushButton(self.tr("More..."), self) 156 moreButton = QPushButton(self.tr("More..."), self)
154 horizontalLayout.addWidget(moreButton) 157 horizontalLayout.addWidget(moreButton)
155 moreButton.clicked.connect(self.__showSiteInfo) 158 moreButton.clicked.connect(self.__showSiteInfo)
156 layout.addLayout(horizontalLayout, rows, 0, 1, -1) 159 layout.addLayout(horizontalLayout, rows, 0, 1, -1)

eric ide

mercurial