Commit graph

152 commits

Author SHA1 Message Date
Simon Hausmann
c111098e49 Python: Add more type stubs to the internal Rust API 2025-02-16 08:58:47 +00:00
Simon Hausmann
2d89d6b666 Python: move rust originated types into dedicated .pyi file
That way annotations from __init__.py will get used, instead of
ignored because of the existence of __init__.pyi.
2025-02-12 08:48:45 +01:00
Simon Hausmann
3b367dcc0b Python: Include @slint.callback in the doc reference
(Docs to be written)

- Also fix eq signature and avoid Self to fix links and mypy
2025-02-11 20:57:45 +01:00
Simon Hausmann
5564972e82
Doc wrong Code fence and work around pdoc bug
It seems that with two subsequent fences the second one isn’t rendered.
2025-02-09 20:51:00 +01:00
Simon Hausmann
ddfb18b3cc
doc: fix bullet numbering 2025-02-09 20:32:21 +01:00
Simon Hausmann
94c655731f
Add Python typings for Rust declared types (#7575)
This comes with a bump of the Python version to 3.11
due to the need for typing.Self.
2025-02-09 16:06:34 +01:00
Simon Hausmann
30aefd4957 Python: Some Image docs 2025-02-09 13:50:26 +01:00
Simon Hausmann
c46846b3cb
Switch Python tooling over from pipenv to uv (#7574)
It's faster and easier to use.
2025-02-09 12:09:23 +01:00
Simon Hausmann
74f1674c57 Python: Make the re-exported classes show up property in the documentation
The variable assignment trick doesn't work for pdoc. Instead, fix the name properly and import them as re-export cleanly.
2025-02-09 00:04:30 +01:00
Simon Hausmann
08fc503f68 Add scaffolding for Python API docs 2025-02-09 00:04:30 +01: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
ogoffart
c83af3ca5c Bump version number to 1.10.0 2025-01-13 13:38:41 +00:00
Olivier Goffart
3e94bd2167 Janitor: Remove trailing whitespaces from all files
`git grep -I -l -O'sed -i "s/[[:space:]]*$//"' -e ''`
2025-01-10 13:23:22 +01:00
ogoffart
f309a551b5 Bump version number to 1.9.2 2024-12-30 10:18:16 +00:00
aurindam
dc3f29b6da Bump version number to 1.9.1 2024-12-19 12:57:19 +00:00
Simon Hausmann
1888e58735 Add API to set the XDG app id
ChangeLog: Added function to set the XDG app id on Wayland/X11. This needs to be added with respective function names in the language sections.

Fixes #1332
2024-11-22 11:24:06 +01:00
Milian Wolff
69c68b22b2 Also wrap langtype::Type::Struct in an Rc
This makes copying such types much cheaper and will allow us to
intern common struct types in the future too. This further
drops the sample cost for langtype.rs from ~6.6% down to 4.0%.

We are now also able to share/intern common struct types.

Before:
```
  Time (mean ± σ):      1.073 s ±  0.021 s    [User: 0.759 s, System: 0.215 s]
  Range (min … max):    1.034 s …  1.105 s    10 runs

        allocations:            3074261
```

After:
```
  Time (mean ± σ):      1.034 s ±  0.026 s    [User: 0.733 s, System: 0.201 s]
  Range (min … max):    1.000 s …  1.078 s    10 runs

        allocations:            2917476
```
2024-10-28 09:39:54 +01:00
Simon Hausmann
a98d4709be Move printer demo and energy-monitor into new top-level demos/ folder
These are showing off use-cases for Slint, but they're not examples showing individual Slint features.

Also removed the old printerdemo while at it.
2024-10-25 12:09:32 +02:00
ogoffart
eb273a63ee Bump version number to 1.9.0 2024-09-25 11:49:15 +00:00
Enyium
9894eca229 Fixed kebab casing of previous appwindow.slint. 2024-09-20 10:26:49 +02:00
Simon Hausmann
844590cac8
Python: Add support for snake case imports (#6229)
When using slint.loader.app_window.XXX look for "app_window.slint" followed by "app-window.slint".

Fixes #6216
2024-09-20 10:25:14 +02:00
ogoffart
4dd7d96a28 Bump version number to 1.8.0 2024-08-15 12:44:46 +00:00
Simon Hausmann
636de6fc7c Python: Fix support for named exports 2024-08-13 12:04:04 +02: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
833883b028 Python: Fix Slint file loading in callback examples
The foo_slint import has been replaced with the auto-loader.
2024-08-11 10:27:18 +02:00
ogoffart
bbf7edc5a3 Bump version number to 1.7.2 2024-08-09 09:52:17 +00:00
Simon Hausmann
ef92c1a161 Python: reset alpha version tag 2024-07-23 15:16:30 +02:00
ogoffart
aa25e3cd44 Bump version number to 1.7.1 2024-07-23 12:05:34 +00:00
Simon Hausmann
e36eb6aba6 Document behaviour of globals when exporting multiple components
Fixes #5467
2024-07-18 13:43:13 +02:00
Simon Hausmann
6ddd4d0e04 Bump Python Alpha version 2024-07-17 11:32:19 +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
Simon Hausmann
0b6381d012 Python: Fix access to globals when there's more than one
The getter for the global didn't capture the correct global_class,
just the last iteration.

This fixes the broken printer demo.
2024-07-11 22:00:39 +02:00
Simon Hausmann
0c7d2062a5 Python: Add support for exporting multiple components 2024-07-02 10:52:22 +02:00
Simon Hausmann
624796d53e Python: Make the timer test more robust
It seems that with the latest winit, quit_event_loop() might take a little longer and the timer fires once more. We don't really care how long quit_event_loop() takes in this test, merely that the timer firest and that we can terminate the loop.

Fixes #5484
2024-06-27 09:58:14 +02:00
Simon Hausmann
f3ed569592
Bump Python package alpha version 2024-06-21 20:17:18 +02:00
Simon Hausmann
3be6e641c6 Python: Attempt to build python packages with the same features as the nodejs/tool/etc. binaries 2024-06-18 09:43:37 -07:00
Simon Hausmann
b98035526b Python: Add the ability to invoke functions declared in Slint from Python 2024-06-05 14:06:10 -07:00
Simon Hausmann
b9052ecf8a
Bump Python alpha tag 2024-06-05 11:00:25 -07:00
Simon Hausmann
e0c0e8d09c
Python: reset alpha version suffix 2024-06-04 13:59:49 -07:00
ogoffart
3a6e34ba45 Bump version number to 1.7.0 2024-06-04 20:34:29 +00:00
Tobias Hunger
d9224cd58f janitor: Use more workspace dependencies 2024-06-04 14:58:29 +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
9b00b31618
Python: bump version after alpha upload for seeking-feedback post 2024-05-03 08:07:53 +02:00
Simon Hausmann
f7c2e3a4c0
Python: bump alpha version so that next release will upload 2024-05-02 18:57:27 +02:00
Simon Hausmann
5cfd8e8c03 Fix Python build 2024-04-24 10:00:52 +02:00
Simon Hausmann
3c3b2ecb5a doc: highlight the function of the auto-loader once more in the python README 2024-04-19 09:19:59 +02:00
Simon Hausmann
f86f4993fa Python: Replace import magic with an auto-loader
As discussed on Reddit, the magic import logic is not very tool friendly and a little too magic perhaps. Instead, this patch introduces an automatic loader (`slint.loader`), which can traverse `sys.path` and lazily load `.slint` files by attribute lookup.

Closes #4856
2024-04-18 16:04:20 +02:00
Simon Hausmann
93307707cd doc: Replace the use of a git pip install with an installation from pypi 2024-04-18 15:55:46 +02:00