VertexEngine-WebEngine 1.2rc2__py3-none-any.whl → 1.2rc4__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,36 @@
1
+ import os
2
+ from PyQt6.QtGui import QPixmap
3
+
4
+ class AssetManager:
5
+ def __init__(self, base_path="assets"):
6
+ """
7
+ Base directory for assets (images, icons, etc.)
8
+ """
9
+ self.base_path = base_path
10
+ self.cache = {} # Cache loaded images for speed
11
+ os.makedirs(self.base_path, exist_ok=True)
12
+
13
+ def load_image(self, path: str) -> QPixmap:
14
+ """
15
+ Load an image from the assets folder, cache it
16
+ """
17
+ full_path = os.path.join(self.base_path, path)
18
+
19
+ if full_path in self.cache:
20
+ return self.cache[full_path]
21
+
22
+ if not os.path.isfile(full_path):
23
+ print(f"⚠️ Asset not found: {full_path}")
24
+ return QPixmap() # Return empty pixmap if missing
25
+
26
+ pixmap = QPixmap(full_path)
27
+ self.cache[full_path] = pixmap
28
+ print(f"🖼 Loaded image: {path}")
29
+ return pixmap
30
+
31
+ def clear_cache(self):
32
+ """
33
+ Clear cached assets (useful if assets change dynamically)
34
+ """
35
+ self.cache.clear()
36
+ print("🗑 Asset cache cleared")
@@ -0,0 +1,12 @@
1
+ from PyQt6.QtWebEngineCore import QWebEngineUrlRequestInterceptor
2
+
3
+ class VertexInterceptor(QWebEngineUrlRequestInterceptor):
4
+ def interceptRequest(self, info):
5
+ url = info.requestUrl().toString()
6
+
7
+ # Block ads/tracking
8
+ blocked_words = ["ads", "doubleclick", "tracker"]
9
+
10
+ if any(word in url for word in blocked_words):
11
+ print("🚫 Blocked:", url)
12
+ info.block(True)
@@ -0,0 +1,9 @@
1
+ from PyQt6.QtWebEngineCore import QWebEnginePage
2
+
3
+ class VertexWebPage(QWebEnginePage):
4
+ def javaScriptConsoleMessage(self, level, message, line, source):
5
+ print(f"[JS Console] {message} (Line {line})")
6
+
7
+ def acceptNavigationRequest(self, url, nav_type, isMainFrame):
8
+ print("Navigating to:", url.toString())
9
+ return True
@@ -0,0 +1,14 @@
1
+ from PyQt6.QtWebEngineCore import QWebEngineProfile
2
+
3
+ class VertexProfile(QWebEngineProfile):
4
+ def __init__(self, name="None"):
5
+ super().__init__(name)
6
+
7
+ self.setPersistentCookiesPolicy(
8
+ QWebEngineProfile.PersistentCookiesPolicy.ForcePersistentCookies
9
+ )
10
+
11
+ self.setCachePath("cache/")
12
+ self.setPersistentStoragePath("storage/")
13
+
14
+ print("Profile Loaded ✅")
@@ -1,23 +1,70 @@
1
1
  from PyQt6.QtWebEngineWidgets import QWebEngineView
2
2
  from PyQt6.QtWebChannel import QWebChannel
3
+ from PyQt6.QtWebEngineCore import QWebEngineProfile
3
4
  from VertexWebEngineCore.WebScene import SceneManager
4
5
  from VertexWebEngineCore.JSBridge import JSBridge
6
+ from VertexWebEngineCore.WebPage import VertexWebPage
7
+ from VertexWebEngineCore.WebEngineURLInterceptor import VertexInterceptor
8
+ # -----------------------------
9
+ # Download Manager
10
+ # -----------------------------
11
+ class DownloadManager:
12
+ def __init__(self):
13
+ self.download_folder = "downloads/"
14
+
15
+ def handle_download(self, download):
16
+ download.setDownloadDirectory(self.download_folder)
17
+ download.accept()
18
+ print("📥 Downloading:", download.downloadFileName())
19
+
5
20
 
21
+ # -----------------------------
22
+ # WebEngine
23
+ # -----------------------------
6
24
  class WebEngine(QWebEngineView):
7
25
  def __init__(self):
8
26
  super().__init__()
9
27
 
10
- # Scene system
11
- self.scene_manager = SceneManager(self)
28
+ print("🔥 WebEngine Starting...")
12
29
 
13
- # Bridge
30
+ # Scene Manager + JS Bridge
31
+ self.scene_manager = SceneManager(self)
14
32
  self.bridge = JSBridge(self.scene_manager)
