Commit graph

22 commits

Author SHA1 Message Date
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
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
Simon Hausmann
c111098e49 Python: Add more type stubs to the internal Rust API 2025-02-16 08:58:47 +00:00
Yuri Astrakhan
9621cae218 Auto-fixed clippy::needless_lifetimes
`__CARGO_FIX_YOLO=1` is a hack, but it does help a lot with the tedious fixes where the result is fairly clear.

See https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

```
__CARGO_FIX_YOLO=1 cargo clippy --fix --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::needless_lifetimes

cargo fmt --all
```
2025-02-07 09:20:49 +01:00
Yuri Astrakhan
4ae2627ade A few more format arg inlining
Used these commands and some manual searching

```
cargo clippy --fix  --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::uninlined_format_args
cargo clippy --all-targets -- -A clippy::all -W clippy::uninlined_format_args
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2025-02-07 06:43:19 +01:00
Simon Hausmann
1e3f05c983 Python: Expose Slint structs
Structs declared and exported in Slint are now available in the module namespace
with a constructor.

Fixes #5708
2024-08-13 12:04:04 +02:00
Simon Hausmann
e3aab79fdb Python: Improve Struct mapping
When reading, create the local equivalent of a dataclass, so that access
doesn't require ["foo"] key syntax.

Also implement the copy protocol, so that we can safely make clones of
the references returned by the ListModel.
2024-07-11 22:08:10 +02:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Simon Hausmann
6408eaf0ad Python: build against abi3 to support multiple Python versions
- Upgrade to pyo3 0.21 to enable timedelta for chrono
- Enable abi3 for multi-python support
2024-04-18 09:34:43 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Simon Hausmann
b87cd69f47 Python: Don't panic when unable to convert an interpreter data type to Python
Print a warning and return None instead
2024-03-06 17:22:27 +01:00
Simon Hausmann
3e66b98121 Python: Add support for assigning colors directly to brushes 2024-03-06 17:22:27 +01:00
Simon Hausmann
2f313f84ec Python: Initial support for implementing models in Python
This provides a Model base class in Python and sub-classes of that
can be set as data models in slint.

The ListModel is provided as basic sub-class operating on a list() and
allowing mutation and notifying the view on the Slint side.

Similarly, an array declared in Slint is exposed as an object to Python
that looks like a Model.

Both support the sequence protocol.

Fixes #4135
2024-03-05 15:45:52 +01:00
Simon Hausmann
80fda11e0f Python: Add bindings for Brush and Color
cc #4202
2024-03-01 17:17:44 +01:00
Simon Hausmann
93efd74e24 Add support for mapping image properties
This exposes a slint.Image class, which has a load_from_path class
method as well as size/width/height properties.

cc #4202
2024-02-23 16:05:07 +01:00
Simon Hausmann
b4cddbbe18 Python: Add support for converting structs
They map to Python dicts.

cc #4202
2024-02-02 22:15:52 +01:00
Simon Hausmann
08461d7b32 Convert None to Void correctly 2023-12-21 12:57:35 +01:00
Simon Hausmann
644ebbb2aa Split value conversion into a separate module 2023-12-21 12:57:35 +01:00