Repository navigation
Skin Example
Examples from the Cockpit skins for the three constructs of ZAML — for, table and list (see Authoring in ZAML) — each with what the compiler makes of it, a whole screen built from a table and lists, and why most screens can be built that way.
The screen of TVMagazineCockpit:

Its ZAML source uses two loops for its 2 x 6 repeating elements: six prime time cells and six event lists.
screen:
backgroundColor: "panelBG"
flags: "wfNoBorder"
name: "TVMagazineCockpit"
position: "center,center"
resolution: "1920,1080"
size: "1920,1080"
children:
- xmlinc:
file: "screenpart_TitleBar"
- widget:
font: "$md_label_medium"
halign: "right"
name: "day_selector"
position: "1490,15"
size: "420,26"
transparent: "1"
valign: "center"
zPosition: "2"
- for:
var: "$i"
range: [0, 5]
body:
- xmlinc:
file: "screenpart_PrimeCell"
index: "$i"
position: "$i*$screen_width/6,0"
- for:
var: "$i"
range: [0, 5]
body:
- widget:
backgroundColorSelected: "keyBlue"
enableWrapAround: "1"
position: "eval($i*320),275"
render: "Listbox"
scrollbarMode: "showNever"
size: "320,750"
source: "list$i"
transparent: "1"
children:
- xmlinc:
file: "screenpart_EventCell"
- xmlinc:
file: "screenpart_Footer"The compiler expands the loops: six screenpart_PrimeCell includes and six event lists, each with its own index. The includes and $variables are then resolved by the compiler:
<screen backgroundColor="panelBG" flags="wfNoBorder" name="TVMagazineCockpit" position="center,center" resolution="1920,1080" size="1920,1080">
<xmlinc file="screenpart_TitleBar"/>
<widget font="$md_label_medium" halign="right" name="day_selector" position="1490,15" size="420,26" transparent="1" valign="center" zPosition="2"/>
<xmlinc file="screenpart_PrimeCell" index="0" position="eval(0*$screen_width/6),0"/>
<xmlinc file="screenpart_PrimeCell" index="1" position="eval(1*$screen_width/6),0"/>
<xmlinc file="screenpart_PrimeCell" index="2" position="eval(2*$screen_width/6),0"/>
<xmlinc file="screenpart_PrimeCell" index="3" position="eval(3*$screen_width/6),0"/>
<xmlinc file="screenpart_PrimeCell" index="4" position="eval(4*$screen_width/6),0"/>
<xmlinc file="screenpart_PrimeCell" index="5" position="eval(5*$screen_width/6),0"/>
<widget backgroundColorSelected="keyBlue" enableWrapAround="1" position="eval(0*320),275" render="Listbox" scrollbarMode="showNever" size="320,750" source="list0" transparent="1">
<xmlinc file="screenpart_EventCell"/>
</widget>
<widget backgroundColorSelected="keyBlue" enableWrapAround="1" position="eval(1*320),275" render="Listbox" scrollbarMode="showNever" size="320,750" source="list1" transparent="1">
<xmlinc file="screenpart_EventCell"/>
</widget>
<widget backgroundColorSelected="keyBlue" enableWrapAround="1" position="eval(2*320),275" render="Listbox" scrollbarMode="showNever" size="320,750" source="list2" transparent="1">
<xmlinc file="screenpart_EventCell"/>
</widget>
<widget backgroundColorSelected="keyBlue" enableWrapAround="1" position="eval(3*320),275" render="Listbox" scrollbarMode="showNever" size="320,750" source="list3" transparent="1">
<xmlinc file="screenpart_EventCell"/>
</widget>
<widget backgroundColorSelected="keyBlue" enableWrapAround="1" position="eval(4*320),275" render="Listbox" scrollbarMode="showNever" size="320,750" source="list4" transparent="1">
<xmlinc file="screenpart_EventCell"/>
</widget>
<widget backgroundColorSelected="keyBlue" enableWrapAround="1" position="eval(5*320),275" render="Listbox" scrollbarMode="showNever" size="320,750" source="list5" transparent="1">
<xmlinc file="screenpart_EventCell"/>
</widget>
<xmlinc file="screenpart_Footer"/>
</screen>The body of the channel selection of MaterialSkinCockpit (screenpart_ChannelSelectionBody.zmlinc): the list of the services left, a vertical line, the information of the selected service right. The table has one row of the height of the body, and six columns: a margin, the list, a gap, the line, a gap and, with *, the rest of the width for the information. The cells say what is in them, not where it is: e is the size of the cell.
# the channel selection: the list of the services left, a vertical line, the information of the selected service right
- param: {name: "width"}
- param: {name: "height"}
- table:
width: "$width"
height: "$height"
columns: [8, 1152, 23, 1, 31, "*"]
rows: ["*"]
body:
- row:
- cell: {}
# the services
- cell:
children:
- xmlinc:
file: "screenpart_ChannelSelectionBodyList"
position: "0,0"
width: "e"
height: "e"
- cell: {}
# the vertical line
- cell:
children:
- eLabel:
backgroundColor: "md_outline_variant"
position: "0,5"
size: "e,$height-39"
zPosition: "-5"
- cell: {}
# the selected service
- cell:
children:
- xmlinc:
file: "screenpart_ChannelSelectionBodyInfo"
position: "0,0"
width: "e"
height: "e"The compiler works out where every cell is and places its elements there. The width of the * column is a formula that the compiler evaluates with the $width the body is included with:
<param name="width"/>
<param name="height"/>
<xmlinc file="screenpart_ChannelSelectionBodyList" height="$height" position="8,0" width="1152"/>
<eLabel backgroundColor="md_outline_variant" position="1183,5" size="1,eval($height-39)" zPosition="-5"/>
<xmlinc file="screenpart_ChannelSelectionBodyInfo" height="$height" position="1215,0" width="eval($width-8-1152-23-1-31)"/>Changing a column width (the gap, the list) moves everything right of it; no position has to be recalculated by hand.
The list of the jobs of JobCockpit (screenpart_JobCockpitBody.zmlinc). Every row of the list is two lines: the name of the job over the whole width (a cell with colspan: 3), and under it the state, a progress bar on its track and the percentage at the end. The row is written as a table; its cells hold the fields of the template.
- list:
backgroundColorSelected: "$backgroundColorSelected"
foregroundColorSelected: "$foregroundColorSelected"
itemCornerRadiusSelected: "$radius_item"
position: "0,0"
size: "$width,eval($height/80*80)"
source: "list"
converter: "COCTemplatedMultiContentEx"
item:
height: 80
padding: "10,10"
fonts: ["$md_body_small"]
columns: [240, 1300, "*"]
rows: [40, 40]
body:
- row:
# name
- cell:
colspan: 3
children:
- text: {font: "$md_body_small", flags: RT_HALIGN_LEFT|RT_VALIGN_CENTER, value: 0}
- row:
# state
- cell:
children:
- text: {size: "200,e", font: "$md_body_small", flags: RT_HALIGN_LEFT|RT_VALIGN_CENTER, value: 1}
# progress: a rounded bar on its track
- cell:
children:
- rect: {position: "0,center", size: "e,20", backgroundColor: "md_surface_container_highest", backgroundColorSelected: "md_outline", cornerRadius: 10}
- progress: {position: "0,center", size: "e,20", value: -2, foreColor: "md_primary", foreColorSelected: "md_inverse_primary", cornerRadius: 10}
# percentage, at the end of the row
- cell:
children:
- text: {position: "e-100,0", size: "100,e", font: "$md_body_small", flags: RT_HALIGN_RIGHT|RT_VALIGN_CENTER, value: 3}A Listbox widget with the template of the row; padding: "10,10" is the margin left and right of the table. The $variables are resolved by the compiler:
<widget backgroundColorSelected="$backgroundColorSelected" foregroundColorSelected="$foregroundColorSelected" itemCornerRadiusSelected="$radius_item" position="0,0" render="Listbox" size="$width,eval($height/80*80)" source="list">
<convert type="COCTemplatedMultiContentEx">
{
"template": [
MultiContentEntryText(pos=(10,0), size=(240+1300+($width-10-10)-240-1300,40), font=0, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER, text=0),
MultiContentEntryText(pos=(10,40), size=(200,40), font=0, flags=RT_HALIGN_LEFT|RT_VALIGN_CENTER, text=1),
MultiContentEntryRectangle(pos=(250,50), size=(1300,20), backgroundColor="md_surface_container_highest", backgroundColorSelected="md_outline", cornerRadius=10),
MultiContentEntryProgress(pos=(250,50), size=(1300,20), percent=-2, foreColor="md_primary", foreColorSelected="md_inverse_primary", cornerRadius=10),
MultiContentEntryText(pos=(1550+($width-10-10)-240-1300-100,40), size=(100,40), font=0, flags=RT_HALIGN_RIGHT|RT_VALIGN_CENTER, text=3),
],
"fonts": [parseFont("$md_body_small")],
"itemHeight": 80
}
</convert>
</widget>The positions of the fields follow from the columns and rows: the bar and the percentage move with the column widths, the name spans all three columns.
The mount manager of MaterialSkinCockpit (DevicesMountPanel): the devices with an icon, their name and a description of each, a message while they are scanned, and the page indicator. The screen is the frame and the body:
# screen_DevicesMountPanel.zmlinc
screen:
name: "DevicesMountPanel"
position: "fill"
title: "Mount Manager"
children:
# the frame: window, header with the title, footer with the buttons
- xmlinc:
file: "screenpart_Window"
position: "center"
width: "$window_medium_width"
height: "$window_medium_height"
window_inset_x: "$window_medium_body_x"
# the body, in the body rectangle of the frame
- xmlinc:
file: "screenpart_DevicesMountPanelBody"
position: "$window_medium_body_x,$window_medium_body_y"
width: "$window_medium_body_width"
height: "$window_medium_body_height"
# the MENU key in the footer: it belongs to the window, not to the body
- ePixmap:
alphatest: "blend"
pixmap: "buttons/key_menu.png"
position: "1045,792"
size: "36,26"
zPosition: "2"The body is a table: a row for the devices, a gap and a row for the pager. Its first cell holds the list of the devices, whose row is a table again (the icon over both lines, the name over the description), and the message, which is shown over the list while the devices are scanned:
# screenpart_DevicesMountPanelBody.zmlinc
- param: {name: "width"}
- param: {name: "height"}
- table:
width: "$width"
height: "$height"
columns: ["*"]
# devices, gap, pager
rows: ["*", 2, 25]
body:
- row:
# the devices; the message while they are scanned, over them
- cell:
children:
- list:
itemCornerRadius: "$radius_item"
position: "0,0"
size: "e,eval(($height-27)/126*126)" # whole rows of 126 down to the pager
source: "list"
transparent: "1"
item:
width: "$width"
height: 126
padding: "$list_indent,$list_indent,8,8"
columns: [110, 20, "*"]
rows: [44, "*"]
body:
- row:
# the icon of the device
- cell:
rowspan: 2
children:
- icon: {size: "e,e", flags: BT_SCALE|BT_KEEP_ASPECT_RATIO|BT_ALIGN_CENTER, value: 2}
- cell: {rowspan: 2}
# its name
- cell:
children:
- text: {font: "md_title_large", flags: RT_HALIGN_LEFT|RT_VALIGN_CENTER, value: 0}
- row:
# its description
- cell:
children:
- text: {font: "md_body_small", flags: RT_HALIGN_LEFT|RT_VALIGN_TOP|RT_WRAP, value: 1}
- widget:
font: "md_body_large"
foregroundColor: "md_primary"
halign: "center"
name: "lab1"
transparent: "1"
valign: "center"
zPosition: "1"
- row:
- cell: {}
- row:
# the pager of the devices
- cell:
children:
- xmlinc:
file: "screenpart_Pager"
position: "0,0"
width: "e"
height: "e"
connection: "list"There is not a single pixel position of the window in the body: the list fills its cell (e), the message fills it too (no position, no size), the pager is the last row. Put the body into the large window instead of the medium one and every element follows.
The screens of enigma2 are built from very few kinds of content, and nearly all of them are arranged the same way:
-
The frame is the same for every screen. The window, the header with the title and the clock, and the footer with the color buttons come from the shared frame (
screenpart_Window); the screen only says which size (small, medium, large, full) and where its body goes. That part of a screen is written once, for all of them (see the Skin design guide). -
The body is a few rectangles in rows and columns. A list (a menu, a setup list, the channels, the events of the EPG, the timers, recordings, files, devices, jobs, ...), maybe a second one next to it, an information pane (a description, a picon, the event, a cover, the picture of the TV), a status line, the page indicator. Side by side or one above the other: a table, with a
*column or row for the part that takes the rest of the space. -
The repeated content is a list, and its row is a table again. A row is a handful of fields: a name over a description, an icon over two lines, a value at the right end, a progress bar on its track. Written as columns and rows (
colspan,rowspan,padding), the template needs no position of its own either. Lists that enigma2 fills itself (a setup list, a menu) are a single widget in their cell. -
Sizes are relative.
*columns and rows,ein a cell,$width/$heightof the body: the same body works in every frame, and a list is made a whole number of rows high from the space it gets. A changed column width or row height moves everything after it; nothing is recalculated by hand. -
The source reads like the screen. Rows from top to bottom, cells from left to right, each with a comment of what it is;
zml2tablesvgdraws the cells with their line in the source,zml2svgthe elements in them.
So a new screen is: the frame of the right size, a body table with a cell for each region, a list (or a widget enigma2 fills) in the cells that repeat, the pager in the last row. In MaterialSkinCockpit, 164 of the 202 bodies are laid out by a table. The others are screens the pattern does not fit: a grid drawn by its own widget (the EPG grid, the menu grid), a wizard, a log that is one scrolling text over the whole body, or a body that is a single list already.
For visual inspection a screen layout graphic is generated during skin compile.