mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Separate output into its own module
This commit is contained in:
parent
8cf793023d
commit
a24f16109f
33 changed files with 407 additions and 291 deletions
|
@ -120,6 +120,14 @@ class ResponseId(AstNode):
|
|||
if widget.tokens["is_default"]:
|
||||
raise CompileError("Default response is already set")
|
||||
|
||||
@property
|
||||
def response_id(self) -> str:
|
||||
return self.tokens["response_id"]
|
||||
|
||||
@property
|
||||
def is_default(self) -> bool:
|
||||
return self.tokens["is_default"] or False
|
||||
|
||||
@property
|
||||
def widget_id(self) -> str:
|
||||
"""Get action widget ID."""
|
||||
|
@ -128,25 +136,3 @@ class ResponseId(AstNode):
|
|||
_object: Object = self.parent.children[Object][0]
|
||||
return _object.tokens["id"]
|
||||
|
||||
def emit_xml(self, xml: XmlEmitter) -> None:
|
||||
"""Emit nothing.
|
||||
|
||||
Response ID don't have to emit any XML in place,
|
||||
but have to emit action-widget tag in separate
|
||||
place (see `ResponseId.emit_action_widget`)
|
||||
"""
|
||||
|
||||
def emit_action_widget(self, xml: XmlEmitter) -> None:
|
||||
"""Emit action-widget XML.
|
||||
|
||||
Must be called while <action-widgets> tag is open.
|
||||
|
||||
For more details see `GtkDialog` and `GtkInfoBar` docs.
|
||||
"""
|
||||
xml.start_tag(
|
||||
"action-widget",
|
||||
response=self.tokens["response_id"],
|
||||
default=self.tokens["is_default"]
|
||||
)
|
||||
xml.put_text(self.widget_id)
|
||||
xml.end_tag()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue