Open dessant opened 10 years ago
The code below is a staring point to fix the issue. I did not check though if it'd work with templates. Also, if the list/dict is using a kv available keyword (e.g. root) it might still not work because at the point that we create the missing props, we have not initialized the idmap with those keywords.
diff --git a/kivy/lang.py b/kivy/lang.py
index 458cef4..d3c9c1f 100755
--- a/kivy/lang.py
+++ b/kivy/lang.py
@@ -224,7 +224,7 @@ Examples of valid statements are:
An example of a invalid statement:
.. code-block:: python
-
+
on_state:
if self.state == 'normal':
print('normal')
@@ -1032,7 +1032,12 @@ class ParserRule(object):
continue
value = self.properties[name].co_value
if type(value) is CodeType:
- value = None
+ idmap = copy(global_idmap)
+ idmap['self'] = widget.proxy_ref
+ try:
+ value = eval(value, idmap)
+ except:
+ value = None
widget.create_property(name, value)
def _forbid_selectors(self):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I have tested with values like True, False, None and a kivy widget class, other property types may be affected too.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.