From f48b840cfa478d6bfeb6e16f24fd5b650c70e4f2 Mon Sep 17 00:00:00 2001 From: kotontrion Date: Wed, 20 Nov 2024 10:41:56 +0100 Subject: [PATCH 1/6] compile: fix flag values gtk builder does not support combining interger values with | in flags properties, so the short names are used instead. --- blueprintcompiler/language/values.py | 2 +- tests/samples/flags.ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blueprintcompiler/language/values.py b/blueprintcompiler/language/values.py index 63cf4fc..e060b65 100644 --- a/blueprintcompiler/language/values.py +++ b/blueprintcompiler/language/values.py @@ -216,7 +216,7 @@ class Flag(AstNode): if not isinstance(type, Enumeration): return None elif member := type.members.get(self.name): - return member.value + return member.name else: return None diff --git a/tests/samples/flags.ui b/tests/samples/flags.ui index 2f0a26e..d13c424 100644 --- a/tests/samples/flags.ui +++ b/tests/samples/flags.ui @@ -7,7 +7,7 @@ corresponding .blp file and regenerate this file with blueprint-compiler. - 1|4 + is_service|handles_open 1 From 2ae41020abfb04649e9791f57c84fc708d428283 Mon Sep 17 00:00:00 2001 From: kotontrion Date: Thu, 21 Nov 2024 09:28:40 +0100 Subject: [PATCH 2/6] Fix flag return value type --- blueprintcompiler/language/values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blueprintcompiler/language/values.py b/blueprintcompiler/language/values.py index e060b65..4cd600d 100644 --- a/blueprintcompiler/language/values.py +++ b/blueprintcompiler/language/values.py @@ -211,7 +211,7 @@ class Flag(AstNode): return self.tokens["value"] @property - def value(self) -> T.Optional[int]: + def value(self) -> T.Optional[str]: type = self.context[ValueTypeCtx].value_type if not isinstance(type, Enumeration): return None From e07da3c33946e7ab4afed9c564a9e7ae0b3fbbb8 Mon Sep 17 00:00:00 2001 From: kotontrion Date: Tue, 26 Nov 2024 10:52:37 +0100 Subject: [PATCH 3/6] flags: use nick instead of name --- blueprintcompiler/language/values.py | 2 +- tests/samples/flags.ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blueprintcompiler/language/values.py b/blueprintcompiler/language/values.py index 4cd600d..96787ee 100644 --- a/blueprintcompiler/language/values.py +++ b/blueprintcompiler/language/values.py @@ -216,7 +216,7 @@ class Flag(AstNode): if not isinstance(type, Enumeration): return None elif member := type.members.get(self.name): - return member.name + return member.nick else: return None diff --git a/tests/samples/flags.ui b/tests/samples/flags.ui index d13c424..44eb2c4 100644 --- a/tests/samples/flags.ui +++ b/tests/samples/flags.ui @@ -7,7 +7,7 @@ corresponding .blp file and regenerate this file with blueprint-compiler. - is_service|handles_open + is-service|handles-open 1 From a4e0c3701b1510191f72cc606c2fa20d97800444 Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Thu, 30 Jan 2025 19:23:40 +0000 Subject: [PATCH 4/6] docs: Update overview example using format and compile --- docs/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 34b942c..a71b968 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -26,7 +26,7 @@ Blueprint is a markup language and compiler for GTK 4 user interfaces. using Gtk 4.0; - template MyAppWindow : ApplicationWindow { + template $MyAppWindow: ApplicationWindow { default-width: 600; default-height: 300; title: _("Hello, Blueprint!"); @@ -35,7 +35,7 @@ Blueprint is a markup language and compiler for GTK 4 user interfaces. HeaderBar {} Label { - label: bind MyAppWindow.main_text; + label: bind template.main_text; } } From 394014429e819347d107eb5fa9fd2871bdb3d0ac Mon Sep 17 00:00:00 2001 From: Sertonix Date: Thu, 20 Mar 2025 10:52:57 +0000 Subject: [PATCH 5/6] Sort keys in collect-sections.py This makes sure that the reference_docs.json file is build reproducible. Ref https://reproducible-builds.org/ --- docs/collect-sections.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/collect-sections.py b/docs/collect-sections.py index e6227e7..07bc5f6 100755 --- a/docs/collect-sections.py +++ b/docs/collect-sections.py @@ -132,5 +132,8 @@ if __name__ == "__main__": # print the sections to a json file with open(outfile, "w") as f: 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, ) From fa3b84d61261867b40c3a9094b5ad51439be1746 Mon Sep 17 00:00:00 2001 From: Octavian Alexandru Butiu Date: Wed, 19 Mar 2025 22:14:24 +0200 Subject: [PATCH 6/6] port: Fix build error when building in a flatpak If you create a project with gnome builder and port it blueprint and try to build it in flatpak you will get a compiler error that /org/gnome/Example/window.ui. Setting the source_dir variable in meson fixes this. --- blueprintcompiler/interactive_port.py | 1 + 1 file changed, 1 insertion(+) diff --git a/blueprintcompiler/interactive_port.py b/blueprintcompiler/interactive_port.py index 0c37885..26d8e2a 100644 --- a/blueprintcompiler/interactive_port.py +++ b/blueprintcompiler/interactive_port.py @@ -266,6 +266,7 @@ blueprints = custom_target('blueprints', arguments in {Colors.UNDERLINE}{meson_file}{Colors.NO_UNDERLINE}:{Colors.CLEAR} dependencies: blueprints, +source_dir: meson.current_build_dir(), """ ) enter()