@@ -69,7 +69,14 @@ def _create_field(self, label_text: str, field: dict):
6969 label = label_text ,
7070 halign = Gtk .Align .START ,
7171 )
72- if field_type != "check" :
72+
73+ if field_type == "label" :
74+ if "style" in field :
75+ style_list = field .get ("style" )
76+ for style in style_list :
77+ label .add_css_class (style )
78+
79+ if field_type != "check" and field_type != "picture" :
7380 row .append (label )
7481
7582 if field_type == "entry" :
@@ -103,9 +110,28 @@ def _create_field(self, label_text: str, field: dict):
103110 row .append (widget )
104111 elif field_type == "label" :
105112 return row , None
113+ elif field_type == "picture" :
114+ widget = Gtk .Picture .new_for_resource (field .get ("uri" ))
115+ widget .set_halign (3 )
116+ widget .set_valign (3 )
117+ widget .set_hexpand (True )
118+ widget .set_vexpand (True )
119+ widget .can_shrink = True
120+ width = field .get ("width" )
121+ height = field .get ("height" )
122+ widget .set_size_request (width , height )
123+ widget .set_content_fit (Gtk .ContentFit .CONTAIN )
124+ widget .set_margin_top (10 )
125+ widget .set_margin_bottom (10 )
126+ row .append (widget )
106127 else :
107128 return None , None
108129
130+ if "style" in field :
131+ style_list = field .get ("style" )
132+ for style in style_list :
133+ label .add_css_class (style )
134+
109135 return row , widget
110136
111137 @Gtk .Template .Callback ()
0 commit comments