Skip to content

Commit

Permalink
- added possibility in skin to define string type parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitarCC authored and Huevos committed Oct 9, 2023
1 parent 26d28cc commit 5455b31
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/python/skin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
menus = {} # Dictionary of images associated with menu entries.
menuicons = {} # Dictionary of icons associated with menu items.
parameters = {} # Dictionary of skin parameters used to modify code behavior.
stringparameters = {} # Dictionary that contains string type parameters for use in screens
setups = {} # Dictionary of images associated with setup menus.
switchPixmap = {} # Dictionary of switch images.
scrollbarStyle = None # When set, a dictionary of scrollbar styles
Expand Down Expand Up @@ -64,7 +65,7 @@

def InitSkins(booting=True):
global currentPrimarySkin, currentDisplaySkin
global domScreens, colors, BodyFont, fonts, menus, menuicons, parameters, setups, switchPixmap, scrollbarStyle, windowStyles, xres, yres
global domScreens, colors, BodyFont, fonts, menus, menuicons, parameters, stringparameters, setups, switchPixmap, scrollbarStyle, windowStyles, xres, yres
# Reset skin dictionaries. We can reload skins without a restart
# Make sure we keep the original dictionaries as many modules now import skin globals explicitly
domScreens.clear()
Expand All @@ -76,6 +77,7 @@ def InitSkins(booting=True):
menus.clear()
menuicons.clear()
parameters.clear()
stringparameters.clear()
setups.clear()
switchPixmap.clear()
scrollbarStyle = None
Expand Down Expand Up @@ -764,7 +766,7 @@ def reloadWindowStyles():
def loadSingleSkinData(desktop, screenID, domSkin, pathSkin, scope=SCOPE_CURRENT_SKIN):
"""Loads skin data like colors, windowstyle etc."""
assert domSkin.tag == "skin", "root element in skin must be 'skin'!"
global colors, fonts, menus, menuicons, parameters, setups, switchPixmap, scrollbarStyle, xres, yres
global colors, fonts, menus, menuicons, parameters, stringparameters, setups, switchPixmap, scrollbarStyle, xres, yres
for tag in domSkin.findall("output"):
scrnID = int(tag.attrib.get("id", GUI_SKIN_ID))
if scrnID == GUI_SKIN_ID:
Expand Down Expand Up @@ -937,6 +939,15 @@ def loadResolvedPixmap(filename):
# print("[Skin] DEBUG: Menu key='%s', image='%s'." % (key, image))
else:
raise SkinError("Tag 'menuicon' needs key and image, got key='%s' and image='%s'" % (key, image))
for tag in domSkin.findall("stringparameters"):
for stringparam in tag.findall("stringparam"):
key = stringparam.attrib.get("key")
value = stringparam.attrib.get("value")
if key and value:
stringparameters[key] = value
# print("[Skin] DEBUG: Menu key='%s', image='%s'." % (key, image))
else:
raise SkinError("Tag 'stringparameters' needs key and value, got key='%s' and value='%s'" % (key, value))
for tag in domSkin.findall("setups"):
for setup in tag.findall("setup"):
key = setup.attrib.get("key")
Expand Down

0 comments on commit 5455b31

Please sign in to comment.