mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 05:44:52 +00:00
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.
This commit is contained in:
parent
86cde942b7
commit
0b6381d012
3 changed files with 15 additions and 5 deletions
|
@ -178,11 +178,15 @@ def _build_class(compdef):
|
|||
for global_name in compdef.globals:
|
||||
global_class = _build_global_class(compdef, global_name)
|
||||
|
||||
def global_getter(self):
|
||||
wrapper = global_class()
|
||||
setattr(wrapper, "__instance__", self.__instance__)
|
||||
return wrapper
|
||||
properties_and_callbacks[global_name] = property(global_getter)
|
||||
def mk_global(global_class):
|
||||
def global_getter(self):
|
||||
wrapper = global_class()
|
||||
setattr(wrapper, "__instance__", self.__instance__)
|
||||
return wrapper
|
||||
|
||||
return property(global_getter)
|
||||
|
||||
properties_and_callbacks[global_name] = mk_global(global_class)
|
||||
|
||||
return type("SlintClassWrapper", (Component,), properties_and_callbacks)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue