pyloid 0.12.2__py3-none-any.whl → 0.12.3__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/pyloid.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyloid
|
3
|
-
Version: 0.12.
|
3
|
+
Version: 0.12.3
|
4
4
|
Summary:
|
5
5
|
Author: aesthetics-of-record
|
6
6
|
Author-email: 111675679+aesthetics-of-record@users.noreply.github.com
|
@@ -65,114 +65,15 @@ Package URL: [https://pypi.org/project/pyloid/](https://pypi.org/project/pyloid/
|
|
65
65
|
```python
|
66
66
|
from pyloid import Pyloid
|
67
67
|
|
68
|
-
app = Pyloid(single_instance=True)
|
68
|
+
app = Pyloid(app_name="Pyloid-App", single_instance=True)
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
else:
|
74
|
-
app.set_icon("src-pyloid/icons/icon.png")
|
75
|
-
|
76
|
-
# create window
|
77
|
-
window = app.create_window(
|
78
|
-
title="Pyloid Browser",
|
79
|
-
js_apis=[CustomAPI()],
|
80
|
-
dev_tools=True
|
81
|
-
)
|
82
|
-
|
83
|
-
window.set_size(800, 600)
|
84
|
-
|
85
|
-
# load html
|
86
|
-
if (is_production()):
|
87
|
-
window.set_dev_tools(False)
|
88
|
-
window.load_file(os.path.join(get_production_path(), "src/index.html"))
|
89
|
-
else:
|
90
|
-
window.load_file("src/index.html")
|
91
|
-
|
92
|
-
# show window
|
93
|
-
window.show_and_focus()
|
70
|
+
win = app.create_window("pyloid-example")
|
71
|
+
win.load_url("https://www.example.com")
|
72
|
+
win.show_and_focus()
|
94
73
|
|
95
74
|
app.run()
|
96
75
|
```
|
97
76
|
|
98
|
-
### Setting Up System Tray
|
99
|
-
|
100
|
-
```python
|
101
|
-
from pyloid import TrayEvent
|
102
|
-
|
103
|
-
def on_double_click():
|
104
|
-
print("Tray icon was double-clicked.")
|
105
|
-
|
106
|
-
app.set_tray_actions({
|
107
|
-
TrayEvent.DoubleClick: on_double_click,
|
108
|
-
})
|
109
|
-
app.set_tray_menu_items([
|
110
|
-
{"label": "Show Window", "callback": app.show_main_window},
|
111
|
-
{"label": "Quit", "callback": app.quit},
|
112
|
-
])
|
113
|
-
app.setup_tray()
|
114
|
-
```
|
115
|
-
|
116
|
-
```javascript
|
117
|
-
// CustomAPI method usage example
|
118
|
-
document.addEventListener('pyloidReady', function () {
|
119
|
-
// Using the echo method
|
120
|
-
window.pyloid.CustomAPI.echo('Hello', 42).then((result) => {
|
121
|
-
console.log(result); // "Message received in Python: Hello, 42" output
|
122
|
-
});
|
123
|
-
|
124
|
-
// Using the getAppVersion method
|
125
|
-
window.pyloid.CustomAPI.getAppVersion().then((version) => {
|
126
|
-
console.log('App version:', version); // "App version: 1.0.0" output
|
127
|
-
});
|
128
|
-
|
129
|
-
// Example using async/await syntax
|
130
|
-
async function useCustomAPI() {
|
131
|
-
const echoResult = await window.pyloid.CustomAPI.echo('Test', 100);
|
132
|
-
console.log(echoResult);
|
133
|
-
|
134
|
-
const appVersion = await window.pyloid.CustomAPI.getAppVersion();
|
135
|
-
console.log('Current app version:', appVersion);
|
136
|
-
}
|
137
|
-
|
138
|
-
useCustomAPI();
|
139
|
-
|
140
|
-
// Button click event binding
|
141
|
-
document.getElementById('myButton').addEventListener('click', function () {
|
142
|
-
// Using the create_window method
|
143
|
-
window.pyloid.CustomAPI.create_window().then((windowId) => {
|
144
|
-
console.log('New window ID:', windowId); // "New window ID: [generated window ID]" output
|
145
|
-
});
|
146
|
-
});
|
147
|
-
});
|
148
|
-
```
|
149
|
-
|
150
|
-
### Using React
|
151
|
-
|
152
|
-
```javascript
|
153
|
-
import { StrictMode } from 'react';
|
154
|
-
import { createRoot } from 'react-dom/client';
|
155
|
-
import App from './App.jsx';
|
156
|
-
import './index.css';
|
157
|
-
|
158
|
-
document.addEventListener('pyloidReady', function () {
|
159
|
-
createRoot(document.getElementById('root')).render(
|
160
|
-
<StrictMode>
|
161
|
-
<App />
|
162
|
-
</StrictMode>
|
163
|
-
);
|
164
|
-
});
|
165
|
-
|
166
|
-
function App() {
|
167
|
-
console.log('Pyloid is ready');
|
168
|
-
|
169
|
-
window.pyloid.CustomAPI.getAppVersion().then((version) => {
|
170
|
-
console.log('App version:', version); // "App version: 1.0.0"
|
171
|
-
});
|
172
|
-
return <h1>Hello World</h1>;
|
173
|
-
}
|
174
|
-
```
|
175
|
-
|
176
77
|
## License 📄
|
177
78
|
|
178
79
|
This project is licensed under the terms of the Apache License 2.0. See the [LICENSE](./LICENSE) file for details.
|
@@ -4,11 +4,11 @@ pyloid/autostart.py,sha256=K7DQYl4LHItvPp0bt1V9WwaaZmVSTeGvadkcwG-KKrI,3899
|
|
4
4
|
pyloid/custom/titlebar.py,sha256=itzK9pJbZMQ7BKca9kdbuHMffurrw15UijR6OU03Xsk,3894
|
5
5
|
pyloid/filewatcher.py,sha256=n8N56D65le5TpsgxXb7z-FO_0lqv4UYD4yGq_UuMrAs,1285
|
6
6
|
pyloid/monitor.py,sha256=fqDnZ_7dpxVZLVJ5gCluDRY2USrQ5YL_fw1AnYivhsk,12741
|
7
|
-
pyloid/pyloid.py,sha256=
|
7
|
+
pyloid/pyloid.py,sha256=ys4E_N0GfyGNojuu8CWWPDhiMKkvDSuhJp0bs15blpw,48951
|
8
8
|
pyloid/timer.py,sha256=1bYhqte3rV77vaeMUkcTgmx2ux7FtCqLCx9lIC2-COg,4360
|
9
9
|
pyloid/tray.py,sha256=rXgdkvzGxtie_EIcTSA7fjuta4nJk5THhNkGFcfv5Ew,634
|
10
10
|
pyloid/utils.py,sha256=DQerZWU_0o8dHcJ5y3yXf9i5OXn7KQZqU-hVBq3uPUA,711
|
11
|
-
pyloid-0.12.
|
12
|
-
pyloid-0.12.
|
13
|
-
pyloid-0.12.
|
14
|
-
pyloid-0.12.
|
11
|
+
pyloid-0.12.3.dist-info/LICENSE,sha256=F96EzotgWhhpnQTW2TcdoqrMDir1jyEo6H915tGQ-QE,11524
|
12
|
+
pyloid-0.12.3.dist-info/METADATA,sha256=amquaqi785YfODU_sVSFzAvS2xA7hyaGoAKXVGDtS80,3634
|
13
|
+
pyloid-0.12.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
14
|
+
pyloid-0.12.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|