mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 22:47:01 +01:00
synced changes from eu version
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -26,15 +26,32 @@ def get_icon_id(ma_name):
|
|||||||
return icons["alert-circle-outline"]
|
return icons["alert-circle-outline"]
|
||||||
""")
|
""")
|
||||||
|
|
||||||
# write documentation file
|
# write mapping lib for typescript
|
||||||
with open(os.path.join(__location__, "../..","icons.md"), 'w') as f:
|
with open(os.path.join(__location__, "../../../iobroker", "icon_mapping.ts"), 'w') as f:
|
||||||
f.write("""
|
f.write("let iconMap = new Map<string, string>([\n")
|
||||||
# Icons IDs
|
|
||||||
This file contains the Icons IDs included in the display firmware, addressable via serial.
|
|
||||||
|
|
||||||
MD Icon Name | Icon
|
|
||||||
------------ | ----
|
|
||||||
""")
|
|
||||||
for icon in icon_metadata:
|
for icon in icon_metadata:
|
||||||
val = icon["name"]
|
iconchar = chr(int(icon['hex'], 16))
|
||||||
f.write(f"mdi:{val} | \n")
|
name = icon["name"]
|
||||||
|
f.write(f" [\"{name}\", \"{iconchar}\"],\n")
|
||||||
|
f.write("]);\n")
|
||||||
|
f.write("""
|
||||||
|
function get_icon(ma_name:string):string{
|
||||||
|
if(iconMap.has(ma_name)){
|
||||||
|
return iconMap.get(ma_name);
|
||||||
|
}
|
||||||
|
return iconMap.get("alert-circle-outline");
|
||||||
|
}
|
||||||
|
""");
|
||||||
|
|
||||||
|
# write documentation file
|
||||||
|
#with open(os.path.join(__location__, "../..","icons.md"), 'w') as f:
|
||||||
|
# f.write("""
|
||||||
|
## Icons IDs
|
||||||
|
#This file contains the Icons IDs included in the display firmware, addressable via serial.
|
||||||
|
#
|
||||||
|
#MD Icon Name | Icon
|
||||||
|
#------------ | ----
|
||||||
|
#""")
|
||||||
|
# for icon in icon_metadata:
|
||||||
|
# val = icon["name"]
|
||||||
|
# f.write(f"mdi:{val} | \n")
|
||||||
|
|||||||
Reference in New Issue
Block a user