pyloid 0.12.1__py3-none-any.whl → 0.12.3__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
pyloid/pyloid.py
CHANGED
@@ -760,7 +760,7 @@ class BrowserWindow:
|
|
760
760
|
return self._window.isVisible()
|
761
761
|
|
762
762
|
def set_resizable(self, resizable: bool):
|
763
|
-
"""
|
763
|
+
"""Sets the resizability of the window."""
|
764
764
|
self.resizable = resizable
|
765
765
|
if resizable:
|
766
766
|
self._window.setWindowFlags(
|
@@ -790,6 +790,9 @@ class Pyloid(QApplication):
|
|
790
790
|
self.windows = []
|
791
791
|
self.server = None
|
792
792
|
|
793
|
+
self.app_name = app_name
|
794
|
+
self.icon = None
|
795
|
+
|
793
796
|
self.clipboard_class = self.clipboard()
|
794
797
|
self.shortcuts = {}
|
795
798
|
|
@@ -898,14 +901,14 @@ class Pyloid(QApplication):
|
|
898
901
|
def _init_single_instance(self):
|
899
902
|
"""Initializes the application as a single instance."""
|
900
903
|
socket = QLocalSocket()
|
901
|
-
socket.connectToServer(
|
904
|
+
socket.connectToServer(self.app_name)
|
902
905
|
if socket.waitForConnected(500):
|
903
906
|
# Another instance is already running
|
904
907
|
sys.exit(1)
|
905
908
|
|
906
909
|
# Create a new server
|
907
910
|
self.server = QLocalServer()
|
908
|
-
self.server.listen(
|
911
|
+
self.server.listen(self.app_name)
|
909
912
|
self.server.newConnection.connect(self._handle_new_connection)
|
910
913
|
|
911
914
|
def _handle_new_connection(self):
|
@@ -198,4 +198,4 @@ Apache License
|
|
198
198
|
distributed under the License is distributed on an "AS IS" BASIS,
|
199
199
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
200
|
See the License for the specific language governing permissions and
|
201
|
-
limitations under the License.
|
201
|
+
limitations under the License.
|
@@ -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
|