pyloid 0.17.3__tar.gz → 0.17.4__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pyloid-0.17.3 → pyloid-0.17.4}/PKG-INFO +1 -1
- {pyloid-0.17.3 → pyloid-0.17.4}/pyproject.toml +1 -1
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/api.py +8 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/browser_window.py +10 -5
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/js_api/window_api.py +4 -4
- {pyloid-0.17.3 → pyloid-0.17.4}/LICENSE +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/README.md +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/__init__.py +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/autostart.py +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/custom/titlebar.py +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/filewatcher.py +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/js_api/event_api.py +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/monitor.py +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/pyloid.py +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/thread_pool.py +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/timer.py +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/tray.py +0 -0
- {pyloid-0.17.3 → pyloid-0.17.4}/src/pyloid/utils.py +0 -0
@@ -1,4 +1,9 @@
|
|
1
1
|
from PySide6.QtCore import QObject, Slot
|
2
|
+
from typing import TYPE_CHECKING
|
3
|
+
|
4
|
+
if TYPE_CHECKING:
|
5
|
+
from pyloid.pyloid import Pyloid
|
6
|
+
from pyloid.browser_window import BrowserWindow
|
2
7
|
|
3
8
|
|
4
9
|
class PyloidAPI(QObject):
|
@@ -45,6 +50,9 @@ class PyloidAPI(QObject):
|
|
45
50
|
|
46
51
|
def __init__(self):
|
47
52
|
super().__init__()
|
53
|
+
self.window_id: str = None
|
54
|
+
self.window: "BrowserWindow" = None
|
55
|
+
self.app: "Pyloid" = None
|
48
56
|
|
49
57
|
|
50
58
|
def Bridge(*args, **kwargs):
|
@@ -72,7 +72,7 @@ class CustomWebEngineView(QWebEngineView):
|
|
72
72
|
super().__init__(parent._window)
|
73
73
|
self.parent: "BrowserWindow" = parent
|
74
74
|
|
75
|
-
#
|
75
|
+
# Custom Web Page
|
76
76
|
self.custom_page = CustomWebPage()
|
77
77
|
self.setPage(self.custom_page)
|
78
78
|
|
@@ -97,7 +97,7 @@ class CustomWebEngineView(QWebEngineView):
|
|
97
97
|
self.resize_start_pos = event.globalPos()
|
98
98
|
|
99
99
|
def start_system_drag(self):
|
100
|
-
"""
|
100
|
+
"""Start system window move"""
|
101
101
|
if self.parent._window.windowHandle():
|
102
102
|
self.parent._window.windowHandle().startSystemMove()
|
103
103
|
|
@@ -105,7 +105,7 @@ class CustomWebEngineView(QWebEngineView):
|
|
105
105
|
if self.parent.frame or not self.is_resizing_enabled:
|
106
106
|
return
|
107
107
|
|
108
|
-
#
|
108
|
+
# Check resize direction
|
109
109
|
was_in_resize_area = self.is_in_resize_area
|
110
110
|
resize_direction = self.get_resize_direction(event.pos())
|
111
111
|
self.is_in_resize_area = bool(resize_direction)
|
@@ -117,7 +117,7 @@ class CustomWebEngineView(QWebEngineView):
|
|
117
117
|
self.resize_window(event.globalPos())
|
118
118
|
return
|
119
119
|
|
120
|
-
#
|
120
|
+
# Change cursor when entering/leaving resize area
|
121
121
|
if self.is_in_resize_area != was_in_resize_area:
|
122
122
|
if self.is_in_resize_area:
|
123
123
|
# self.setAttribute(Qt.WA_SetCursor, True)
|
@@ -239,7 +239,7 @@ class BrowserWindow:
|
|
239
239
|
self.frame = frame
|
240
240
|
self.context_menu = context_menu
|
241
241
|
self.dev_tools = dev_tools
|
242
|
-
self.js_apis = [WindowAPI(
|
242
|
+
self.js_apis = [WindowAPI()]
|
243
243
|
for js_api in js_apis:
|
244
244
|
self.js_apis.append(js_api)
|
245
245
|
self.shortcuts = {}
|
@@ -374,6 +374,11 @@ class BrowserWindow:
|
|
374
374
|
# Register additional JS APIs
|
375
375
|
if self.js_apis:
|
376
376
|
for js_api in self.js_apis:
|
377
|
+
# Define window_id, window, and app for each JS API
|
378
|
+
js_api.window_id = self.id
|
379
|
+
js_api.window = self
|
380
|
+
js_api.app = self.app
|
381
|
+
|
377
382
|
self.channel.registerObject(js_api.__class__.__name__, js_api)
|
378
383
|
|
379
384
|
self.web_view.page().setWebChannel(self.channel)
|
@@ -8,10 +8,10 @@ if TYPE_CHECKING:
|
|
8
8
|
from ..pyloid import Pyloid
|
9
9
|
|
10
10
|
class WindowAPI(PyloidAPI):
|
11
|
-
def __init__(self, window_id: str, app: 'Pyloid'):
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# def __init__(self, window_id: str, app: 'Pyloid'):
|
12
|
+
# super().__init__()
|
13
|
+
# self.window_id: str = window_id
|
14
|
+
# self.app: 'Pyloid' = app
|
15
15
|
|
16
16
|
@Bridge(result=str)
|
17
17
|
def getWindowId(self):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|