VertexEngine-WebEngine 1.2.dev1__py3-none-any.whl → 1.2rc1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ from PyQt6.QtCore import QObject, pyqtSlot, pyqtSignal
2
+
3
+
4
+ class JSBridge(QObject):
5
+
6
+ sceneChanged = pyqtSignal(str)
7
+
8
+ def __init__(self, scene_manager):
9
+ super().__init__()
10
+ self.scene_manager = scene_manager
11
+
12
+ @pyqtSlot(str)
13
+ def loadScene(self, name):
14
+ print("🎮 JS Requested Scene:", name)
15
+
16
+ self.scene_manager.load_scene(name)
17
+ self.sceneChanged.emit(name)
@@ -0,0 +1,46 @@
1
+ from pathlib import Path
2
+
3
+
4
+ class SceneManager:
5
+ def __init__(self, webview):
6
+ self.webview = webview
7
+
8
+ # Folder where scenes live
9
+ self.scene_path = Path("scenes")
10
+
11
+ def load_scene(self, name: str):
12
+ file = self.scene_path / f"{name}.html"
13
+
14
+ if not file.exists():
15
+ print("❌ Scene not found:", file)
16
+ return
17
+
18
+ html = file.read_text(encoding="utf-8")
19
+
20
+ # Inject bridge + wrapper script
21
+ full_html = f"""
22
+ <!DOCTYPE html>
23
+ <html>
24
+ <head>
25
+ <script src="qrc:///qtwebchannel/qwebchannel.js"></script>
26
+ </head>
27
+
28
+ <body style="font-family: Arial; padding: 20px;">
29
+ <div id="scene">
30
+ {html}
31
+ </div>
32
+
33
+ <script>
34
+ let Vertex;
35
+
36
+ new QWebChannel(qt.webChannelTransport, function(channel) {{
37
+ Vertex = channel.objects.bridge;
38
+ console.log("✅ Vertex Bridge Ready!");
39
+ }});
40
+ </script>
41
+ </body>
42
+ </html>
43
+ """
44
+
45
+ print(f"🗺️ Loading Scene: {name}")
46
+ self.webview.setHtml(full_html)
@@ -0,0 +1,24 @@
1
+ from PyQt6.QtWebEngineWidgets import QWebEngineView
2
+ from PyQt6.QtWebChannel import QWebChannel
3
+
4
+ from VertexWebEngineCore.WebScene import SceneManager
5
+ from VertexWebEngineCore.JSBridge import JSBridge
6
+
7
+ class WebEngine(QWebEngineView):
8
+ def __init__(self):
9
+ super().__init__()
10
+
11
+ # Scene system
12
+ self.scene_manager = SceneManager(self)
13
+
14
+ # Bridge
15
+ self.bridge = JSBridge(self.scene_manager)
16
+
17
+ # Channel
18
+ self.channel = QWebChannel()
19
+ self.channel.registerObject("bridge", self.bridge)
20
+
21
+ self.page().setWebChannel(self.channel)
22
+
23
+ # Start on menu
24
+ self.scene_manager.load_scene("menu")
@@ -1,14 +1,19 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: VertexEngine-WebEngine
3
- Version: 1.2.dev1
3
+ Version: 1.2rc1
4
+ Summary: The offical WebEngine Extension of the VertexEngine SDK.
4
5
  Author-email: Tyrel Miguel <annbasilan0828@gmail.com>
5
6
  License: MIT
6
7
  Project-URL: Documentation, https://vertexenginedocs.netlify.app/
8
+ Project-URL: Homepage, https://github.com/TyrelGomez/VertexEngine-WebEngine-Code
7
9
  Requires-Python: >=3.10
8
10
  Description-Content-Type: text/markdown
11
+ License-File: LICENSE
9
12
  Requires-Dist: pygame>=2.0
10
13
  Requires-Dist: PyQt6>=6.7
11
14
  Requires-Dist: VertexEngine>=1.0.1
15
+ Requires-Dist: PyQt6-WebEngine>=6.3.0
16
+ Dynamic: license-file
12
17
 
13
18
  # VertexEngine/Vertex-WebEngine
14
19
  VertexEngine-WebEngine is a WebEngine built for the VertexEngine SDK. It's a seperate package.
@@ -17,7 +22,9 @@ VertexEngine-WebEngine is a WebEngine built for the VertexEngine SDK. It's a sep
17
22
  The documentation is in the following link:
