pyloid 0.23.6__tar.gz → 0.23.8__tar.gz
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-0.23.6 → pyloid-0.23.8}/PKG-INFO +1 -1
- {pyloid-0.23.6 → pyloid-0.23.8}/pyproject.toml +1 -1
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/browser_window.py +11 -5
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/utils.py +32 -12
- {pyloid-0.23.6 → pyloid-0.23.8}/LICENSE +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/README.md +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/__init__.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/api.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/autostart.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/custom/titlebar.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/filewatcher.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/js_api/base.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/js_api/event_api.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/js_api/window_api.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/monitor.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/pyloid.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/rpc.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/serve.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/store.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/thread_pool.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/timer.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/tray.py +0 -0
- {pyloid-0.23.6 → pyloid-0.23.8}/src/pyloid/url_interceptor.py +0 -0
@@ -1211,7 +1211,9 @@ class _BrowserWindow:
|
|
1211
1211
|
|
1212
1212
|
(JavaScript)
|
1213
1213
|
```javascript
|
1214
|
-
|
1214
|
+
import { event } from 'pyloid-js';
|
1215
|
+
|
1216
|
+
event.listen('customEvent', (data) => {
|
1215
1217
|
console.log(data.message);
|
1216
1218
|
});
|
1217
1219
|
```
|
@@ -2113,7 +2115,7 @@ class BrowserWindow(QObject):
|
|
2113
2115
|
result = self._window.remove_shortcut(params["key_sequence"])
|
2114
2116
|
elif command_type == "get_all_shortcuts":
|
2115
2117
|
result = self._window.get_all_shortcuts()
|
2116
|
-
elif command_type == "
|
2118
|
+
elif command_type == "invoke":
|
2117
2119
|
event_name = params["event_name"]
|
2118
2120
|
data = params.get("data")
|
2119
2121
|
result = self._window.invoke(event_name, data)
|
@@ -2668,9 +2670,13 @@ class BrowserWindow(QObject):
|
|
2668
2670
|
>>> window.invoke("customEvent", {"message": "Hello, Pyloid!"})
|
2669
2671
|
|
2670
2672
|
(JavaScript)
|
2671
|
-
|
2672
|
-
|
2673
|
-
|
2673
|
+
```javascript
|
2674
|
+
import { event } from 'pyloid-js';
|
2675
|
+
|
2676
|
+
event.listen('customEvent', (data) => {
|
2677
|
+
console.log(data.message);
|
2678
|
+
});
|
2679
|
+
```
|
2674
2680
|
"""
|
2675
2681
|
return self.execute_command("invoke", {"event_name": event_name, "data": data})
|
2676
2682
|
|
@@ -7,23 +7,43 @@ import socket
|
|
7
7
|
|
8
8
|
def get_production_path(path: Optional[str] = None) -> Optional[str]:
|
9
9
|
"""
|
10
|
-
|
11
|
-
|
10
|
+
Constructs the absolute path to a resource file, adjusting based on the execution environment.
|
11
|
+
|
12
|
+
In a production environment (e.g., when packaged with PyInstaller or Nuitka),
|
13
|
+
it prepends the application's base directory (sys._MEIPASS for PyInstaller,
|
14
|
+
or the directory of the executable for Nuitka) to the provided relative path.
|
15
|
+
If no path is provided, it returns the base path itself.
|
16
|
+
|
17
|
+
If not running in a production environment (e.g., during development as a regular
|
18
|
+
Python script), it simply returns the provided path as is. If no path is provided,
|
19
|
+
it returns None in a non-production environment.
|
20
|
+
|
21
|
+
Parameters
|
22
|
+
----------
|
23
|
+
path : Optional[str], optional
|
24
|
+
The relative path to the resource file from the application's root directory.
|
25
|
+
Defaults to None.
|
12
26
|
|
13
27
|
Returns
|
14
28
|
-------
|
15
|
-
str
|
16
|
-
The path to the resource
|
17
|
-
|
29
|
+
Optional[str]
|
30
|
+
- If in production: The absolute path to the resource file (or the base path if `path` is None).
|
31
|
+
- If not in production: The original `path` value passed to the function.
|
18
32
|
|
19
33
|
Examples
|
20
34
|
--------
|
21
|
-
>>>
|
22
|
-
>>>
|
23
|
-
|
24
|
-
>>>
|
25
|
-
|
26
|
-
|
35
|
+
>>> # Assume running NOT in production
|
36
|
+
>>> get_production_path("assets/icon.ico")
|
37
|
+
'assets/icon.ico'
|
38
|
+
>>> get_production_path()
|
39
|
+
None
|
40
|
+
|
41
|
+
>>> # Assume running IN production (e.g., PyInstaller bundle)
|
42
|
+
>>> # where sys._MEIPASS might be '/tmp/_MEIabcde'
|
43
|
+
>>> get_production_path("assets/icon.ico") # doctest: +SKIP
|
44
|
+
'/tmp/_MEIabcde/assets/icon.ico'
|
45
|
+
>>> get_production_path() # doctest: +SKIP
|
46
|
+
'/tmp/_MEIabcde'
|
27
47
|
"""
|
28
48
|
if is_production():
|
29
49
|
if hasattr(sys, '_MEIPASS'):
|
@@ -40,7 +60,7 @@ def get_production_path(path: Optional[str] = None) -> Optional[str]:
|
|
40
60
|
|
41
61
|
return os.path.join(base_path, path) if path else base_path
|
42
62
|
else:
|
43
|
-
return
|
63
|
+
return path
|
44
64
|
|
45
65
|
|
46
66
|
def is_production() -> bool:
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|