shethjenil
commited on
Commit
•
eee727d
1
Parent(s):
980feb9
Upload 2 files
Browse files- .gitattributes +1 -0
- BROWSER.exe +3 -0
- BROWSER.py +88 -0
.gitattributes
CHANGED
@@ -46,3 +46,4 @@ AIMAGE.exe filter=lfs diff=lfs merge=lfs -text
|
|
46 |
YTSEARCH.exe filter=lfs diff=lfs merge=lfs -text
|
47 |
ProgInject.exe filter=lfs diff=lfs merge=lfs -text
|
48 |
HandWriteMachine.exe filter=lfs diff=lfs merge=lfs -text
|
|
|
|
46 |
YTSEARCH.exe filter=lfs diff=lfs merge=lfs -text
|
47 |
ProgInject.exe filter=lfs diff=lfs merge=lfs -text
|
48 |
HandWriteMachine.exe filter=lfs diff=lfs merge=lfs -text
|
49 |
+
BROWSER.exe filter=lfs diff=lfs merge=lfs -text
|
BROWSER.exe
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7110b997db8ace4b68a26b7961a4eb401fa1ae68d95e90306f723155f08bb43e
|
3 |
+
size 111546181
|
BROWSER.py
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# importing required libraries
|
2 |
+
from PyQt5.QtCore import *
|
3 |
+
from PyQt5.QtWidgets import *
|
4 |
+
from PyQt5.QtGui import *
|
5 |
+
from PyQt5.QtWebEngineWidgets import *
|
6 |
+
from PyQt5.QtPrintSupport import *
|
7 |
+
import sys
|
8 |
+
class MainWindow(QMainWindow):
|
9 |
+
def __init__(self, *args, **kwargs):
|
10 |
+
super(MainWindow, self).__init__(*args, **kwargs)
|
11 |
+
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
|
12 |
+
profile = QWebEngineProfile.defaultProfile()
|
13 |
+
profile.setHttpUserAgent(user_agent)
|
14 |
+
self.browser = QWebEngineView()
|
15 |
+
self.browser.setUrl(QUrl("http://google.com"))
|
16 |
+
self.browser.urlChanged.connect(self.update_urlbar)
|
17 |
+
self.browser.loadFinished.connect(self.update_title)
|
18 |
+
self.setCentralWidget(self.browser)
|
19 |
+
self.status = QStatusBar()
|
20 |
+
self.setStatusBar(self.status)
|
21 |
+
navtb = QToolBar("Navigation")
|
22 |
+
self.addToolBar(navtb)
|
23 |
+
back_btn = QAction("Back", self)
|
24 |
+
back_btn.setStatusTip("Back to previous page")
|
25 |
+
back_btn.triggered.connect(self.browser.back)
|
26 |
+
navtb.addAction(back_btn)
|
27 |
+
next_btn = QAction("Forward", self)
|
28 |
+
next_btn.setStatusTip("Forward to next page")
|
29 |
+
next_btn.triggered.connect(self.browser.forward)
|
30 |
+
navtb.addAction(next_btn)
|
31 |
+
reload_btn = QAction("Reload", self)
|
32 |
+
reload_btn.setStatusTip("Reload page")
|
33 |
+
reload_btn.triggered.connect(self.browser.reload)
|
34 |
+
navtb.addAction(reload_btn)
|
35 |
+
home_btn = QAction("Home", self)
|
36 |
+
home_btn.setStatusTip("Go home")
|
37 |
+
home_btn.triggered.connect(self.navigate_home)
|
38 |
+
navtb.addAction(home_btn)
|
39 |
+
navtb.addSeparator()
|
40 |
+
self.urlbar = QLineEdit()
|
41 |
+
self.urlbar.returnPressed.connect(self.navigate_to_url)
|
42 |
+
navtb.addWidget(self.urlbar)
|
43 |
+
stop_btn = QAction("Stop", self)
|
44 |
+
stop_btn.setStatusTip("Stop loading current page")
|
45 |
+
stop_btn.triggered.connect(self.browser.stop)
|
46 |
+
navtb.addAction(stop_btn)
|
47 |
+
exec_js_btn = QAction("Execute JavaScript", self)
|
48 |
+
exec_js_btn.setStatusTip("Execute JavaScript in current page")
|
49 |
+
exec_js_btn.triggered.connect(self.execute_javascript)
|
50 |
+
navtb.addAction(exec_js_btn)
|
51 |
+
self.js_editor = QPlainTextEdit()
|
52 |
+
self.js_editor.setPlaceholderText("Enter JavaScript code here...")
|
53 |
+
self.js_editor.setMaximumHeight(100) # Set maximum height for the editor
|
54 |
+
self.js_editor.setStyleSheet("font-family: Courier; font-size: 12px;") # Set font and size
|
55 |
+
self.js_editor.setTabStopWidth(20) # Set tab width
|
56 |
+
self.js_editor.setTabChangesFocus(True) # Pressing Tab moves focus to the next widget
|
57 |
+
self.js_editor.setWordWrapMode(QTextOption.NoWrap) # Disable word wrapping
|
58 |
+
self.js_editor.setLineWrapMode(QPlainTextEdit.NoWrap) # Disable line wrapping
|
59 |
+
self.js_editor.setPlainText("") # Set initial text
|
60 |
+
self.js_editor.setToolTip("Enter JavaScript code to execute") # Set tooltip
|
61 |
+
self.js_editor.setFocusPolicy(Qt.StrongFocus) # Set focus policy
|
62 |
+
self.js_editor.setFocus() # Set focus to the text editor
|
63 |
+
self.js_editor_cursor = self.js_editor.textCursor() # Get text cursor
|
64 |
+
navtb.addWidget(self.js_editor)
|
65 |
+
self.show()
|
66 |
+
def update_title(self):
|
67 |
+
title = self.browser.page().title()
|
68 |
+
self.setWindowTitle("% s - Geek Browser" % title)
|
69 |
+
def navigate_home(self):
|
70 |
+
self.browser.setUrl(QUrl("http://www.google.com"))
|
71 |
+
def navigate_to_url(self):
|
72 |
+
q = QUrl(self.urlbar.text())
|
73 |
+
if q.scheme() == "":
|
74 |
+
q.setScheme("http")
|
75 |
+
self.browser.setUrl(q)
|
76 |
+
def update_urlbar(self, q):
|
77 |
+
self.urlbar.setText(q.toString())
|
78 |
+
self.urlbar.setCursorPosition(0)
|
79 |
+
def execute_javascript(self):
|
80 |
+
javascript_code = self.js_editor.toPlainText()
|
81 |
+
if javascript_code.strip():
|
82 |
+
self.browser.page().runJavaScript(javascript_code)
|
83 |
+
else:
|
84 |
+
QMessageBox.warning(self, "Empty JavaScript Code", "Please enter JavaScript code to execute.")
|
85 |
+
app = QApplication(sys.argv)
|
86 |
+
app.setApplicationName("Geek Browser")
|
87 |
+
window = MainWindow()
|
88 |
+
app.exec_()
|