skin.py functions and value parsers
Search functions
Section titled “Search functions”Use this index to interpret XML values or locate the engine’s loading and screen-building stages. Functions run inside Enigma2; the enigma module and application state are required. Do not run global loading/reloading helpers for every widget update.
Option tokens are extracted from dictionaries and match cases in each parser. A token list does not replace the documented grammar: some tokens belong to separate subfields. See coordinates, colours and pixmaps for practical combinations.
54 entries
Source snapshot: skin.py @ f4135659cb. The catalogue lists source capabilities; support also depends on the receiver build and native widget class.
InitSkins
Load emergency, subtitle, primary, display, optional skin parts and user overrides; configure desktop resolution and templates. Startup operation, not a per-widget helper.
InitSkins()loadSkin
Read one XML skin and register its global resources and named screens. Returns True on a readable parsed skin, False otherwise; does not open a screen.
loadSkin(filename, scope=SCOPE_SKINS, desktop=getDesktop(GUI_SKIN_ID), screenID=GUI_SKIN_ID)reloadSkins
Reload global skin state and window styles. This is a broad application operation, not needed for opening an isolated example.
reloadSkins()loadSkinTemplates
Load component XML template definitions from the supplied filenames.
loadSkinTemplates(skinTemplatesFileNames)reloadSkinTemplates
Rebuild component template definitions; clear=True resets previously registered definitions.
reloadSkinTemplates(clear=False)addCallback
Register a callback to be notified when skin loading invokes its callback list.
addCallback(callback)removeCallback
Remove a previously registered skin callback.
removeCallback(callback)getParentSize
Find a widget parent's size or use the desktop, for relative coordinate calculations.
getParentSize(object, desktop)skinError
Write a skin error to the Enigma2 log; does not itself raise an exception.
skinError(errorMessage)attribDeprecationWarning
Write a deprecated-attribute warning and its replacement to the log.
attribDeprecationWarning(attribute, replacement)parseOptions
Look up a string in an allowed-options dictionary; log and return the given default for an invalid value.
parseOptions(options, attribute, value, default)parseValuePair
Parse a comma-separated x,y pair, with variables, axis-specific scaling and optional parent/widget dimensions. Returns a tuple.
parseValuePair(value, scale, object=None, desktop=None, size=None)parseAlphaTest
Map off/on/blend to native pixmap alpha flags. Invalid input falls back to off.
parseAlphaTest(value)Tokens found in the parser: on, off, blend. These can belong to different sub-options; use the syntax explained above.
parseAnimationMode
Map window-animation strings to native show/hide flags.
parseAnimationMode(value)Tokens found in the parser: disable, off, offshow, offhide, onshow, onhide, disable_onshow, disable_onhide. These can belong to different sub-options; use the syntax explained above.
parseBoolean
Return True for 1, the supplied attribute name, enabled, on, true or yes (case-insensitive); other strings are False.
parseBoolean(attribute, value)parseColor
Resolve #AARRGGBB or a registered colour name to gRGB; invalid input logs and uses the specified fallback.
parseColor(value, default=16777215)parseCoordinate
Evaluate one design coordinate with scaling, center/c/e/percent and font-relative terms. Returns an integer, or None for the wildcard. It is not a CSS expression parser.
parseCoordinate(value, parent, size=0, font=None, scale=(1, 1))parseErrorCorrection
Map QR recovery-level names to eQRCode constants; default medium.
parseErrorCorrection(value)Tokens found in the parser: low, medium, quartile, high. These can belong to different sub-options; use the syntax explained above.
parseFont
Resolve face/alias and optional ;size to a gFont. Font size is scaled on the vertical axis; an unknown face falls back to Body.
parseFont(value, scale=((1, 1), (1, 1)))parseFontScale
Parse size;offset or width;offset into a scale mode and vertically scaled offset.
parseFontScale(value, scale=((1, 1), (1, 1)))parseGradient
Parse start[,middle],end,horizontal-or-vertical[,alphaBlend]; return three colours, direction and blending flag.
parseGradient(value)Tokens found in the parser: horizontal, vertical. These can belong to different sub-options; use the syntax explained above.
parseHorizontalAlignment
Map left, center, right or block to native text alignment; invalid input defaults to left.
parseHorizontalAlignment(value)Tokens found in the parser: left, center, right, block. These can belong to different sub-options; use the syntax explained above.
parseInteger
Convert to int; log and return the supplied default on TypeError or ValueError.
parseInteger(value, default=0)parseItemAlignment
Map item alignment names to native listbox alignment constants.
parseItemAlignment(value)Tokens found in the parser: default, center, justify, leftTop, leftMiddle, leftBottom, rightTop, rightMiddle, rightBottom, centerTop, centerMiddle, centerBottom, justifyTop, justifyMiddle, justifyBottom, justifyLeft, justifyRight. These can belong to different sub-options; use the syntax explained above.
parseListOrientation
Map vertical/horizontal/grid to listbox orientation bits; invalid input falls back to vertical.
parseListOrientation(value)Tokens found in the parser: vertical, horizontal, grid. These can belong to different sub-options; use the syntax explained above.
parseOrientation
Map slider direction names to orientation and reverse-direction flags.
parseOrientation(value)Tokens found in the parser: orHorizontal, orLeftToRight, orRightToLeft, orVertical, orTopToBottom, orBottomToTop. These can belong to different sub-options; use the syntax explained above.
parseParameter
Convert a parameter token to string, colour integer, hex integer, float, named colour, font list or integer according to its prefix/content.
parseParameter(value)parsePixmap
Load an existing resolved image path through LoadPixmap; strip a # suffix and log missing or unreadable files. Returns a pixmap or None.
parsePixmap(path, desktop)parsePosition
Parse an x,y pair and return an ePoint.
parsePosition(value, scale, object=None, desktop=None, size=None)parseRadius
Parse radius[;edge,edge] into a radius and corner bitmask. Plain radius applies to all corners.
parseRadius(value)Tokens found in the parser: topLeft, topRight, top, bottomLeft, bottomRight, bottom, left, right. These can belong to different sub-options; use the syntax explained above.
parseScrollbarLength
Parse a numeric length, full (0) or auto (-1), otherwise return the caller's default.
parseScrollbarLength(value, default)Tokens found in the parser: full, auto. These can belong to different sub-options; use the syntax explained above.
parseSize
Parse a width,height pair and return an eSize.
parseSize(value, scale, object=None, desktop=None)parseTabWidth
Parse a numeric tab width or auto (-1), otherwise return the caller's default.
parseTabWidth(value, default)Tokens found in the parser: auto. These can belong to different sub-options; use the syntax explained above.
parseScale
Map pixmap scaling/alignment names to native blit flags; preserves numerous compatibility spellings.
parseScale(value)Tokens found in the parser: none, 0, scale, 1, keepAspect, leftTop, leftCenter, leftMiddle, leftBottom, centerTop, middleTop, centerScaled, middleScaled, centerBottom, middleBottom, rightTop, rightCenter, rightMiddle, rightBottom, scaleKeepAspect, scaleLeftTop, scaleLeftCenter, scaleLeftMiddle, scaleLeftBottom, scaleCenterTop, scaleMiddleTop, scaleCenter, scaleMiddle, scaleCenterBottom, scaleMiddleBottom, scaleRightTop, scaleRightCenter, scaleRightMiddle, scaleRightBottom, moveLeftTop, moveLeftCenter, moveLeftMiddle, moveLeftBottom, moveCenterTop, moveMiddleTop, moveCenter, moveMiddle, moveCenterBottom, moveMiddleBottom, moveRightTop, moveRightCenter, moveRightMiddle, moveRightBottom, off, on, aspect, center, width, height, stretch, fill. These can belong to different sub-options; use the syntax explained above.
parseScrollbarMode
Map visibility/side names to native listbox scrollbar constants.
parseScrollbarMode(value)Tokens found in the parser: showOnDemand, showAlways, showNever, showLeft, showLeftOnDemand, showLeftAlways, showTopOnDemand, showTopAlways, showOnDemandShrink. These can belong to different sub-options; use the syntax explained above.
parseScrollbarScroll
Map byPage/byLine to the native scrolling policy.
parseScrollbarScroll(value)Tokens found in the parser: byPage, byLine. These can belong to different sub-options; use the syntax explained above.
parseScrollText
Parse comma-separated key=value text-scrolling options into direction, delays, repeat, step size and mode.
parseScrollText(value)Tokens found in the parser: left, right, top, bottom, cached, bounce, bounceCached, roll, direction, endDelay, mode, repeat, startDelay, stepDelay, stepSize. These can belong to different sub-options; use the syntax explained above.
parseSeparator
Expand 1/2/4 separator values into left,top,width,height; supports automatic -1 fields.
parseSeparator(attribute, value)parsePadding
Expand 1/2/4 integers into left,top,right,bottom. Two values become x,y,x,y; it is not CSS top/right order.
parsePadding(attribute, value)parseVerticalAlignment
Map top, center/middle or bottom to native text alignment; invalid input defaults to center.
parseVerticalAlignment(value)Tokens found in the parser: top, center, middle, bottom. These can belong to different sub-options; use the syntax explained above.
parseWrap
Map ellipsis/noWrap/wrap to 2/0/1; otherwise parse an integer with fallback 1.
parseWrap(value)Tokens found in the parser: ellipsis, noWrap, wrap. These can belong to different sub-options; use the syntax explained above.
parseZoom
Map a list selection zoom mode to native listbox constants.
parseZoom(mode, zoomType)Tokens found in the parser: zoomContent, moveContent, ignoreContent. These can belong to different sub-options; use the syntax explained above.
collectAttributes
Resolve XML attributes, filenames, position, size, fonts and layout context before applying them to native objects. Mutates the supplied attribute list.
collectAttributes(skinAttributes, node, context, skinPath=None, ignore=(), filenames=frozenset(('pixmap', 'pointer', 'seekPointer', 'seek_pointer', 'backgroundPixmap', 'selectionPixmap', 'sliderPixmap', 'scrollbarBackgroundPixmap', 'scrollbarForegroundPixmap', 'scrollbarbackgroundPixmap', 'scrollbarBackgroundPicture', 'scrollbarSliderPicture')))applyAllAttributes
Construct an AttributeParser for a native object and apply the collected name/value pairs.
applyAllAttributes(guiObject, desktop, attributes, scale=((1, 1), (1, 1)))loadSingleSkinData
Process global skin data such as output, includes, colours, fonts, parameters, layouts, subtitle styles and window styles.
loadSingleSkinData(desktop, screenID, domSkin, pathSkin, scope=SCOPE_GUISKIN)reloadWindowStyles
Reapply stored window-style definitions.
reloadWindowStyles()readSkin
Choose a named or embedded screen, build its layout contexts, connect sources/converters/renderers and collect component attributes. Called by Screen.
readSkin(screen, skin, names, desktop)findSkinScreen
Return the first registered name found in a name or list of names, otherwise None.
findSkinScreen(names)findWidgets
Return names of widgets/sources/addon connections from a registered screen, expanding named panels; this is an XML scan, not screen execution.
findWidgets(name)getcomponentTemplate
Return the registered XML component template for component/name (spelling is case-sensitive).
getcomponentTemplate(component, name)getcomponentTemplateNames
Return names of registered component templates for a component.
getcomponentTemplateNames(component)getScrollLabelStyle
Return one stored ScrollLabel default by key, or None if absent.
getScrollLabelStyle(element)getSkinFactor
Return desktop height divided by 720. Deprecated for OpenATV; prefer the screen resolution attribute for new layouts.
getSkinFactor(screen=GUI_SKIN_ID)applySkinFactor
Legacy helper multiplying numeric arguments by getSkinFactor; returns an int for one argument or tuple for multiple arguments.
applySkinFactor(*d)No matching entry. Clear the filter or search the whole handbook above.