18
23
  [Project Documentation](https://vertexenginedocs.netlify.app/) for help.
19
24
 
20
- ## Change Logs (1.1), NEW!
25
+ ## Change Logs (1.2rc1), NEW!
26
+ ### 1.2rc1
27
+ - FULL ENGINE REVAMP! Check Documentation for more details.
21
28
  ### Version 1.1
22
29
  - Added 1 New Library!
23
30
  ~ BrowserTools.Tabs
@@ -0,0 +1,8 @@
1
+ VertexEngine/VertexWebEngineCore/JSBridge.py,sha256=Pbd7NzaEyfMOvQMHBR99tysDVTKoUXHAn9-097_EzEI,426
2
+ VertexEngine/VertexWebEngineCore/WebScene.py,sha256=2G5KuyM5sO7A4GlMUkKHNXvM1clYPNTrFbNwILp8GwI,1223
3
+ VertexEngine/VertexWebEngineWidgets/EngineView.py,sha256=cUCRvYAtXI7p2v-1QMTksLHAfs5JZXcvF90avJ54TqE,685
4
+ vertexengine_webengine-1.2rc1.dist-info/licenses/LICENSE,sha256=dV2_I9Rq_DHkqouiT6TD2tsQVh9pgzlqFrkT8BuW2X8,1096
5
+ vertexengine_webengine-1.2rc1.dist-info/METADATA,sha256=9XJJFjYQk853OsFPW9r6ev4vINhUFhTtGuTkEnq_WDA,2485
6
+ vertexengine_webengine-1.2rc1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
7
+ vertexengine_webengine-1.2rc1.dist-info/top_level.txt,sha256=ONNMJUQViY7bNuEYPB2TaUwj7Jo1Is2yuBY4KOv19wM,13
8
+ vertexengine_webengine-1.2rc1.dist-info/RECORD,,
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tyrel Miguel Gomez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,80 +0,0 @@
1
- from PyQt6.QtWidgets import QTabWidget, QToolButton
2
- from PyQt6.QtCore import QUrl
3
- from PyQt6.QtGui import QKeySequence, QShortcut
4
- from PyQt6.QtCore import Qt
5
-
6
- from WebEngine.WebEngine import WebEngine
7
-
8
-
9
- class BrowserTabs(QTabWidget):
10
- def __init__(self, parent=None):
11
- super().__init__(parent)
12
-
13
- self.setTabsClosable(True)
14
- self.setMovable(True)
15
-
16
- self.tabCloseRequested.connect(self.close_tab)
17
- self.currentChanged.connect(self.on_tab_changed)
18
-
19
- # Keyboard shortcuts
20
- QShortcut(QKeySequence("Ctrl+T"), self).activated.connect(self.new_tab)
21
- QShortcut(QKeySequence("Ctrl+W"), self).activated.connect(self.close_current_tab)
22
- # ➕ New Tab button
23
- self.new_tab_btn = QToolButton(self)
24
- self.new_tab_btn.setText("+")
25
- self.new_tab_btn.setAutoRaise(True)
26
- self.new_tab_btn.setToolTip("New Tab")
27
-
28
- self.new_tab_btn.clicked.connect(self.new_tab)
29
-
30
- self.setCornerWidget(
31
- self.new_tab_btn,
32
- Qt.Corner.TopRightCorner
33
- )
34
-
35
- self.new_tab("https://www.google.com")
36
-
37
- # ➕ Create tab
38
- def new_tab(self, url=None):
39
- if not isinstance(url, str):
40
- url = "https://www.google.com"
41
-
42
- print("🆕 New tab:", url)
43
-
44
- engine = WebEngine()
45
- index = self.addTab(engine, "New Tab")
46
- self.setCurrentIndex(index)
47
-
48
- engine.load_url(url)
49
-
50
-
51
- # ❌ Close tab by index
52
- def close_tab(self, index):
53
- if self.count() <= 1:
54
- return
55
-
56
- widget = self.widget(index)
57
- self.removeTab(index)
58
- widget.deleteLater()
59
-
60
- # ❌ Close current tab
61
- def close_current_tab(self):
62
- self.close_tab(self.currentIndex())
63
-
64
- def safe_remove(self, index):
65
- if 0 <= index < self.count():
66
- self.removeTab(index)
67
-
68
- def update_tab_title(self, engine, title):
69
- index = self.indexOf(engine)
70
- if index != -1:
71
- self.setTabText(index, title[:24])
72
-
73
- # 🔀 Tab switch handler
74
- def on_tab_changed(self, index):
75
- engine = self.widget(index)
76
- if not engine:
77
- return
78
-
79
- url = engine.url().toString()
80
- print("🔀 Switched to tab:", url)
@@ -1,84 +0,0 @@
1
- from PyQt6.QtWebEngineWidgets import QWebEngineView
2
- from PyQt6.QtGui import QKeySequence, QShortcut
3
- from PyQt6.QtWebChannel import QWebChannel
4
- from PyQt6.QtCore import QUrl
5
- from WebView.profile import WebProfile
6
- from WebView.WebPage import WebPage
7
- from WebView.bridge import JSBridge
8
-
9
- class WebEngine(QWebEngineView):
10
- def __init__(self, parent=None):
11
- super().__init__(parent)
12
-
13
- self.profile = WebProfile(parent=self)
14
- self.webpage = WebPage(self.profile, self)
15
- self.setPage(self.webpage)
16
-
17
- # JS Bridge
18
- self.channel = QWebChannel()
19
- self.bridge = JSBridge(self.webpage)
20
- self.channel.registerObject("bridge", self.bridge)
21
- self.webpage.setWebChannel(self.channel)
22
-
23
- # DevTools
24
- self._devtools = None
25
- QShortcut(QKeySequence("Ctrl+Shift+I"), self).activated.connect(self.toggle_devtools)
26
-
27
- self.load_home()
28
-
29
- def toggle_devtools(self):
30
- if self._devtools is None:
31
- self._devtools = QWebEngineView()
32
- self.webpage.setDevToolsPage(self._devtools.page())
33
- self._devtools.resize(800, 600)
34
- self._devtools.show()
35
- else:
36
- self._devtools.close()
37
- self._devtools = None
38
-
39
- def load_home(self):
40
- html = """
41
- <!DOCTYPE html>
42
- <html>
43
- <head>
44
- <meta charset="utf-8">
45
- <script src="qrc:///qtwebchannel/qwebchannel.js"></script>
46
- <style>
47
- body {
48
- background:#0f0f14;
49
- color:white;
50
- font-family:monospace;
51
- text-align:center;
52
- margin-top:20vh;
53
- }
54
- button {
55
- padding:10px 20px;
56
- font-size:16px;
57
- }
58
- </style>
59
- </head>
60
- <body>
61
-
62
- <h1>🔥 Vertex WebEngine</h1>
63
- <button onclick="openSite()">Open example.com</button>
64
-
65
- <script>
66
- new QWebChannel(qt.webChannelTransport, channel => {
67
- window.bridge = channel.objects.bridge;
68
- bridge.log("Home loaded");
69
- });
70
-
71
- function openSite() {
72
- bridge.emit("open_url", JSON.stringify({
73
- url: "https://example.com"
74
- }));
75
- }
76
- </script>
77
-
78
- </body>
79
- </html>
80
- """
81
- self.webpage.setHtml(html, QUrl("https://www.google.com"))
82
-
83
- def load_url(self, url):
84
- self.load(QUrl(url))
@@ -1,22 +0,0 @@
1
- from PyQt6.QtWebEngineCore import QWebEnginePage
2
-
3
- class WebPage(QWebEnginePage):
4
-
5
- BLOCKED = ["malware", "phishing"]
6
-
7
- def __init__(self, profile, parent=None):
8
- super().__init__(profile, parent)
9
-
10
- def acceptNavigationRequest(self, url, nav_type, is_main_frame):
11
- url_str = url.toString()
12
- print("➡️ Navigating to:", url_str)
13
-
14
- for bad in self.BLOCKED:
15
- if bad in url_str:
16
- print("🚫 Blocked URL")
17
- return False
18
-
19
- return True
20
-
21
- def javaScriptConsoleMessage(self, level, message, line, source):
22
- print(f"[JS:{level.name}] {message} ({source}:{line})")
@@ -1,19 +0,0 @@
1
- from PyQt6.QtCore import QObject, pyqtSlot
2
- from PyQt6.QtCore import QUrl
3
- import json
4
-
5
- class JSBridge(QObject):
6
- def __init__(self, page):
7
- super().__init__()
8
- self.page = page
9
-
10
- @pyqtSlot(str)
11
- def log(self, msg):
12
- print("[JS → Python]", msg)
13
-
14
- @pyqtSlot(str, str)
15
- def emit(self, event, payload):
16
- data = json.loads(payload)
17
-
18
- if event == "open_url":
19
- self.page.load(QUrl(data["url"]))
@@ -1,27 +0,0 @@
1
- from PyQt6.QtWebEngineCore import QWebEngineProfile
2
- import os
3
-
4
- class WebProfile(QWebEngineProfile):
5
- def __init__(self, name="CustomProfile", parent=None):
6
- super().__init__(name, parent)
7
-
8
- os.makedirs("downloads", exist_ok=True)
9
-
10
- self.setHttpUserAgent(
11
- "VertexWebEngine/1.0 (PyQt6)"
12
- )
13
-
14
- self.setPersistentCookiesPolicy(
15
- QWebEngineProfile.PersistentCookiesPolicy.AllowPersistentCookies
16
- )
17
-
18
- self.setCachePath("webcache")
19
- self.setPersistentStoragePath("webstorage")
20
-
21
- self.downloadRequested.connect(self.on_download)
22
-
23
- def on_download(self, download):
24
- path = f"downloads/{download.downloadFileName()}"
25
- download.setPath(path)
26
- download.accept()
27
- print("⬇️ Downloading:", path)
VertexEngine/main.py DELETED
@@ -1,17 +0,0 @@
1
- import sys
2
- from PyQt6.QtWidgets import QApplication, QMainWindow
3
-
4
- from BrowserTools.Tabs import BrowserTabs
5
-
6
- app = QApplication(sys.argv)
7
-
8
- window = QMainWindow()
9
- window.setWindowTitle("Vertex Browser")
10
-
11
- tabs = BrowserTabs()
12
- window.setCentralWidget(tabs)
13
-
14
- window.resize(1280, 800)
15
- window.show()
16
-
17
- sys.exit(app.exec())
VertexEngine/test.py DELETED
@@ -1,61 +0,0 @@
1
- from PyQt6.QtWidgets import (
2
- QMainWindow, QWidget, QVBoxLayout,
3
- QHBoxLayout, QPushButton, QLineEdit
4
- )
5
- from VertexEngine.WebEngine.WebEngine import WebEngine
6
-
7
-
8
- class MainWindow(QMainWindow):
9
- def __init__(self):
10
- super().__init__()
11
-
12
- self.setWindowTitle("Vertex Browser")
13
- self.resize(1100, 700)
14
-
15
- # Central widget
16
- central = QWidget()
17
- self.setCentralWidget(central)
18
-
19
- layout = QVBoxLayout(central)
20
-
21
- # 🔧 Toolbar
22
- toolbar = QHBoxLayout()
23
-
24
- self.back_btn = QPushButton("←")
25
- self.reload_btn = QPushButton("⟳")
26
- self.home_btn = QPushButton("🏠")
27
- self.url_bar = QLineEdit()
28
-
29
- toolbar.addWidget(self.back_btn)
30
- toolbar.addWidget(self.reload_btn)
31
- toolbar.addWidget(self.home_btn)
32
- toolbar.addWidget(self.url_bar)
33
-
34
- layout.addLayout(toolbar)
35
-
36
- # 🌐 WebEngine
37
- self.web = WebEngine()
38
- layout.addWidget(self.web)
39
-
40
- # 🔗 Signals
41
- self.back_btn.clicked.connect(self.web.back)
42
- self.reload_btn.clicked.connect(self.web.reload)
43
- self.home_btn.clicked.connect(self.go_home)
44
- self.url_bar.returnPressed.connect(self.load_url)
45
-
46
- self.web.urlChanged.connect(self.update_url)
47
-
48
- # 🏠 Home
49
- self.go_home()
50
-
51
- def load_url(self):
52
- url = self.url_bar.text()
53
- if not url.startswith("http"):
54
- url = "https://" + url
55
- self.web.load_url(url)
56
-
57
- def update_url(self, qurl):
58
- self.url_bar.setText(qurl.toString())
59
-
60
- def go_home(self):
61
- self.web.load_url("https://example.com")
@@ -1,11 +0,0 @@
1
- VertexEngine/main.py,sha256=hutXWxm5qQv2x9eBdXyhD2ErKENzHb-aHSfuxWT-QoQ,333
2
- VertexEngine/test.py,sha256=y2VWCtKSOmXNOD1qlitSF44a7q6qRmHS0q-o7_bG0k8,1696
3
- VertexEngine/BrowserTools/Tabs.py,sha256=TOT0df5afpLHhvaUOA-xtUHFbGgvdo66peHaBvzVCrc,2301
4
- VertexEngine/WebEngine/WebEngine.py,sha256=1kko_WabEyJEt8mPTMxg3lMB-QPYdflq8bpRYg_DNxQ,2189
5
- VertexEngine/WebView/WebPage.py,sha256=Lav-uWvMhg3fIOhFxteujpx0YpyRNvWRD3C47sYK4N0,674
6
- VertexEngine/WebView/bridge.py,sha256=iJuXC9g7OynrH-7Jsg2-OmwngY8-z3nGycaIQwooRLQ,469
7
- VertexEngine/WebView/profile.py,sha256=g1KJRqYd2EHGJn1C-MyoPzk6Y6Awuuf9Tf5L9K9BGkI,832
8
- vertexengine_webengine-1.2.dev1.dist-info/METADATA,sha256=OxHrojCCpxKPDgGonSxVgB7GJW8gXrFrTq24d8Q9fmI,2177
9
- vertexengine_webengine-1.2.dev1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
10
- vertexengine_webengine-1.2.dev1.dist-info/top_level.txt,sha256=ONNMJUQViY7bNuEYPB2TaUwj7Jo1Is2yuBY4KOv19wM,13
11
- vertexengine_webengine-1.2.dev1.dist-info/RECORD,,