Python: Create a property type wrapper for component instances

Map properties and callbacks to attributes with getters and setters.

cc #4134
This commit is contained in:
Simon Hausmann 2024-03-06 14:35:00 +01:00 committed by Simon Hausmann
parent 6d2144deb1
commit 3c9b57ecf8
4 changed files with 130 additions and 6 deletions

View file

@ -166,6 +166,6 @@ if __name__ == "__main__":
module = slint.load_file(
"../../examples/printerdemo/ui/printerdemo.slint")
instance = module.MainWindow()
instance.set_global_callback(
"PrinterQueue", "start-job", lambda title: print(f"new print job {title}"))
instance.PrinterQueue.start_job = lambda title: print(
f"new print job {title}")
instance.run()