proton-gui 2.0.0__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.
- proton_gui-2.0.0/LICENSE +21 -0
- proton_gui-2.0.0/PKG-INFO +130 -0
- proton_gui-2.0.0/README.md +105 -0
- proton_gui-2.0.0/proton/__init__.py +6 -0
- proton_gui-2.0.0/proton/app.py +454 -0
- proton_gui-2.0.0/proton/browser.py +132 -0
- proton_gui-2.0.0/proton/server.py +255 -0
- proton_gui-2.0.0/proton/static/main.js +230 -0
- proton_gui-2.0.0/proton/window.py +222 -0
- proton_gui-2.0.0/proton_gui.egg-info/PKG-INFO +130 -0
- proton_gui-2.0.0/proton_gui.egg-info/SOURCES.txt +15 -0
- proton_gui-2.0.0/proton_gui.egg-info/dependency_links.txt +1 -0
- proton_gui-2.0.0/proton_gui.egg-info/requires.txt +7 -0
- proton_gui-2.0.0/proton_gui.egg-info/top_level.txt +1 -0
- proton_gui-2.0.0/pyproject.toml +45 -0
- proton_gui-2.0.0/setup.cfg +4 -0
- proton_gui-2.0.0/tests/test_proton.py +189 -0
proton_gui-2.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022-2026 Osmar Jr and Proton contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: proton-gui
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Build desktop-style Python interfaces with HTML and a Chromium app window.
|
|
5
|
+
Author: Osmar Jr
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/osmarsjunior/proton
|
|
8
|
+
Project-URL: Issues, https://github.com/osmarsjunior/proton/issues
|
|
9
|
+
Keywords: gui,python-gui,html,chromium,websocket,desktop,desktop-app,electron-alternative,eel-alternative,pywebview-alternative,cross-platform,webview,ui
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
17
|
+
Requires-Python: >=3.8
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: websockets>=10.1
|
|
21
|
+
Requires-Dist: pygetwindow>=0.0.9; sys_platform == "win32"
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest; extra == "dev"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
<p align="center"><img src="docs/assets/logo.png" alt="Proton logo" width="120"></p>
|
|
27
|
+
|
|
28
|
+
# Proton
|
|
29
|
+
|
|
30
|
+
**Build desktop-style Python interfaces with plain HTML.** Proton opens your HTML page in a
|
|
31
|
+
Chromium-based browser window (app mode, no tabs or address bar) and connects it to Python
|
|
32
|
+
through a local WebSocket, so you can read and change the page from your code.
|
|
33
|
+
|
|
34
|
+
🇧🇷 [Leia em português](README.pt-BR.md) · 📚 [API reference](docs/api.md) · 🏗️ [Architecture](docs/architecture.md) · 🤝 [Contributing](CONTRIBUTING.md) · 🗺️ [Roadmap](ROADMAP.md)
|
|
35
|
+
|
|
36
|
+
> Looking for a lightweight **Electron alternative for Python**, or an alternative to **Eel** / **pywebview**?
|
|
37
|
+
> Proton lets you write a desktop GUI in HTML/CSS/JS and drive it from Python over a local WebSocket.
|
|
38
|
+
|
|
39
|
+
<p align="center"><img src="docs/assets/demo.gif" alt="Proton demo: Python code filling in a login form" width="375"></p>
|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- Lightweight: ~30 MB for Python + ~10 MB for the window; no bundled browser engine.
|
|
44
|
+
- Works on **Windows, Linux and macOS** with Chrome, Chromium, Edge, Brave or Vivaldi.
|
|
45
|
+
- Read/write any element by `id`: text, values, checkboxes, radios, forms, any property.
|
|
46
|
+
- Page → Python events (`signal`) and Python → page function calls.
|
|
47
|
+
- Local-only and authenticated: loopback ports, random token, no `eval`.
|
|
48
|
+
- No logo/URL flash on start: the window stays off-screen until the page and title are ready (Windows).
|
|
49
|
+
- Debug mode (`debug=1`): right-click → **Inspect**, F12 and DevTools shortcuts enabled.
|
|
50
|
+
- No temp HTML files: pages are served by a small built-in HTTP server and the bridge script is injected automatically.
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git clone https://github.com/osmarsjunior/proton.git
|
|
56
|
+
cd proton
|
|
57
|
+
pip install -e .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Requirements: Python 3.8+ and one Chromium-based browser installed.
|
|
61
|
+
|
|
62
|
+
**Linux extras (optional):** `sudo apt install xdotool wmctrl` enables `resize()`, `move()`,
|
|
63
|
+
`maximize()` and `minimize()` on X11. Without them everything else still works.
|
|
64
|
+
|
|
65
|
+
Use `PROTON_BROWSER=/path/to/browser` to choose a specific browser.
|
|
66
|
+
|
|
67
|
+
## Quick start
|
|
68
|
+
|
|
69
|
+
`index.html`
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
<html height="300" width="320">
|
|
73
|
+
<body>
|
|
74
|
+
<form id="form">
|
|
75
|
+
<input id="user" name="user" placeholder="User">
|
|
76
|
+
<button type="button" onclick="send(JSON.stringify({action: 'login', user: user.value}))">Login</button>
|
|
77
|
+
</form>
|
|
78
|
+
<p id="status"></p>
|
|
79
|
+
</body>
|
|
80
|
+
</html>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`app.py`
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from proton import Proton
|
|
87
|
+
|
|
88
|
+
app = Proton("index.html", init_size=(320, 300))
|
|
89
|
+
|
|
90
|
+
def on_login(data):
|
|
91
|
+
app.set_text_by_id("status", "Welcome, " + data["user"])
|
|
92
|
+
|
|
93
|
+
app.signal("login", on_login) # runs when the page sends {"action": "login", ...}
|
|
94
|
+
app.start() # blocks until the window is closed
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
A fuller example lives in [examples/basic](examples/basic) (`python examples/basic/main.py`).
|
|
98
|
+
|
|
99
|
+
## Debugging
|
|
100
|
+
|
|
101
|
+
`Proton("index.html", debug=1)` enables verbose logs, keeps the native right-click menu (**Inspect**), unblocks F12 /
|
|
102
|
+
Ctrl shortcuts and prevents the window from closing when the connection drops. Without debug, those are disabled so the app feels native.
|
|
103
|
+
|
|
104
|
+
## HTML tips
|
|
105
|
+
|
|
106
|
+
- Put pages and assets in the same folder (or below) as the first HTML file: it is the web root.
|
|
107
|
+
- Use `type="button"` on form buttons and identify elements with `id`.
|
|
108
|
+
- Don't use `<a href>` for navigation; use `new_page()` from Python.
|
|
109
|
+
- Reserved JavaScript names: `send`, `processa`, `encerra`, `getFormData`, `proton`.
|
|
110
|
+
- Fix the window size with `<html width="300" height="400">`.
|
|
111
|
+
|
|
112
|
+
## Upgrading from v1
|
|
113
|
+
|
|
114
|
+
The v1 camelCase methods (`setTextById`, `getValueById`, …) still work as aliases. Changes to be aware of:
|
|
115
|
+
`proton.py` became the `proton` package, `janela` is now `window`, `checkId(text, id)` is now
|
|
116
|
+
`check_id(id, checked=True)` (the old call still works), and `start(*args)` is `start(func, *args)`.
|
|
117
|
+
See the [changelog](CHANGELOG.md).
|
|
118
|
+
|
|
119
|
+
## Roadmap
|
|
120
|
+
|
|
121
|
+
A self-contained runtime (system WebView / CEF / Node-based shell, Electron-style) is planned — see [ROADMAP.md](ROADMAP.md).
|
|
122
|
+
|
|
123
|
+
## Contributing
|
|
124
|
+
|
|
125
|
+
Contributions of every size are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
126
|
+
Please follow the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
[MIT](LICENSE) © Osmar Jr and Proton contributors. Free to use, modify and distribute.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<p align="center"><img src="docs/assets/logo.png" alt="Proton logo" width="120"></p>
|
|
2
|
+
|
|
3
|
+
# Proton
|
|
4
|
+
|
|
5
|
+
**Build desktop-style Python interfaces with plain HTML.** Proton opens your HTML page in a
|
|
6
|
+
Chromium-based browser window (app mode, no tabs or address bar) and connects it to Python
|
|
7
|
+
through a local WebSocket, so you can read and change the page from your code.
|
|
8
|
+
|
|
9
|
+
🇧🇷 [Leia em português](README.pt-BR.md) · 📚 [API reference](docs/api.md) · 🏗️ [Architecture](docs/architecture.md) · 🤝 [Contributing](CONTRIBUTING.md) · 🗺️ [Roadmap](ROADMAP.md)
|
|
10
|
+
|
|
11
|
+
> Looking for a lightweight **Electron alternative for Python**, or an alternative to **Eel** / **pywebview**?
|
|
12
|
+
> Proton lets you write a desktop GUI in HTML/CSS/JS and drive it from Python over a local WebSocket.
|
|
13
|
+
|
|
14
|
+
<p align="center"><img src="docs/assets/demo.gif" alt="Proton demo: Python code filling in a login form" width="375"></p>
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- Lightweight: ~30 MB for Python + ~10 MB for the window; no bundled browser engine.
|
|
19
|
+
- Works on **Windows, Linux and macOS** with Chrome, Chromium, Edge, Brave or Vivaldi.
|
|
20
|
+
- Read/write any element by `id`: text, values, checkboxes, radios, forms, any property.
|
|
21
|
+
- Page → Python events (`signal`) and Python → page function calls.
|
|
22
|
+
- Local-only and authenticated: loopback ports, random token, no `eval`.
|
|
23
|
+
- No logo/URL flash on start: the window stays off-screen until the page and title are ready (Windows).
|
|
24
|
+
- Debug mode (`debug=1`): right-click → **Inspect**, F12 and DevTools shortcuts enabled.
|
|
25
|
+
- No temp HTML files: pages are served by a small built-in HTTP server and the bridge script is injected automatically.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
git clone https://github.com/osmarsjunior/proton.git
|
|
31
|
+
cd proton
|
|
32
|
+
pip install -e .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Requirements: Python 3.8+ and one Chromium-based browser installed.
|
|
36
|
+
|
|
37
|
+
**Linux extras (optional):** `sudo apt install xdotool wmctrl` enables `resize()`, `move()`,
|
|
38
|
+
`maximize()` and `minimize()` on X11. Without them everything else still works.
|
|
39
|
+
|
|
40
|
+
Use `PROTON_BROWSER=/path/to/browser` to choose a specific browser.
|
|
41
|
+
|
|
42
|
+
## Quick start
|
|
43
|
+
|
|
44
|
+
`index.html`
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<html height="300" width="320">
|
|
48
|
+
<body>
|
|
49
|
+
<form id="form">
|
|
50
|
+
<input id="user" name="user" placeholder="User">
|
|
51
|
+
<button type="button" onclick="send(JSON.stringify({action: 'login', user: user.value}))">Login</button>
|
|
52
|
+
</form>
|
|
53
|
+
<p id="status"></p>
|
|
54
|
+
</body>
|
|
55
|
+
</html>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`app.py`
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from proton import Proton
|
|
62
|
+
|
|
63
|
+
app = Proton("index.html", init_size=(320, 300))
|
|
64
|
+
|
|
65
|
+
def on_login(data):
|
|
66
|
+
app.set_text_by_id("status", "Welcome, " + data["user"])
|
|
67
|
+
|
|
68
|
+
app.signal("login", on_login) # runs when the page sends {"action": "login", ...}
|
|
69
|
+
app.start() # blocks until the window is closed
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
A fuller example lives in [examples/basic](examples/basic) (`python examples/basic/main.py`).
|
|
73
|
+
|
|
74
|
+
## Debugging
|
|
75
|
+
|
|
76
|
+
`Proton("index.html", debug=1)` enables verbose logs, keeps the native right-click menu (**Inspect**), unblocks F12 /
|
|
77
|
+
Ctrl shortcuts and prevents the window from closing when the connection drops. Without debug, those are disabled so the app feels native.
|
|
78
|
+
|
|
79
|
+
## HTML tips
|
|
80
|
+
|
|
81
|
+
- Put pages and assets in the same folder (or below) as the first HTML file: it is the web root.
|
|
82
|
+
- Use `type="button"` on form buttons and identify elements with `id`.
|
|
83
|
+
- Don't use `<a href>` for navigation; use `new_page()` from Python.
|
|
84
|
+
- Reserved JavaScript names: `send`, `processa`, `encerra`, `getFormData`, `proton`.
|
|
85
|
+
- Fix the window size with `<html width="300" height="400">`.
|
|
86
|
+
|
|
87
|
+
## Upgrading from v1
|
|
88
|
+
|
|
89
|
+
The v1 camelCase methods (`setTextById`, `getValueById`, …) still work as aliases. Changes to be aware of:
|
|
90
|
+
`proton.py` became the `proton` package, `janela` is now `window`, `checkId(text, id)` is now
|
|
91
|
+
`check_id(id, checked=True)` (the old call still works), and `start(*args)` is `start(func, *args)`.
|
|
92
|
+
See the [changelog](CHANGELOG.md).
|
|
93
|
+
|
|
94
|
+
## Roadmap
|
|
95
|
+
|
|
96
|
+
A self-contained runtime (system WebView / CEF / Node-based shell, Electron-style) is planned — see [ROADMAP.md](ROADMAP.md).
|
|
97
|
+
|
|
98
|
+
## Contributing
|
|
99
|
+
|
|
100
|
+
Contributions of every size are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
101
|
+
Please follow the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
[MIT](LICENSE) © Osmar Jr and Proton contributors. Free to use, modify and distribute.
|