pyloid 0.17.0__tar.gz → 0.17.2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pyloid-0.17.0 → pyloid-0.17.2}/PKG-INFO +1 -1
- {pyloid-0.17.0 → pyloid-0.17.2}/pyproject.toml +1 -1
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/browser_window.py +19 -1
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/pyloid.py +0 -3
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/utils.py +24 -4
- {pyloid-0.17.0 → pyloid-0.17.2}/LICENSE +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/README.md +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/__init__.py +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/api.py +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/autostart.py +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/custom/titlebar.py +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/filewatcher.py +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/js_api/event_api.py +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/js_api/window_api.py +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/monitor.py +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/thread_pool.py +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/timer.py +0 -0
- {pyloid-0.17.0 → pyloid-0.17.2}/src/pyloid/tray.py +0 -0
@@ -372,7 +372,17 @@ class BrowserWindow:
|
|
372
372
|
new QWebChannel(qt.webChannelTransport, function (channel) {
|
373
373
|
window.pyloid = {
|
374
374
|
EventAPI: {
|
375
|
+
_listeners: {}, // 콜백 함수들을 저장할 객체
|
376
|
+
|
375
377
|
listen: function(eventName, callback) {
|
378
|
+
// 이벤트에 대한 콜백 배열이 없다면 생성
|
379
|
+
if (!this._listeners[eventName]) {
|
380
|
+
this._listeners[eventName] = [];
|
381
|
+
}
|
382
|
+
|
383
|
+
// 콜백 함수 저장
|
384
|
+
this._listeners[eventName].push(callback);
|
385
|
+
|
376
386
|
document.addEventListener(eventName, function(event) {
|
377
387
|
let eventData;
|
378
388
|
try {
|
@@ -383,8 +393,16 @@ class BrowserWindow:
|
|
383
393
|
callback(eventData);
|
384
394
|
});
|
385
395
|
},
|
396
|
+
|
386
397
|
unlisten: function(eventName) {
|
387
|
-
|
398
|
+
// 해당 이벤트의 모든 리스너 제거
|
399
|
+
if (this._listeners[eventName]) {
|
400
|
+
this._listeners[eventName].forEach(callback => {
|
401
|
+
document.removeEventListener(eventName, callback);
|
402
|
+
});
|
403
|
+
// 저장된 콜백 제거
|
404
|
+
delete this._listeners[eventName];
|
405
|
+
}
|
388
406
|
}
|
389
407
|
}
|
390
408
|
};
|
@@ -4,7 +4,7 @@ import platform
|
|
4
4
|
from typing import Optional
|
5
5
|
|
6
6
|
|
7
|
-
def get_production_path() -> Optional[str]:
|
7
|
+
def get_production_path(path: Optional[str] = None) -> Optional[str]:
|
8
8
|
"""
|
9
9
|
Returns the path to the resource files in a production environment.
|
10
10
|
If running as a regular Python script, returns None.
|
@@ -18,7 +18,7 @@ def get_production_path() -> Optional[str]:
|
|
18
18
|
Examples
|
19
19
|
--------
|
20
20
|
>>> from pyloid.utils import get_production_path
|
21
|
-
>>> path = get_production_path()
|
21
|
+
>>> path = get_production_path("assets/icon.ico")
|
22
22
|
>>> if path:
|
23
23
|
>>> print(f"Production path: {path}")
|
24
24
|
>>> else:
|
@@ -26,7 +26,7 @@ def get_production_path() -> Optional[str]:
|
|
26
26
|
"""
|
27
27
|
if getattr(sys, 'frozen', False):
|
28
28
|
# If built with PyInstaller
|
29
|
-
return sys._MEIPASS
|
29
|
+
return sys._MEIPASS + "/" + path if path else sys._MEIPASS
|
30
30
|
else:
|
31
31
|
# If running as a regular Python script
|
32
32
|
return None
|
@@ -73,6 +73,26 @@ def get_platform() -> str:
|
|
73
73
|
"""
|
74
74
|
return platform.system()
|
75
75
|
|
76
|
+
def get_absolute_path(path: str) -> str:
|
77
|
+
"""
|
78
|
+
Returns the absolute path of the given relative path.
|
79
|
+
|
80
|
+
Parameters
|
81
|
+
----------
|
82
|
+
path : str
|
83
|
+
The relative path to get the absolute path of.
|
76
84
|
|
77
|
-
|
85
|
+
Returns
|
86
|
+
-------
|
87
|
+
str
|
88
|
+
The absolute path of the given relative path.
|
89
|
+
|
90
|
+
Examples
|
91
|
+
--------
|
92
|
+
>>> from pyloid.utils import get_absolute_path
|
93
|
+
>>> absolute_path = get_absolute_path("assets/icon.ico")
|
94
|
+
>>> print(absolute_path)
|
95
|
+
C:/Users/aaaap/Documents/pyloid/pyloid/assets/icon.ico
|
96
|
+
"""
|
97
|
+
return os.path.normpath(os.path.abspath(path))
|
78
98
|
|
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
|