-
Notifications
You must be signed in to change notification settings - Fork 0
/
browser.py
39 lines (29 loc) · 1.26 KB
/
browser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import sys
from PySide2.QtCore import Qt
from PySide2.QtWidgets import (QApplication,QMainWindow, QToolBar)
from PySide2.QtWebEngineWidgets import QWebEngineView
from toolbar import Browser_Toolbar
class MainWindow(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setWindowTitle("tutorial")
self._page = page()
self._page.resize(800,500)
self._page.load(self._page.initial_url)
self._page.loadStarted.connect(lambda :self.toolbar.url_box.setText(self._page.url().url()))
self.toolbar = Browser_Toolbar()
self.toolbar.url_box.returnPressed.connect(lambda :self._page.setUrl(self.toolbar.url_box.text()))
self.toolbar.reload.clicked.connect(lambda :self._page.reload())
self.toolbar.back.clicked.connect(lambda :self._page.back())
self.toolbar.next.clicked.connect(lambda :self._page.forward())
self.addToolBar(Qt.TopToolBarArea,self.toolbar)
self.setCentralWidget(self._page)
class page(QWebEngineView):
def __init__(self):
QWebEngineView.__init__(self)
self.initial_url = "https://www.rutilea.com/"
if __name__ == "__main__":
app = QApplication(sys.argv)
win = MainWindow()
win.show()
sys.exit(app.exec_())