pyloid 0.12.2__tar.gz → 0.12.3__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyloid
3
- Version: 0.12.2
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
- # set icon
71
- if (is_production()):
72
- app.set_icon(os.path.join(get_production_path(), "icons/icon.png"))
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.
@@ -50,114 +50,15 @@ Package URL: [https://pypi.org/project/pyloid/](https://pypi.org/project/pyloid/
50
50
  ```python
51
51
  from pyloid import Pyloid
52
52
 
53
- app = Pyloid(single_instance=True)
53
+ app = Pyloid(app_name="Pyloid-App", single_instance=True)
54
54
 
55
- # set icon
56
- if (is_production()):
57
- app.set_icon(os.path.join(get_production_path(), "icons/icon.png"))
58
- else:
59
- app.set_icon("src-pyloid/icons/icon.png")
60
-
61
- # create window
62
- window = app.create_window(
63
- title="Pyloid Browser",
64
- js_apis=[CustomAPI()],
65
- dev_tools=True
66
- )
67
-
68
- window.set_size(800, 600)
69
-
70
- # load html
71
- if (is_production()):
72
- window.set_dev_tools(False)
73
- window.load_file(os.path.join(get_production_path(), "src/index.html"))
74
- else:
75
- window.load_file("src/index.html")
76
-
77
- # show window
78
- window.show_and_focus()
55
+ win = app.create_window("pyloid-example")
56
+ win.load_url("https://www.example.com")
57
+ win.show_and_focus()
79
58
 
80
59
  app.run()
81
60
  ```
82
61
 
83
- ### Setting Up System Tray
84
-
85
- ```python
86
- from pyloid import TrayEvent
87
-
88
- def on_double_click():
89
- print("Tray icon was double-clicked.")
90
-
91
- app.set_tray_actions({
92
- TrayEvent.DoubleClick: on_double_click,
93
- })
94
- app.set_tray_menu_items([
95
- {"label": "Show Window", "callback": app.show_main_window},
96
- {"label": "Quit", "callback": app.quit},
97
- ])
98
- app.setup_tray()
99
- ```
100
-
101
- ```javascript
102
- // CustomAPI method usage example
103
- document.addEventListener('pyloidReady', function () {
104
- // Using the echo method
105
- window.pyloid.CustomAPI.echo('Hello', 42).then((result) => {
106
- console.log(result); // "Message received in Python: Hello, 42" output
107
- });
108
-
109
- // Using the getAppVersion method
110
- window.pyloid.CustomAPI.getAppVersion().then((version) => {
111
- console.log('App version:', version); // "App version: 1.0.0" output
112
- });
113
-
114
- // Example using async/await syntax
115
- async function useCustomAPI() {
116
- const echoResult = await window.pyloid.CustomAPI.echo('Test', 100);
117
- console.log(echoResult);
118
-
119
- const appVersion = await window.pyloid.CustomAPI.getAppVersion();
120
- console.log('Current app version:', appVersion);
121
- }
122
-
123
- useCustomAPI();
124
-
125
- // Button click event binding
126
- document.getElementById('myButton').addEventListener('click', function () {
127
- // Using the create_window method
128
- window.pyloid.CustomAPI.create_window().then((windowId) => {
129
- console.log('New window ID:', windowId); // "New window ID: [generated window ID]" output
130
- });
131
- });
132
- });
133
- ```
134
-
135
- ### Using React
136
-
137
- ```javascript
138
- import { StrictMode } from 'react';
139
- import { createRoot } from 'react-dom/client';
140
- import App from './App.jsx';
141
- import './index.css';
142
-
143
- document.addEventListener('pyloidReady', function () {
144
- createRoot(document.getElementById('root')).render(
145
- <StrictMode>
146
- <App />
147
- </StrictMode>
148
- );
149
- });
150
-
151
- function App() {
152
- console.log('Pyloid is ready');
153
-
154
- window.pyloid.CustomAPI.getAppVersion().then((version) => {
155
- console.log('App version:', version); // "App version: 1.0.0"
156
- });
157
- return <h1>Hello World</h1>;
158
- }
159
- ```
160
-
161
62
  ## License 📄
162
63
 
163
64
  This project is licensed under the terms of the Apache License 2.0. See the [LICENSE](./LICENSE) file for details.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyloid"
3
- version = "0.12.2"
3
+ version = "0.12.3"
4
4
  description = ""
5
5
  authors = ["aesthetics-of-record <111675679+aesthetics-of-record@users.noreply.github.com>"]
6
6
  readme = "README.md"
@@ -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
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes