Commit graph

171 commits

Author SHA1 Message Date
Simon Hausmann
7f4be51ad5 core: tidy up re-export of tr
Only export the one item we need, the Translator trait.
2025-09-29 12:50:22 +02:00
Simon Hausmann
2b68bc3cba Python: Document what PyGettextTranslator holds 2025-09-29 12:50:22 +02:00
Simon Hausmann
60d8897c8c core: re-export the tr crate when the tr feature is activated 2025-09-29 12:50:22 +02:00
Simon Hausmann
2bbe5e8786 Python: Added support for run-time translations from .slint files
Fixes #7956
2025-09-29 12:50:22 +02:00
Simon Hausmann
024cd63900 Python: Extend Timer docs with an example how to avoid garbage collection and thus stopped timer
Fixes #9429
2025-09-24 16:56:45 +02:00
Simon Hausmann
a159c15edd Python: Fix event loop terminating too early when the main coro finishes 2025-09-19 10:55:17 +02:00
Simon Hausmann
797f8f6469 Python: Improve exception handling for the coroutine passed to slint.run_event_loop()
Some checks are pending
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / python_test (windows-2022) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
If an exception is thrown, propagate it. Otherwise it becomes difficult to debug...

cc #4137
2025-09-19 10:10:19 +02:00
Simon Hausmann
ea0e3c1372 Python: Initial support for asyncio
The API is minimal at this point: `slint.run_event_loop()` takes an
optional coroutine parameter, that's run. As the loop is run, an
asyncio event loop (as per asyncio.get_event_loop()) is active, which
maps socket operations to smol's Async adapter and polls them within the
Slint event loop.

cc #4137
2025-09-19 08:23:34 +02:00
Simon Hausmann
855cd0df14 Python: Add support for invoke_from_event_loop
Fixes #4203
2025-09-19 08:23:34 +02:00
Simon Hausmann
c404d60516 Python: Add support for sys.exit() from callbacks/timers/etc.
Instead of printing exceptions in callbacks to stderr, let's raise them as unraisable exceptions, but catch SystemExit and forward it through the event loop.

Fixes #9416
2025-09-15 13:42:46 +02:00
Simon Hausmann
66376bee18 Python: Upgrade to Pyo3 0.26 2025-09-15 12:21:28 +02:00
ogoffart
f2aa4899db Bump version number to 1.14.0 2025-09-11 14:01:14 +00:00
ogoffart
09e397f3ba Bump version number to 1.13.1 2025-09-08 09:43:17 +00:00
Simon Hausmann
c1831158fa Python: Add support for importing foreign image buffers
ChangeLog: [Python] Add support for creating slint.Image objects from arrays

Fixes #9014
2025-08-01 16:08:09 +02:00
Simon Hausmann
917c9a8c6a Python: Run mypy type checker on the slint compiler
Some checks failed
CI / cpp_test_driver (windows-2022) (push) Has been cancelled
CI / wasm_demo (push) Has been cancelled
CI / cpp_cmake (macos-14, 1.85) (push) Has been cancelled
CI / cpp_cmake (ubuntu-22.04, stable) (push) Has been cancelled
CI / cpp_cmake (windows-2022, nightly) (push) Has been cancelled
CI / cpp_package_test (push) Has been cancelled
CI / tree-sitter (push) Has been cancelled
CI / vsce_build_test (push) Has been cancelled
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Has been cancelled
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Has been cancelled
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Has been cancelled
CI / build_and_test (ubuntu-22.04, nightly) (push) Has been cancelled
CI / node_test (macos-14) (push) Has been cancelled
CI / node_test (ubuntu-22.04) (push) Has been cancelled
CI / node_test (windows-2022) (push) Has been cancelled
CI / python_test (macos-14) (push) Has been cancelled
CI / python_test (ubuntu-22.04) (push) Has been cancelled
CI / python_test (windows-2022) (push) Has been cancelled
CI / cpp_test_driver (macos-13) (push) Has been cancelled
CI / cpp_test_driver (ubuntu-22.04) (push) Has been cancelled
CI / android (push) Has been cancelled
CI / miri (push) Has been cancelled
CI / test-figma-inspector (push) Has been cancelled
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Has been cancelled
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Has been cancelled
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Has been cancelled
CI / mcu-embassy (push) Has been cancelled
CI / updater_test (0.3.0) (push) Has been cancelled
CI / fmt_test (push) Has been cancelled
CI / esp-idf-quick (push) Has been cancelled
2025-07-11 14:45:43 +02:00
Simon Hausmann
89c1497880 Python: Add missing project fields and fix version number for slint-compiler wrapper 2025-07-11 14:44:38 +02:00
Simon Hausmann
75052fb902 Python: Add wrapper for Slint Compiler
This permits invoking the Slint compiler conveniently via `uvx
slint-compiler` or `pipx slint-compiler`.

cc #4136
2025-07-11 14:07:56 +02:00
Simon Hausmann
82ae731fcb Python: Add support for enums
Support for enums is three-fold:

- Enums are dynamically created by invoking `enum.Enum("NameOfEnum",
  [("Variant1", "Variant1"), ("Variant2", "Variant2"), ...])` and the
  exposed in the module (next to structs).
