mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-06-22 23:19:25 -04:00
Builder list factory
This commit is contained in:
parent
0cf9a8e4fc
commit
a2fb86bc31
9 changed files with 98 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
|||
from .gtk_list_item_factory import ListItemFactory
|
||||
from .adw_message_dialog import Responses
|
||||
from .attributes import BaseAttribute, BaseTypedAttribute
|
||||
from .binding import Binding
|
||||
|
@ -57,6 +58,7 @@ OBJECT_CONTENT_HOOKS.children = [
|
|||
Widgets,
|
||||
Items,
|
||||
Strings,
|
||||
ListItemFactory,
|
||||
Responses,
|
||||
Child,
|
||||
]
|
||||
|
|
32
blueprintcompiler/language/gtk_list_item_factory.py
Normal file
32
blueprintcompiler/language/gtk_list_item_factory.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
from .gobject_object import ObjectContent, validate_parent_type
|
||||
from ..parse_tree import Keyword
|
||||
from ..ast_utils import AstNode, validate
|
||||
|
||||
|
||||
class ListItemFactory(AstNode):
|
||||
grammar = [Keyword("template"), ObjectContent]
|
||||
|
||||
@property
|
||||
def gir_class(self):
|
||||
return self.root.gir.get_type("ListItem", "Gtk")
|
||||
|
||||
@validate("template")
|
||||
def container_is_builder_list(self):
|
||||
validate_parent_type(
|
||||
self,
|
||||
"Gtk",
|
||||
"BuilderListItemFactory",
|
||||
"sub-templates",
|
||||
)
|
||||
|
||||
@property
|
||||
def content(self) -> ObjectContent:
|
||||
return self.children[ObjectContent][0]
|
||||
|
||||
@property
|
||||
def action_widgets(self):
|
||||
"""
|
||||
The sub-template shouldn't have it`s own actions this is
|
||||
just hear to satisfy XmlOutput._emit_object_or_template
|
||||
"""
|
||||
return None
|
Loading…
Add table
Add a link
Reference in a new issue