slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.73k stars 614 forks source link

python : thread '<unnamed>' panicked at api/python/timer.rs:47:36 #5708

Closed Ss789 closed 3 months ago

Ss789 commented 4 months ago

python : 3.10.11 slint : 1.7.1 a4 mac OS 12.7.5

Run printdemo and then add print, scan, and copy tasks, and after waiting for some time, the following error will appear:

thread '' panicked at api/python/timer.rs:47:36: unexpected failure running python timer callback: PyErr { type: <class 'AttributeError'>, value: AttributeError("'dict' object has no attribute 'progress'"), traceback: Some(<traceback object at 0x104c3a300>) } note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

tronical commented 4 months ago

Thanks, I can reproduce it. Appending a dict to the model that's supposed to hold structs does indeed not work. We need to expose the printer queue item struct for that to work correctly, i.e .changing printer_queue.append({...dict}) with printer_queue.append(slint.loader.ui.printerdemo.PrinterQueueItem(status="waiting", ...)).