15
33
 
16
- # Channel
34
+ # Web Channel
17
35
  self.channel = QWebChannel()
18
36
  self.channel.registerObject("bridge", self.bridge)
19
37
 
38
+ # -----------------------------
39
+ # Profile
40
+ # -----------------------------
41
+ self.profile = QWebEngineProfile("VertexProfile")
42
+ self.profile.setPersistentStoragePath("storage/")
43
+ self.profile.setCachePath("cache/")
44
+
45
+ # Interceptor
46
+ self.interceptor = VertexInterceptor()
47
+ self.profile.setUrlRequestInterceptor(self.interceptor)
48
+
49
+ # Downloads
50
+ self.download_manager = DownloadManager()
51
+ self.profile.downloadRequested.connect(
52
+ self.download_manager.handle_download
53
+ )
54
+
55
+ # -----------------------------
56
+ # Page (correct usage)
57
+ # -----------------------------
58
+ self.page_obj = VertexWebPage(self) # parent is the view
59
+ self.page_obj.setProfile(self.profile) # assign profile properly
60
+ self.setPage(self.page_obj)
61
+
62
+ # Assign WebChannel
20
63
  self.page().setWebChannel(self.channel)
21
64
 
65
+ # -----------------------------
22
66
  # Start on menu
67
+ # -----------------------------
23
68
  self.scene_manager.load_scene("menu")
69
+
70
+ print("✅ WebEngine Ready!")
@@ -0,0 +1,39 @@
1
+ from PyQt6.QtWidgets import QToolBar, QLineEdit
2
+ from PyQt6.QtGui import QAction
3
+
4
+ class NavBar(QToolBar):
5
+ def __init__(self, tabs):
6
+ super().__init__()
7
+
8
+ self.tabs = tabs
9
+
10
+ # Buttons
11
+ back_btn = QAction("⬅", self)
12
+ forward_btn = QAction("➡", self)
13
+ reload_btn = QAction("🔄", self)
14
+ newtab_btn = QAction("➕", self)
15
+
16
+ back_btn.triggered.connect(lambda: self.current().back())
17
+ forward_btn.triggered.connect(lambda: self.current().forward())
18
+ reload_btn.triggered.connect(lambda: self.current().reload())
19
+ newtab_btn.triggered.connect(lambda: self.tabs.add_new_tab())
20
+
21
+ self.addAction(back_btn)
22
+ self.addAction(forward_btn)
23
+ self.addAction(reload_btn)
24
+ self.addAction(newtab_btn)
25
+
26
+ # URL Bar
27
+ self.url_bar = QLineEdit()
28
+ self.url_bar.returnPressed.connect(self.load_url)
29
+ self.addWidget(self.url_bar)
30
+
31
+ def current(self):
32
+ return self.tabs.currentWidget()
33
+
34
+ def load_url(self):
35
+ url = self.url_bar.text()
36
+ if not url.startswith("http"):
37
+ url = "https://" + url
38
+
39
+ self.current().load(url)
@@ -0,0 +1,14 @@
1
+ import os
2
+
3
+ class DownloadManager:
4
+ def __init__(self):
5
+ self.download_folder = "downloads/"
6
+ os.makedirs(self.download_folder, exist_ok=True)
7
+
8
+ def handle_download(self, download):
9
+ filename = download.downloadFileName()
10
+
11
+ download.setDownloadDirectory(self.download_folder)
12
+ download.accept()
13
+
14
+ print("📥 Downloading:", filename)
@@ -1,11 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: VertexEngine-WebEngine
3
- Version: 1.2rc2
3
+ Version: 1.2rc4
4
4
  Summary: The offical WebEngine Extension of the VertexEngine SDK.
5
5
  Author-email: Tyrel Miguel <annbasilan0828@gmail.com>
6
6
  License: MIT
7
7
  Project-URL: Documentation, https://vertexenginedocs.netlify.app/
8
- Project-URL: Homepage, https://github.com/TyrelGomez/VertexEngine-WebEngine-Code
8
+ Project-URL: Source, https://github.com/VertexEngine-Projects/VertexEngine-WebEngine-Code
9
+ Project-URL: Issues, https://github.com/VertexEngine-Projects/VertexEngine-WebEngine-Code/issues
9
10
  Requires-Python: >=3.10
10
11
  Description-Content-Type: text/markdown
11
12
  License-File: LICENSE
@@ -22,7 +23,12 @@ VertexEngine-WebEngine is a WebEngine built for the VertexEngine SDK. It's a sep
22
23
  The documentation is in the following link:
