Commit graph

2092 commits

Author SHA1 Message Date
Russell Greene
5c6e3bab04 rerun-if-env-changed=SLINT_GENERATED_INCLUDE_DIR
cargo currently doesn't know that we read this env var, which can lead to caching issues
2024-04-12 11:47:23 +02:00
Olivier Goffart
36669e8df7 esp-idf: redirect debug_log! to esp-println 2024-04-05 15:24:52 +02:00
Olivier Goffart
e2bfb9a513 esp-idf: fix gating of experimental feature
Commit 31219223e5 removed the optional,
but didn't remove the default argument
2024-04-04 15:43:34 +02:00
Olivier Goffart
80b59653a2 Janitor: Fix warnings with no_std and nightly rust 2024-04-04 14:03:36 +02:00
Chris Chinchilla
7afa34a7e1
Rename tutorial to quickstart (#4941) 2024-04-04 13:26:24 +02:00
Olivier Goffart
31219223e5 C++: Gate the line by line rendering behind experimental flag 2024-04-04 10:23:00 +02:00
Olivier Goffart
48d1b96441 esp-idf: cleanup the line_by_line rendering 2024-04-04 10:23:00 +02:00
Simon Hausmann
042bde7883 esp-idf: Add support for line-by-line rendering
Rendering by line into a line buffer that's in IRAM can be faster than accessing framebuffers in slower PSRAM, so offer this by allowing users
to omit even the initial framebuffer.
2024-04-04 10:23:00 +02:00
Francesco Cusolito
e8ce0cb5e5
C++: FilterModel with deferred filtering (#4984)
Avoids to invoke filtering function until FilterModel is completely constructed, deferring it to first model usage.
2024-04-02 09:03:07 +02:00
Olivier Goffart
fe38a1e97d C++: Fix and test the reset function on model adapter
They were causing infinite recursion because they were calling
themselves.

Also add the missing MapModel::reset

Yet another motivation for https://github.com/slint-ui/slint/issues/3888
as the code was mixing the `reset` function on the adapter meaning
"please re-apply the adapter filter/map/sort function" with the `reset`
function on Model which means "the subclass has changed and we should
notify listeners".

Fixes #4968
2024-03-28 11:11:57 +01:00
Olivier Goffart
fd4dcfc128
Update MSRV to 1.73
A MSRV update is required to update the image crate to 0.25, otherwise
we get link error that are ficed in newer version.
Also other dependency update such as env_logger needs a newer MSRV.

Update to 1.73 because it has functions like `with_borrow` on thread
storage which we already actually use in some platform.

This is also the last release before the the drop of macOs < 10.12
in Rust 1.74
2024-03-27 09:04:31 +01:00
ogoffart
6bf40989d9 Bump version number to 1.6.0 2024-03-27 07:49:22 +00:00
Simon Hausmann
68083243b2
Add an in-out boolean color-scheme property to Palette (#4701)
This allows applications to force dark/light mode, as well as determine
which mode is active.
2024-03-26 15:44:22 +01:00
Simon Hausmann
ed2816331e
Add support for raw-window-handle (#4918)
Add a `raw-window-handle-06` feature to the Rust API crates, which adds support for version 0.6 of rwh to slint::Window, by delegation adding a `window_handle()` function that returns a struct that implements the corresponding traits from rwh.

HasDisplayHandle could also be provided on the backend, but that can be
done separately if needed.

This is only implemented for the winit backend right now.

cc #877
2024-03-22 14:25:05 +01:00
Simon Hausmann
b988d6d198 esp-idf: poll for touch events if there's no touch interrupt assigned 2024-03-20 13:01:45 +01:00
ogoffart
20c570ab1d Bump version number to 1.5.1 2024-03-18 08:55:01 +00:00
Olivier Goffart
eb2cded6ba Android Docs: add a note that it works also with xbuild 2024-03-15 22:59:07 +01:00
Olivier Goffart
902de92229
Fix tests
The code snippet don't have a component and the test currently fails if there is no components.
2024-03-14 18:06:43 +01:00
Olivier Goffart
4dbdfa9e6a
Specify that code snippets uses the slint language 2024-03-14 17:41:30 +01:00
Tobias Hunger
28b96ca6f6 janitor: manual cargo clippy fixes
Semi-random selection of clippy topics that were
uncontroversial before:-).

Leaves about 84 deduplicated issues in the code base
according to clippy from nightly.
2024-03-14 13:42:38 +01:00
Olivier Goffart
f6d16ee1ef Update version in docs 2024-03-14 09:42:37 +01:00
Simon Hausmann
b1f408f683 Fix build of generated C++ code when using transitions on int properties with esp-idf
The energy monitor declares a transition on an animated int property,
for which Property<int>::set_animated_binding_for_transition is called,
which in turn calls slint_property_set_animated_binding_helper. The
latter is overloaded for various property types, such as float, Color,
or Brush, and then calls specialized functions from ffi, such as

slint_property_set_animated_binding_(int|float|etc.).

slint_property_set_animated_binding_int uses i32 in Rust, which cbindgen
maps to int32_t, so the
slint_property_set_animated_binding_helper overload also uses int32_t.

Unfortunately, with esp-idf, int32_t is a distinct type from int, and
the overload resolution fails.

As remedy, this change uses c_int instead of i32 in the Rust ffi, which
maps to int.

This seems easier than changing Property<int> to Property<int32_t> :-)
2024-03-12 20:25:00 +01:00
Olivier Goffart
80b2ac1375 Fix use of deprecated symbols
The toml_edit dependency is required for reading board_config.toml
2024-03-11 17:51:36 +01:00
Simon Hausmann
76ac137438 Fix build against esp32-p4
- Bump esp-backtrace for esp32-p4 support, which removes the uart feature and delegates to esp-println
- Added esp-println dependency
- Add mapping for ESP32P4 and other risc-v esp-idf targets to the corresponding rust target triplet.
  Unfortunately there's no generic pattern like for xtensa, as can be seen on
  https://github.com/esp-rs/esp-idf-sys?tab=readme-ov-file#examples
2024-03-11 17:49:15 +01:00
Simon Hausmann
e541053c6c Fix build against current esp-idf git
It looks like the esp_lcd_rgb_panel.h header file is not unconditionally
available anymore. Guard it with the same #ifdef that's surrounding the
calls to esp_lcd_rgb_panel_* and include the header that provides it.
2024-03-11 17:49:15 +01:00
Simon Hausmann
b83ace4e6d
Python: Fix MSRV 2024-03-08 15:21:30 +01:00
Simon Hausmann
efb626a54a
C++: Fix incorrectly documented minimum supported Rust version 2024-03-08 15:20:53 +01:00
Florian Blasius
2355234553 Fixed typo in python readme 2024-03-08 10:32:10 +01:00
Simon Hausmann
c1e8d7c07d Python: Add missing write-back support for Models
Ooops :-)
2024-03-07 19:48:48 +01:00
Simon Hausmann
cc83784de5 Python: Remove link to milestone 1
Instead refer to the remaining tickets for now.
2024-03-07 17:51:00 +01:00
Simon Hausmann
2234878453 Python: Use kwargs passed to the instance constructors
And set properties, like in JavaScript.
2024-03-07 17:49:00 +01:00
Simon Hausmann
a3b7a6da50 Python: Beef up the README with an API overview and a quickstart 2024-03-07 17:38:36 +01:00
Simon Hausmann
7c1c46e622 doc: Fix some typos in the Node.js README 2024-03-07 17:38:36 +01:00
Simon Hausmann
6a6b70185f From the Python README, refer to the printer demo instead of the tests. 2024-03-07 12:12:24 +01:00
Simon Hausmann
a93e2be393 Python: Add support for a @slint.callback decorator to conveniently associated callbacks with python methods
cc #4134
2024-03-07 12:00:08 +01:00
Simon Hausmann
77f0cd9eac Fix license header check for Pipfiles 2024-03-07 10:08:12 +01:00
Simon Hausmann
3b7b2411b4 Python: Add support for dynamic imports
```python
import foo_slint
```

will now also look for `foo.slint`
2024-03-07 10:08:12 +01:00
Simon Hausmann
176aa4bf72 Python: Make it possible to construct a ListModel from an iterable
Makes for a more pythonic API :)

