| Revision 982,
832 bytes
checked in by zach, 3 years ago
(diff) |
- Adding default skin (non-working)
- Modified logging for debugger
|
| Line | |
|---|
| 1 | import base64 |
|---|
| 2 | from xml.dom import minidom |
|---|
| 3 | |
|---|
| 4 | basePath = "../assets" |
|---|
| 5 | skinName = "five" |
|---|
| 6 | skinPath = basePath + "/" + skinName + "/" + skinName + ".xml" |
|---|
| 7 | skinFile = open(skinPath,"r") |
|---|
| 8 | skin = minidom.parse(skinFile) |
|---|
| 9 | components = skin.getElementsByTagName('component') |
|---|
| 10 | for component in components: |
|---|
| 11 | componentName = component.attributes["name"] |
|---|
| 12 | elements = component.getElementsByTagName('element') |
|---|
| 13 | for element in elements: |
|---|
| 14 | elementPath = basePath + "/" + skinName + "/" + componentName.value + "/" + element.attributes['src'].value |
|---|
| 15 | imageText = base64.b64encode(open(elementPath,"rb").read()) |
|---|
| 16 | element.attributes['src'].value = "url('data:image/png;base64," + imageText+ "')" |
|---|
| 17 | outputPath = skinPath = basePath + "/" + skinName + "/" + skinName + "-min.xml" |
|---|
| 18 | outputFile = open(skinPath,"w") |
|---|
| 19 | outputFile.write(skin.toxml()) |
|---|
| 20 | outputFile.close() |
|---|
Note: See
TracBrowser
for help on using the repository browser.