pyloid 0.26.9__py3-none-any.whl → 0.27.1__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.
- pyloid/browser_window.py +11 -8
- pyloid/ipc.py +66 -44
- {pyloid-0.26.9.dist-info → pyloid-0.27.1.dist-info}/METADATA +2 -2
- {pyloid-0.26.9.dist-info → pyloid-0.27.1.dist-info}/RECORD +6 -6
- {pyloid-0.26.9.dist-info → pyloid-0.27.1.dist-info}/LICENSE +0 -0
- {pyloid-0.26.9.dist-info → pyloid-0.27.1.dist-info}/WHEEL +0 -0
pyloid/browser_window.py
CHANGED
@@ -408,7 +408,7 @@ class _BrowserWindow:
|
|
408
408
|
frame: bool = True,
|
409
409
|
context_menu: bool = False,
|
410
410
|
dev_tools: bool = False,
|
411
|
-
|
411
|
+
transparent: bool = False,
|
412
412
|
IPCs: List[PyloidIPC] = [],
|
413
413
|
):
|
414
414
|
###########################################################################################
|
@@ -730,6 +730,8 @@ class _BrowserWindow:
|
|
730
730
|
};
|
731
731
|
// console.log('pyloid.EventAPI object initialized:', window.pyloid.EventAPI);
|
732
732
|
|
733
|
+
window.ipc = {};
|
734
|
+
|
733
735
|
%s
|
734
736
|
|
735
737
|
%s
|
@@ -748,17 +750,18 @@ class _BrowserWindow:
|
|
748
750
|
console.error('QWebChannel is not defined.');
|
749
751
|
}
|
750
752
|
"""
|
751
|
-
ipcs_init_code =
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
753
|
+
ipcs_init_code = '\n'.join(
|
754
|
+
[
|
755
|
+
f"window['ipc']['{ipc.__class__.__name__}'] = channel.objects['{ipc.__class__.__name__}'];\n"
|
756
|
+
f"console.log('{ipc.__class__.__name__} object initialized:', window['ipc']['{ipc.__class__.__name__}']);"
|
757
|
+
for ipc in self.IPCs
|
758
|
+
if ipc.__class__.__name__ != 'BaseIPC'
|
759
|
+
]
|
757
760
|
)
|
758
761
|
|
759
762
|
base_ipc_init = "window['__PYLOID__'] = channel.objects['__PYLOID__'];\n"
|
760
763
|
|
761
|
-
self.web_view.page().runJavaScript(js_code % base_ipc_init
|
764
|
+
self.web_view.page().runJavaScript(js_code % (base_ipc_init, ipcs_init_code))
|
762
765
|
|
763
766
|
# if splash screen is set, close it when the page is loaded
|
764
767
|
if self.close_on_load and self.splash_screen:
|
pyloid/ipc.py
CHANGED
@@ -24,47 +24,58 @@ class PyloidIPC(QObject):
|
|
24
24
|
-------------
|
25
25
|
(Python)
|
26
26
|
```python
|
27
|
-
from pyloid import
|
28
|
-
|
29
|
-
)
|
30
|
-
from pyloid.ipc import (
|
31
|
-
PyloidIPC,
|
32
|
-
Bridge,
|
33
|
-
)
|
27
|
+
from pyloid import Pyloid
|
28
|
+
from pyloid.ipc import PyloidIPC, Bridge
|
34
29
|
|
35
30
|
app = Pyloid('Pyloid-App')
|
36
31
|
|
37
|
-
|
38
32
|
class CustomIPC(PyloidIPC):
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
33
|
+
@Bridge(str, result=str)
|
34
|
+
def echo(self, message):
|
35
|
+
return f'Message received in Python: {message}'
|
36
|
+
|
37
|
+
@Bridge(int, int, result=int)
|
38
|
+
def add(self, a, b):
|
39
|
+
return a + b
|
40
|
+
|
41
|
+
@Bridge(result=str)
|
42
|
+
def create_window(self):
|
43
|
+
win = self.pyloid.create_window(title='Pyloid Browser')
|
44
|
+
win.load_url('https://www.google.com')
|
45
|
+
win.show()
|
46
|
+
win.focus()
|
47
|
+
return win.get_id()
|
49
48
|
|
50
49
|
# Create main window
|
51
50
|
window = app.create_window(
|
52
|
-
|
53
|
-
|
51
|
+
title='Pyloid Browser',
|
52
|
+
ipc=[CustomIPC()],
|
54
53
|
)
|
55
54
|
|
56
55
|
window.load_file('index.html')
|
57
|
-
|
58
56
|
window.show()
|
59
57
|
window.focus()
|
60
58
|
|
61
59
|
app.run()
|
62
60
|
```
|
61
|
+
|
63
62
|
---
|
63
|
+
|
64
64
|
(JavaScript)
|
65
65
|
```javascript
|
66
|
-
|
67
|
-
|
66
|
+
import { ipc } from 'pyloid-js';
|
67
|
+
|
68
|
+
let result = await ipc.CustomIPC.echo('Hello, Pyloid!').then((result) => {
|
69
|
+
console.log(result); // "Message received in Python: Hello, Pyloid!"
|
70
|
+
})
|
71
|
+
|
72
|
+
let sum = await ipc.CustomIPC.add(5, 3).then((sum) => {
|
73
|
+
console.log(sum); // 8
|
74
|
+
})
|
75
|
+
|
76
|
+
let window_id = await ipc.CustomIPC.create_window().then((window_id) => {
|
77
|
+
console.log(window_id); // "eae338a3-c8cb-4103-852f-404486beea0d"
|
78
|
+
})
|
68
79
|
```
|
69
80
|
"""
|
70
81
|
|
@@ -95,35 +106,35 @@ def Bridge(
|
|
95
106
|
-------------
|
96
107
|
(Python)
|
97
108
|
```python
|
98
|
-
from pyloid import
|
99
|
-
|
100
|
-
PyloidIPC,
|
101
|
-
Bridge,
|
102
|
-
)
|
109
|
+
from pyloid import Pyloid
|
110
|
+
from pyloid.ipc import PyloidIPC, Bridge
|
103
111
|
|
104
112
|
app = Pyloid('Pyloid-App')
|
105
113
|
|
106
|
-
|
107
114
|
class CustomIPC(PyloidIPC):
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
115
|
+
@Bridge(str, result=str)
|
116
|
+
def echo(self, message):
|
117
|
+
return f'Message received in Python: {message}'
|
118
|
+
|
119
|
+
@Bridge(int, int, result=int)
|
120
|
+
def add(self, a, b):
|
121
|
+
return a + b
|
122
|
+
|
123
|
+
@Bridge(result=str)
|
124
|
+
def create_window(self):
|
125
|
+
win = self.pyloid.create_window(title='Pyloid Browser')
|
126
|
+
win.load_url('https://www.google.com')
|
127
|
+
win.show()
|
128
|
+
win.focus()
|
129
|
+
return win.get_id()
|
118
130
|
|
119
131
|
# Create main window
|
120
132
|
window = app.create_window(
|
121
|
-
|
122
|
-
|
133
|
+
title='Pyloid Browser',
|
134
|
+
ipc=[CustomIPC()],
|
123
135
|
)
|
124
136
|
|
125
137
|
window.load_file('index.html')
|
126
|
-
|
127
138
|
window.show()
|
128
139
|
window.focus()
|
129
140
|
|
@@ -132,8 +143,19 @@ def Bridge(
|
|
132
143
|
---
|
133
144
|
(JavaScript)
|
134
145
|
```javascript
|
135
|
-
|
136
|
-
|
146
|
+
import { ipc } from 'pyloid-js';
|
147
|
+
|
148
|
+
let result = await ipc.CustomIPC.echo('Hello, Pyloid!').then((result) => {
|
149
|
+
console.log(result); // "Message received in Python: Hello, Pyloid!"
|
150
|
+
})
|
151
|
+
|
152
|
+
let sum = await ipc.CustomIPC.add(5, 3).then((sum) => {
|
153
|
+
console.log(sum); // 8
|
154
|
+
})
|
155
|
+
|
156
|
+
let window_id = await ipc.CustomIPC.create_window().then((window_id) => {
|
157
|
+
console.log(window_id); // "eae338a3-c8cb-4103-852f-404486beea0d"
|
158
|
+
})
|
137
159
|
```
|
138
160
|
"""
|
139
161
|
return Slot(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: pyloid
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.27.1
|
4
4
|
Summary:
|
5
5
|
Author: aesthetics-of-record
|
6
6
|
Author-email: 111675679+aesthetics-of-record@users.noreply.github.com
|
@@ -59,7 +59,7 @@ npm create pyloid-app@latest
|
|
59
59
|
|
60
60
|
## Documentation 📚
|
61
61
|
|
62
|
-
[Pyloid Documentation](https://
|
62
|
+
[Pyloid Documentation](https://pyloid.com/)
|
63
63
|
|
64
64
|
## License
|
65
65
|
|
@@ -3,10 +3,10 @@ pyloid/autostart.py,sha256=4q3YiYt2SKJiJV16FalISYVjg9X7b0l7eAmSWOhfXo0,3679
|
|
3
3
|
pyloid/base_ipc/base.py,sha256=eo0mkAOCl2h9NDD1sQNYauS15iyEGNpXY5oO5n4nNPo,8052
|
4
4
|
pyloid/base_ipc/event_api.py,sha256=JY8YfyTns4jMwZ43ob9KuGedMBSVML8FuQJHk_bDhFE,959
|
5
5
|
pyloid/base_ipc/window_api.py,sha256=-isphU3m2wGB5U0yZrSuK_4XiBz2mG45HsjYTUq7Fxs,7348
|
6
|
-
pyloid/browser_window.py,sha256=
|
6
|
+
pyloid/browser_window.py,sha256=PWDXFlroT2EXKy5ko6YOBqF174tCw5AQ-CvaF3lNcOE,91799
|
7
7
|
pyloid/custom/titlebar.py,sha256=wkh3h6ZBOYJczTrOosgiTKiSL-ZU92RWQv4FjpnH9u8,3728
|
8
8
|
pyloid/filewatcher.py,sha256=Rdu76qpwXpFNQuapZZBajRN_0svcPZa2s-06IBH4dkk,4062
|
9
|
-
pyloid/ipc.py,sha256=
|
9
|
+
pyloid/ipc.py,sha256=MwVnumOfVVVU-vohWwoyeQrZLshxvG6bglvTekogrWk,3323
|
10
10
|
pyloid/monitor.py,sha256=cCBQgX0OJg7Gt3WeNfb-koTNR17ZToN2Lq35o_2F350,23970
|
11
11
|
pyloid/pyloid.py,sha256=mOQO--GB7RX00MwUpQPrpdT5_3WEhr07-L2vgyRJ7m4,74876
|
12
12
|
pyloid/rpc.py,sha256=40KsbCnYotLm5M7S2Uo41ELV4N7ugz9tBtdfIfFIIG0,18964
|
@@ -17,7 +17,7 @@ pyloid/timer.py,sha256=YNxQn2HVMKBk417YDiz8WwhTmSAkbnGUyFGV2biUEPg,7821
|
|
17
17
|
pyloid/tray.py,sha256=yHWsOMPpEjZa3W-T-O8Wrwo1GphCV-9adodLdxU0_mA,1673
|
18
18
|
pyloid/url_interceptor.py,sha256=lA-i5Raw-GDRDMKHRO361N6igLfN9_mIANCXwZ_FZT8,771
|
19
19
|
pyloid/utils.py,sha256=x7PGkgreV3l4K-Tke9W06t_VEtq0mH0AYWK695IR-mo,6416
|
20
|
-
pyloid-0.
|
21
|
-
pyloid-0.
|
22
|
-
pyloid-0.
|
23
|
-
pyloid-0.
|
20
|
+
pyloid-0.27.1.dist-info/LICENSE,sha256=F96EzotgWhhpnQTW2TcdoqrMDir1jyEo6H915tGQ-QE,11524
|
21
|
+
pyloid-0.27.1.dist-info/METADATA,sha256=1oKhZAFy98y8u-ermNl12QD3zqSzR0WBXY1ascwjcgE,2293
|
22
|
+
pyloid-0.27.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
23
|
+
pyloid-0.27.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|