cc #4135
2024-03-07 08:55:37 +01:00
Simon Hausmann
c83615cfb1 Python: Improve diagnostics when invoking a callback fails 2024-03-07 08:33:45 +01:00
Wilston Oreo
bef532b5fc
Optional C++ namespaces (#4759)
Co-authored-by: Michael Winkelmann <michael@winkelmann.site>
2024-03-06 19:43:11 +01:00
Simon Hausmann
bdab1050f0 Python: Fix setters getters for properties/callacks
Make sure to capture the global/callback/property name correctly in
the closures.
2024-03-06 18:55:59 +01:00
Simon Hausmann
a29cc4ddf2 Python: Don't panic when invoking a python callback fails
Instead, log a message and return.
2024-03-06 18:55:23 +01: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
b075fa8acd Python: Expose Timer and TimerMode 2024-03-06 17:22:27 +01:00
Simon Hausmann
14b371beff Python: Expose the Model and ListModel in slint 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
3c9b57ecf8 Python: Create a property type wrapper for component instances
Map properties and callbacks to attributes with getters and setters.

cc #4134
2024-03-06 17:20:30 +01:00
Simon Hausmann
765c773b90 Python: rework the load_file API, part 2
Take arguments for configuring style, etc., throw an exception on errors, and log warning diagnostics.
2024-03-06 13:10:54 +01:00
Simon Hausmann
280f314eeb Python: Rework the load_file API, part 1
Return a namespace that contains a "class type" for
constructing the component instance - similar to the Node.js
API.
2024-03-06 13:10:54 +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