pyloid 0.13.1__py3-none-any.whl → 0.14.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/api.py +85 -2
- pyloid/browser_window.py +1190 -0
- pyloid/filewatcher.py +137 -9
- pyloid/js_api/event_api.py +25 -0
- pyloid/js_api/window_api.py +166 -0
- pyloid/monitor.py +602 -77
- pyloid/pyloid.py +742 -892
- pyloid/timer.py +219 -35
- pyloid/tray.py +30 -0
- pyloid/utils.py +55 -6
- {pyloid-0.13.1.dist-info → pyloid-0.14.1.dist-info}/METADATA +1 -1
- pyloid-0.14.1.dist-info/RECORD +17 -0
- pyloid-0.13.1.dist-info/RECORD +0 -14
- {pyloid-0.13.1.dist-info → pyloid-0.14.1.dist-info}/LICENSE +0 -0
- {pyloid-0.13.1.dist-info → pyloid-0.14.1.dist-info}/WHEEL +0 -0
pyloid/api.py
CHANGED
@@ -1,10 +1,93 @@
|
|
1
1
|
from PySide6.QtCore import QObject, Slot
|
2
2
|
|
3
|
-
|
4
3
|
class PyloidAPI(QObject):
|
4
|
+
"""
|
5
|
+
PyloidAPI 클래스는 PySide6의 QObject를 상속받아 생성된 클래스입니다.
|
6
|
+
JavaScript와 Python 간의 통신을 가능하게 합니다.
|
7
|
+
|
8
|
+
사용 예제
|
9
|
+
--------
|
10
|
+
(Python)
|
11
|
+
```python
|
12
|
+
from pyloid import Pyloid, PyloidAPI, Bridge
|
13
|
+
|
14
|
+
app = Pyloid("Pyloid-App")
|
15
|
+
|
16
|
+
class CustomAPI(PyloidAPI):
|
17
|
+
@Bridge(str, result=str)
|
18
|
+
def echo(self, message):
|
19
|
+
return f"Message received in Python: {message}"
|
20
|
+
|
21
|
+
# Create main window
|
22
|
+
window = app.create_window(
|
23
|
+
title="Pyloid Browser",
|
24
|
+
js_apis=[CustomAPI()],
|
25
|
+
)
|
26
|
+
|
27
|
+
window.load_file("index.html")
|
28
|
+
|
29
|
+
window.show()
|
30
|
+
window.focus()
|
31
|
+
|
32
|
+
app.run()
|
33
|
+
```
|
34
|
+
---
|
35
|
+
(JavaScript)
|
36
|
+
```javascript
|
37
|
+
document.addEventListener('pyloidReady', async function () {
|
38
|
+
let result = await window.pyloid.CustomAPI.echo('Hello, Pyloid!');
|
39
|
+
console.log(result);
|
40
|
+
});
|
41
|
+
```
|
42
|
+
|
43
|
+
"""
|
5
44
|
def __init__(self):
|
6
45
|
super().__init__()
|
7
46
|
|
8
|
-
|
9
47
|
def Bridge(*args, **kwargs):
|
48
|
+
"""
|
49
|
+
Bridge 함수는 JavaScript에서 호출할 수 있는 슬롯을 생성합니다.
|
50
|
+
|
51
|
+
Parameters
|
52
|
+
----------
|
53
|
+
*args : tuple
|
54
|
+
가변 인자 목록입니다.
|
55
|
+
**kwargs : dict
|
56
|
+
키워드 인자 목록입니다.
|
57
|
+
|
58
|
+
사용 예제
|
59
|
+
--------
|
60
|
+
(Python)
|
61
|
+
```python
|
62
|
+
from pyloid import Pyloid, PyloidAPI, Bridge
|
63
|
+
|
64
|
+
app = Pyloid("Pyloid-App")
|
65
|
+
|
66
|
+
class CustomAPI(PyloidAPI):
|
67
|
+
@Bridge(str, result=str)
|
68
|
+
def echo(self, message):
|
69
|
+
return f"Message received in Python: {message}"
|
70
|
+
|
71
|
+
# Create main window
|
72
|
+
window = app.create_window(
|
73
|
+
title="Pyloid Browser",
|
74
|
+
js_apis=[CustomAPI()],
|
75
|
+
)
|
76
|
+
|
77
|
+
window.load_file("index.html")
|
78
|
+
|
79
|
+
window.show()
|
80
|
+
window.focus()
|
81
|
+
|
82
|
+
app.run()
|
83
|
+
```
|
84
|
+
---
|
85
|
+
(JavaScript)
|
86
|
+
```javascript
|
87
|
+
document.addEventListener('pyloidReady', async function () {
|
88
|
+
let result = await window.pyloid.CustomAPI.echo('Hello, Pyloid!');
|
89
|
+
console.log(result);
|
90
|
+
});
|
91
|
+
```
|
92
|
+
"""
|
10
93
|
return Slot(*args, **kwargs)
|