23
24
  [Project Documentation](https://vertexenginedocs.netlify.app/) for help.
24
25
 
25
- ## Change Logs (1.2rc2), NEW!
26
+ ## Change Logs (1.2rc4), NEW!
27
+ ### 1.4rc4
28
+ - REFINING AGAIN! Docs on v1.2.0
29
+ - Source Link on github
30
+ ### 1.2rc3
31
+ - FULL REFINATION OF THE BROWSER! Documentation Updated.
26
32
  ### 1.2rc2
27
33
  - EXPANDED JS BRIDGE!
28
34
  ### 1.2rc1
@@ -0,0 +1,14 @@
1
+ VertexEngine/VertexWebEngineCore/AssetManager.py,sha256=kJJPQx8OlrctfusStPNh6VETd_syC5EK5xtTFHlIyTM,1120
2
+ VertexEngine/VertexWebEngineCore/JSBridge.py,sha256=gJOj5yU3ZGcZrErOgJXynMl7_SxM38aQvFbEchQQ15U,3485
3
+ VertexEngine/VertexWebEngineCore/WebEngineURLInterceptor.py,sha256=0JoHzsNI01MY-J1ztV_y-NLqS3BH4FaMnTc45Dq9iKA,431
4
+ VertexEngine/VertexWebEngineCore/WebPage.py,sha256=FvX73SBQ8v5G-cW-wZk0QgW_f-ex9vOYkhjWh9pDFIE,357
5
+ VertexEngine/VertexWebEngineCore/WebProfile.py,sha256=y1QUXqoy_C6swcWfEilIuv6p5JA8KbuX4Mp_u7_mDOQ,428
6
+ VertexEngine/VertexWebEngineCore/WebScene.py,sha256=2G5KuyM5sO7A4GlMUkKHNXvM1clYPNTrFbNwILp8GwI,1223
7
+ VertexEngine/VertexWebEngineWidgets/EngineView.py,sha256=yZREOVVbBLPEBOQVsiuo4MXdX8RsJKLtY7DFAI5jBTA,2404
8
+ VertexEngine/WebBrowserSystem/BrowserToolBar.py,sha256=Zgkji2IkEENcsVeIdpBCVoCyeWOE9hZ_pCY3Bf7F9gU,1214
9
+ VertexEngine/WebBrowserSystem/downloads.py,sha256=tIRai529DRgqLjUp74L88PSTL8aPu4_SKBo5dj5KTFY,395
10
+ vertexengine_webengine-1.2rc4.dist-info/licenses/LICENSE,sha256=dV2_I9Rq_DHkqouiT6TD2tsQVh9pgzlqFrkT8BuW2X8,1096
11
+ vertexengine_webengine-1.2rc4.dist-info/METADATA,sha256=wxob__x_0doH_j0rMJEXg16cifPHr1KP4sYUT0BNBiA,2768
12
+ vertexengine_webengine-1.2rc4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
13
+ vertexengine_webengine-1.2rc4.dist-info/top_level.txt,sha256=ONNMJUQViY7bNuEYPB2TaUwj7Jo1Is2yuBY4KOv19wM,13
14
+ vertexengine_webengine-1.2rc4.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- VertexEngine/VertexWebEngineCore/JSBridge.py,sha256=gJOj5yU3ZGcZrErOgJXynMl7_SxM38aQvFbEchQQ15U,3485
2
- VertexEngine/VertexWebEngineCore/WebScene.py,sha256=2G5KuyM5sO7A4GlMUkKHNXvM1clYPNTrFbNwILp8GwI,1223
3
- VertexEngine/VertexWebEngineWidgets/EngineView.py,sha256=tC4nm54UTJKQWl1WxtLAPJZ9WMKM73x9lqZGmdYQBtg,683
4
- vertexengine_webengine-1.2rc2.dist-info/licenses/LICENSE,sha256=dV2_I9Rq_DHkqouiT6TD2tsQVh9pgzlqFrkT8BuW2X8,1096
5
- vertexengine_webengine-1.2rc2.dist-info/METADATA,sha256=jm3HweFuIgRNwjZsV9PeiLlFlkLx1jVmxoARtBJFacs,2520
6
- vertexengine_webengine-1.2rc2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
7
- vertexengine_webengine-1.2rc2.dist-info/top_level.txt,sha256=ONNMJUQViY7bNuEYPB2TaUwj7Jo1Is2yuBY4KOv19wM,13
8
- vertexengine_webengine-1.2rc2.dist-info/RECORD,,