- They're converted back to `Value::EnumerationValue(enum_name,
  enum_value)` by checking if a supplied value is an instance of
  `enum.Enum` and then querying the name and `__class__.name` fields.
- When coverting a `Value::EnumerationValue` to Python, the hard work
  begins: We now pass along a TypeCollection through all phases of the
  type conversion, which knows about the enums created earlier and tries
  to locate the correct type class and then variant.

Fixes #5828
2025-07-08 14:35:44 +02:00
Simon Hausmann
14e1ae3bc0 Python: Simplified IntoPyObject for SlintToPyValue
Avoid some clones as the conversion is consuming anyway.
2025-07-08 14:35:44 +02:00
Simon Hausmann
94018778c9 Python: Separate PyValue into PyToSlintValue and SlintToPyValue
For the latter, in the future, we need additional book-keeping.
2025-07-08 14:35:44 +02:00
ogoffart
9cc24ff284 Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
Simon Hausmann
4aae1aa3af Initial import of Briefcase plugin 2025-06-25 20:43:09 +02:00
Simon Hausmann
86befbe769 Python: Make space for additional python modules
Move Slint module into sub-directory under api/python
2025-06-25 20:43:09 +02:00
Simon Hausmann
acbe8b67ed Python: Use a beta suffix instead of alpha to reflect the beta nature of the port 2025-06-24 22:07:00 +02:00
ogoffart
92f9f0e85d Bump version number to 1.12.1 2025-06-16 13:32:39 +00:00
Simon Hausmann
3e26e4ef7a Python: Bump stub-gen version
Some checks are pending
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / files-changed (push) Waiting to run
CI / build_and_test (--exclude bevy-example, ubuntu-22.04, 1.82) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, --exclude bevy-example, windows-2022, 1.82) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.82) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
2025-06-08 09:24:44 +00:00
Simon Hausmann
6e4e98af4e Python: Fix device architecture 2025-05-21 10:57:33 +02:00
Simon Hausmann
5046d02ae8 Python: Remove unnecessary maturin run-time dependency 2025-05-20 19:59:04 +02:00
Simon Hausmann
97a8ff66c1 Python: Fix ios wheel tags to match what warehouse accepts 2025-05-20 17:39:32 +02:00
Simon Hausmann
1d533641b4 Python: Fix name of helper method 2025-05-16 17:15:57 +02:00
Simon Hausmann
b1f0e5fe81 Python: Remove unused PyValueRef type 2025-05-16 17:15:57 +02:00
Simon Hausmann
d4439231eb Python: Upgrade to Pyo3 0.25 2025-05-16 17:15:57 +02:00
ogoffart
e0099ea500 Bump version number to 1.12.0 2025-04-30 13:27:50 +00:00
Simon Hausmann
a50b8f8793
FemtoVG: Add support for WGPU based rendering (#8268)
Enable via the `renderer-femtovg-wgpu` feature flag.

cc #171
2025-04-25 14:37:32 +02:00
Simon Hausmann
7c02bbd833
Python: Fix doc link 2025-04-23 21:40:48 +02:00
autofix-ci[bot]
8fcc320bdd [autofix.ci] apply automated fixes 2025-04-22 22:30:32 +02:00
Kavindra Palaraja
41366cf272 Python: Minor improvements to API descriptions 2025-04-22 22:30:32 +02:00
autofix-ci[bot]
c0bdfa7169 [autofix.ci] apply automated fixes 2025-04-22 22:30:32 +02:00
Kavindra Palaraja
cafa43ff22 Minor updates to the documentation for readability and polish 2025-04-22 22:30:32 +02:00
Simon Hausmann
5dc8410f0a Python: Fix mis-rendering 2025-04-22 16:24:21 +02:00
Simon Hausmann
9ce290b706 Python: Remove empty building from source section as well as trying out section
The latter is not very useful on our website, and we typically don't do this with the intros for other languages.
2025-04-22 16:17:27 +02:00
Simon Hausmann
ae50fcde8a Take the Python API out of alpha to beta 2025-04-22 14:02:45 +02:00
Olivier Goffart
78a3757b7f
Remormat all the toml file again to fix npm upload
Commit cd6f2e2 reformated the .toml, but the 80 char width column is
judged too small to be practical

Add a .taplo.toml file

Also do not split feature array
2025-04-09 15:06:00 +02:00
Simon Hausmann
826ad7a865 Upgrade to PyO3 0.24
The main change is that Rust paths are mapped to pathlib.Path, which changes our API (stricter).
2025-04-03 12:24:02 +02:00
Simon Hausmann
0c51f69b0a Upgrade to PyO3 0.23 2025-04-03 12:24:02 +02:00
Simon Hausmann
ad74c31ed4 Remove dependency on gil-refs feature
(which will be removed in future versions)
2025-04-03 12:24:02 +02:00
Simon Hausmann
9253af05b1 Upgrade to PyO3 0.22 2025-04-03 12:24:02 +02:00
Tobias Hunger
cd6f2e2cf2 ci: Format toml files
... using taplo with default settings

I tried this with 4 spaces indentation, but the patch is almost as
big as this one, so I went with default settings instead as that
is just easier:-)
2025-04-02 11:03:41 +02:00
Simon Hausmann
ed878f01ac Python: Add third-party licenses page to the docs
Fixes #6634
2025-03-29 18:04:30 +01:00
Simon Hausmann
ced9ae7b5f
Python: Fix rendering or callback decorator docs 2025-03-23 13:16:45 +01:00