mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Compare commits
8 commits
6d4e9dd59a
...
06d007a30a
Author | SHA1 | Date | |
---|---|---|---|
|
06d007a30a | ||
|
394014429e | ||
|
a4e0c3701b | ||
|
c1fbcef6d0 | ||
|
e07da3c339 | ||
|
2ae41020ab | ||
|
f48b840cfa | ||
|
9f9a2d94e0 |
5 changed files with 21 additions and 11 deletions
|
@ -225,12 +225,12 @@ class Flag(AstNode):
|
||||||
return self.tokens["value"]
|
return self.tokens["value"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def value(self) -> T.Optional[int]:
|
def value(self) -> T.Optional[str]:
|
||||||
type = self.context[ValueTypeCtx].value_type
|
type = self.context[ValueTypeCtx].value_type
|
||||||
if not isinstance(type, Enumeration):
|
if not isinstance(type, Enumeration):
|
||||||
return None
|
return None
|
||||||
elif member := type.members.get(self.name):
|
elif member := type.members.get(self.name):
|
||||||
return member.value
|
return member.nick
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -132,5 +132,8 @@ if __name__ == "__main__":
|
||||||
# print the sections to a json file
|
# print the sections to a json file
|
||||||
with open(outfile, "w") as f:
|
with open(outfile, "w") as f:
|
||||||
json.dump(
|
json.dump(
|
||||||
{name: section.to_json() for name, section in sections.items()}, f, indent=2
|
{name: section.to_json() for name, section in sections.items()},
|
||||||
|
f,
|
||||||
|
indent=2,
|
||||||
|
sort_keys=True,
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,7 +26,7 @@ Blueprint is a markup language and compiler for GTK 4 user interfaces.
|
||||||
|
|
||||||
using Gtk 4.0;
|
using Gtk 4.0;
|
||||||
|
|
||||||
template MyAppWindow : ApplicationWindow {
|
template $MyAppWindow: ApplicationWindow {
|
||||||
default-width: 600;
|
default-width: 600;
|
||||||
default-height: 300;
|
default-height: 300;
|
||||||
title: _("Hello, Blueprint!");
|
title: _("Hello, Blueprint!");
|
||||||
|
@ -35,7 +35,7 @@ Blueprint is a markup language and compiler for GTK 4 user interfaces.
|
||||||
HeaderBar {}
|
HeaderBar {}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
label: bind MyAppWindow.main_text;
|
label: bind template.main_text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,19 @@ blueprint-compiler works as a meson subproject.
|
||||||
|
|
||||||
.. code-block:: meson.build
|
.. code-block:: meson.build
|
||||||
|
|
||||||
blueprints = custom_target('blueprints',
|
blps = [
|
||||||
input: files(
|
|
||||||
# LIST YOUR BLUEPRINT FILES HERE
|
# LIST YOUR BLUEPRINT FILES HERE
|
||||||
),
|
]
|
||||||
output: '.',
|
|
||||||
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
|
uis = []
|
||||||
|
foreach blp : blps
|
||||||
|
uis += blp.replace('.blp', '.ui')
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
blueprints = custom_target('blueprints',
|
||||||
|
input: blps,
|
||||||
|
output: uis,
|
||||||
|
command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTDIR@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
|
||||||
)
|
)
|
||||||
|
|
||||||
#. In the same ``meson.build`` file, add this argument to your ``gnome.compile_resources`` command:
|
#. In the same ``meson.build`` file, add this argument to your ``gnome.compile_resources`` command:
|
||||||
|
|
|
@ -7,7 +7,7 @@ corresponding .blp file and regenerate this file with blueprint-compiler.
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk" version="4.0"/>
|
<requires lib="gtk" version="4.0"/>
|
||||||
<object class="GApplication">
|
<object class="GApplication">
|
||||||
<property name="flags">1|4</property>
|
<property name="flags">is-service|handles-open</property>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkEventControllerScroll">
|
<object class="GtkEventControllerScroll">
|
||||||
<property name="flags">1</property>
|
<property name="flags">1</property>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue