Commit graph

152 commits

Author SHA1 Message Date
Simon Hausmann
97940ee7b8 Python: Mention installation via pip and sort prerequisites
cc #4138
2024-04-18 13:44:20 +02:00
Simon Hausmann
382967603f Python: Correct minimum Python version in published categories
Also removed console
2024-04-18 11:15:21 +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
Simon Hausmann
1cb57a4505 Python: Try to use maturin-action to build wheels
... to allow cross-compilation and manylinux packaging
2024-04-17 14:15:21 +02:00
Simon Hausmann
b5cde20255 Python: bump version for pypi upload 2024-04-17 09:14:21 +02:00
Simon Hausmann
e4017a3e41 Python: Some pre for PyPI uploads
- Add classifiers and other meta-data
- Add alpha suffix for version (to be kept until removed manually)
2024-04-16 17:44:37 +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
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
ogoffart
20c570ab1d Bump version number to 1.5.1 2024-03-18 08:55:01 +00: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
Simon Hausmann
b83ace4e6d
Python: Fix MSRV 2024-03-08 15:21:30 +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
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
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
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
Simon Hausmann
1b17fe3c1d Python: Fix GC support for callbacks
Make the references to the callbacks visible to the GC
to be able to break cycles.
2024-03-04 15:42:37 +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
ogoffart
a0eed4e58e Bump version number to 1.5.0 2024-02-20 17:33:11 +00: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
ogoffart
fec2b961db Bump version number to 1.4.1 2024-02-01 09:12:42 +00:00
Simon Hausmann
5d3ad7b252 Python: Fix venv setup
A subtly missing letter :)
2024-01-31 17:04:06 +01:00
Simon Hausmann
d1529af3cc python: hide native module behind python front-end API
Encapsulate the rust code behind a public API (in __init__.py for now)
2023-12-21 12:57:35 +01:00
Simon Hausmann
07c168bbf9 python: Clean up Cargo.toml
Remove unused dependencies and fetch needed ones from the workspace. We'll sort out the substituation with crates.io dependencies later when packaging.
2023-12-21 12:57:35 +01:00
Simon Hausmann
2c6af79104 Add a barebones README 2023-12-21 12:57:35 +01:00
Simon Hausmann
fb76502cf4 Run python tests without capturing stderr/stdout
... so that we can see backtraces
2023-12-21 12:57:35 +01:00
Simon Hausmann
33a1d07226 Add support for timers and run/quit_event_loop 2023-12-21 12:57:35 +01:00
Simon Hausmann
e4785220ef Add a little test for manual trying :) 2023-12-21 12:57:35 +01:00
Simon Hausmann
08461d7b32 Convert None to Void correctly 2023-12-21 12:57:35 +01:00
Simon Hausmann
82c2728cfd Add show/hide/run to component instance 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
Simon Hausmann
10d6aa199c Split errors out into a separate module 2023-12-21 12:57:35 +01:00