mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Compare commits
4 commits
c65239283c
...
373e998c3e
Author | SHA1 | Date | |
---|---|---|---|
|
373e998c3e | ||
|
cc09f3d3bb | ||
|
f93d5d2acd | ||
|
c683254761 |
5 changed files with 81 additions and 2 deletions
|
@ -39,8 +39,7 @@ LIBDIR = None
|
||||||
class BlueprintApp:
|
class BlueprintApp:
|
||||||
def main(self):
|
def main(self):
|
||||||
self.parser = argparse.ArgumentParser()
|
self.parser = argparse.ArgumentParser()
|
||||||
self.subparsers = self.parser.add_subparsers(metavar="command")
|
self.subparsers = self.parser.add_subparsers(metavar="command", required=True)
|
||||||
self.parser.set_defaults(func=self.cmd_help)
|
|
||||||
|
|
||||||
compile = self.add_subcommand(
|
compile = self.add_subcommand(
|
||||||
"compile", "Compile blueprint files", self.cmd_compile
|
"compile", "Compile blueprint files", self.cmd_compile
|
||||||
|
|
|
@ -73,6 +73,7 @@ class XmlEmitter:
|
||||||
self._needs_newline = False
|
self._needs_newline = False
|
||||||
|
|
||||||
def put_cdata(self, text: str):
|
def put_cdata(self, text: str):
|
||||||
|
text = text.replace("]]>", "]]]]><![CDATA[>")
|
||||||
self.result += f"<![CDATA[{text}]]>"
|
self.result += f"<![CDATA[{text}]]>"
|
||||||
self._needs_newline = False
|
self._needs_newline = False
|
||||||
|
|
||||||
|
|
17
tests/samples/list_factory_nested.blp
Normal file
17
tests/samples/list_factory_nested.blp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
Gtk.ListView {
|
||||||
|
factory: Gtk.BuilderListItemFactory list_item_factory {
|
||||||
|
template ListItem {
|
||||||
|
child: Gtk.ListView {
|
||||||
|
factory: Gtk.BuilderListItemFactory list_item_factory {
|
||||||
|
template ListItem {
|
||||||
|
child: Gtk.Label {
|
||||||
|
label: bind template.item as <$MyObject>.name;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
44
tests/samples/list_factory_nested.ui
Normal file
44
tests/samples/list_factory_nested.ui
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
DO NOT EDIT!
|
||||||
|
This file was @generated by blueprint-compiler. Instead, edit the
|
||||||
|
corresponding .blp file and regenerate this file with blueprint-compiler.
|
||||||
|
-->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk" version="4.0"/>
|
||||||
|
<object class="GtkListView">
|
||||||
|
<property name="factory">
|
||||||
|
<object class="GtkBuilderListItemFactory" id="list_item_factory">
|
||||||
|
<property name="bytes"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<template class="GtkListItem">
|
||||||
|
<property name="child">
|
||||||
|
<object class="GtkListView">
|
||||||
|
<property name="factory">
|
||||||
|
<object class="GtkBuilderListItemFactory" id="list_item_factory">
|
||||||
|
<property name="bytes"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<template class="GtkListItem">
|
||||||
|
<property name="child">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<binding name="label">
|
||||||
|
<lookup name="name" type="MyObject">
|
||||||
|
<lookup name="item" type="GtkListItem">
|
||||||
|
<constant>GtkListItem</constant>
|
||||||
|
</lookup>
|
||||||
|
</lookup>
|
||||||
|
</binding>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</template>
|
||||||
|
</interface>]]]]><![CDATA[></property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</template>
|
||||||
|
</interface>]]></property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
|
</interface>
|
18
tests/samples/list_factory_nested_dec.blp
Normal file
18
tests/samples/list_factory_nested_dec.blp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
factory: BuilderListItemFactory list_item_factory {
|
||||||
|
template ListItem {
|
||||||
|
child: ListView {
|
||||||
|
factory: BuilderListItemFactory list_item_factory {
|
||||||
|
template ListItem {
|
||||||
|
child: Label {
|
||||||
|
label: bind template.item as <$MyObject>.name;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue