mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Fix simple bindings with template soure
This commit is contained in:
parent
8f3682135b
commit
e4bad039b0
4 changed files with 23 additions and 1 deletions
|
@ -114,7 +114,16 @@ class XmlOutput(OutputFormat):
|
|||
|
||||
elif isinstance(value, Binding):
|
||||
if simple := value.simple_binding:
|
||||
props["bind-source"] = simple.source
|
||||
if (
|
||||
simple.source == "template"
|
||||
and value.context[ScopeCtx].template is not None
|
||||
):
|
||||
props["bind-source"] = value.context[
|
||||
ScopeCtx
|
||||
].template.gir_class.glib_type_name
|
||||
else:
|
||||
props["bind-source"] = simple.source
|
||||
|
||||
props["bind-property"] = simple.property_name
|
||||
props["bind-flags"] = "sync-create"
|
||||
xml.put_self_closing("property", **props)
|
||||
|
|
5
tests/samples/template_simple_binding.blp
Normal file
5
tests/samples/template_simple_binding.blp
Normal file
|
@ -0,0 +1,5 @@
|
|||
using Gtk 4.0;
|
||||
|
||||
template $MyTemplate {
|
||||
prop: bind template.prop2;
|
||||
}
|
7
tests/samples/template_simple_binding.ui
Normal file
7
tests/samples/template_simple_binding.ui
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<template class="MyTemplate">
|
||||
<property name="prop" bind-source="MyTemplate" bind-property="prop2" bind-flags="sync-create"/>
|
||||
</template>
|
||||
</interface>
|
|
@ -178,6 +178,7 @@ class TestSamples(unittest.TestCase):
|
|||
"template_binding",
|
||||
"template_binding_extern",
|
||||
"template_no_parent",
|
||||
"template_simple_binding",
|
||||
"typeof",
|
||||
"unchecked_class",
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue