mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add dialog actions
This commit is contained in:
parent
bac008296a
commit
8ba898e354
10 changed files with 115 additions and 3 deletions
|
@ -41,6 +41,15 @@ class ObjectContent(AstNode):
|
|||
for x in self.children:
|
||||
x.emit_xml(xml)
|
||||
|
||||
if self.parent.gir_class and self.parent.gir_class.assignable_to(self.root.gir.get_type("Dialog", "Gtk")):
|
||||
action_widgets = [widget for widget in self.children if hasattr(widget, "is_action_widget") and widget.is_action_widget]
|
||||
if len(action_widgets):
|
||||
xml.start_tag("action-widgets")
|
||||
for widget in action_widgets:
|
||||
widget.emit_action_widget(xml)
|
||||
xml.end_tag()
|
||||
|
||||
|
||||
class Object(AstNode):
|
||||
grammar: T.Any = [
|
||||
class_name,
|
||||
|
@ -48,6 +57,13 @@ class Object(AstNode):
|
|||
ObjectContent,
|
||||
]
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
if self.tokens["id"] is None:
|
||||
if hasattr(self.parent, "child_needs_id") and self.parent.child_needs_id:
|
||||
return self.unique_id
|
||||
return self.tokens["id"]
|
||||
|
||||
@validate("namespace")
|
||||
def gir_ns_exists(self):
|
||||
if not self.tokens["ignore_gir"]:
|
||||
|
@ -84,7 +100,7 @@ class Object(AstNode):
|
|||
def emit_xml(self, xml: XmlEmitter):
|
||||
xml.start_tag("object", **{
|
||||
"class": self.gir_class.glib_type_name if self.gir_class else self.tokens["class_name"],
|
||||
"id": self.tokens["id"],
|
||||
"id": self.id,
|
||||
})
|
||||
for child in self.children:
|
||||
child.emit_xml(xml)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue