mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
parent
3bdcc83c4e
commit
32d4769f65
4 changed files with 14 additions and 13 deletions
|
@ -249,13 +249,13 @@ def decompile_property(ctx, gir, name, cdata, bind_source=None, bind_property=No
|
|||
ctx.end_block_with(";")
|
||||
elif bind_source:
|
||||
flags = ""
|
||||
if bind_flags:
|
||||
if "sync-create" in bind_flags:
|
||||
flags += " sync-create"
|
||||
if "invert-boolean" in bind_flags:
|
||||
flags += " inverted"
|
||||
if "bidirectional" in bind_flags:
|
||||
flags += " bidirectional"
|
||||
bind_flags = bind_flags or []
|
||||
if "sync-create" not in bind_flags:
|
||||
flags += " no-sync-create"
|
||||
if "invert-boolean" in bind_flags:
|
||||
flags += " inverted"
|
||||
if "bidirectional" in bind_flags:
|
||||
flags += " bidirectional"
|
||||
ctx.print(f"{name}: bind {bind_source}.{bind_property}{flags};")
|
||||
elif truthy(translatable):
|
||||
if context is not None:
|
||||
|
|
|
@ -34,7 +34,8 @@ class Property(AstNode):
|
|||
".",
|
||||
UseIdent("bind_property").expected("a property name to bind from"),
|
||||
ZeroOrMore(AnyOf(
|
||||
["sync-create", UseLiteral("sync_create", True)],
|
||||
"sync-create",
|
||||
["no-sync-create", UseLiteral("no_sync_create", True)],
|
||||
["inverted", UseLiteral("inverted", True)],
|
||||
["bidirectional", UseLiteral("bidirectional", True)],
|
||||
)),
|
||||
|
@ -109,7 +110,7 @@ class Property(AstNode):
|
|||
value = values[0] if len(values) == 1 else None
|
||||
|
||||
bind_flags = []
|
||||
if self.tokens["sync_create"]:
|
||||
if self.tokens["bind_source"] and not self.tokens["no_sync_create"]:
|
||||
bind_flags.append("sync-create")
|
||||
if self.tokens["inverted"]:
|
||||
bind_flags.append("invert-boolean")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue