mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
feat: add syntax for GtkDialog
's action widgets
This commit is contained in:
parent
cd12c94423
commit
736681a841
3 changed files with 175 additions and 0 deletions
|
@ -18,7 +18,10 @@
|
|||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
|
||||
from functools import cache
|
||||
|
||||
from .gobject_object import Object
|
||||
from .gtk_dialog import ResponseId
|
||||
from .common import *
|
||||
|
||||
|
||||
|
@ -28,11 +31,26 @@ class Child(AstNode):
|
|||
"[",
|
||||
Optional(["internal-child", UseLiteral("internal_child", True)]),
|
||||
UseIdent("child_type").expected("a child type"),
|
||||
Optional(ResponseId),
|
||||
"]",
|
||||
]),
|
||||
Object,
|
||||
]
|
||||
|
||||
@property
|
||||
@cache
|
||||
def response_id(self) -> T.Optional[ResponseId]:
|
||||
"""Get action widget's response ID.
|
||||
|
||||
If child is not action widget, returns `None`.
|
||||
"""
|
||||
response_ids = self.children[ResponseId]
|
||||
|
||||
if response_ids:
|
||||
return response_ids[0]
|
||||
else:
|
||||
return None
|
||||
|
||||
def emit_xml(self, xml: XmlEmitter):
|
||||
child_type = internal_child = None
|
||||
if self.tokens["internal_child"]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue