Welcome, Guest
Please Login or Register.    Lost Password?

Convert ini-format skins to xml-format
(1 viewing) (1) Guest
Go to bottomPage: 1234
TOPIC: Convert ini-format skins to xml-format
*
#13427
Convert ini-format skins to xml-format 3 Years, 10 Months ago  
Here's a script which converts the old ini format skins to the new xml format.

Requirements:
- Rainlendar 2.8 b96 or newer (get it from the beta forum)
- Python 2.x (Python 3.x might not run the script so make sure you download the 2.x version).

Usage:
- Download and install Python (if you use Linux or Mac you probably have it already)
- Copy the script to the same folder where the skin's ini files are located
- Run the script either by double clicking it (on Windows) or from the command line (python ConvertSkin.py)

The script will create a new file called skin.xml into the same folder. If there is only one ini file in the folder everything will be written to the skin.xml file. It there are multiple files the script will create a separate xml file for each of them and include them from the skin.xml file.

Rainlendar will try to find the skin.xml file first from the folder so after you've run the script you can refresh Rainlendar, go to options and choose the newly created skin (the old ini format version is not accessible anymore so if you were using the skin Rainlendar will revert to the default skin). If you want to go back to the ini format skin or try the conversion again you can just delete the skin.xml file from the folder.

If you find a skin which cannot be converted with the script but works fine in Rainlendar2 please post a download link to it.

The script can be downloaded from here: ConvertSkin.py
Rainy
Moderator
Posts: 5940
graph
User Online Now Click here to see the profile of this user
Last Edit: 2010/12/15 12:51 By Rainy.
The administrator has disabled public write access.
 
#13936
Re:Convert ini-format skins to xml-format 3 Years, 8 Months ago  
Thanks for the script but it has errors:
Code:

$ ./ConvertSkin.py 
Traceback (most recent call last):
  File "./ConvertSkin.py", line 1310, in <module>
    convertInisToXml(iniFiles)
  File "./ConvertSkin.py", line 89, in convertInisToXml
    parseIniFile(iniFile, skin, "", True)
UnboundLocalError: local variable 'iniFile' referenced before assignment



In convertInisToXml function, in else part, you call
Code:

parseIniFile(iniFile, skin, "", True)
but iniFile variable doesn't exist. I changed this by iniFiles[0].

With this change, the script creates the xml file but incomplete. It shows several errors:
Code:

$ ./ConvertSkin.py 
ERROR: The color 0 has too few characters
ERROR: The color 0 has too few characters
Traceback (most recent call last):
  File "./ConvertSkin.py", line 1310, in <module>
    convertInisToXml(iniFiles)
  File "./ConvertSkin.py", line 102, in convertInisToXml
    tree.write(output)
  File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 663, in write
    self._write(file, self._root, encoding, {})
  File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 707, in _write
    self._write(file, n, encoding, namespaces)
  File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 707, in _write
    self._write(file, n, encoding, namespaces)
  File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 698, in _write
    _escape_attrib(v, encoding)))
  File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 830, in _escape_attrib
    _raise_serialization_error(text)
  File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 777, in _raise_serialization_error
    "cannot serialize %r (type %s)" % (text, type(text).__name__)
TypeError: cannot serialize None (type NoneType)



I'm on Ubuntu Linux 10.04 32 bits with python 2.6.
The skin to convert is this: http://www.customize.org/rainlendar/skins/35411

The created xml file is unusable.

------------------------------------------------------------------------
I have tested with other and other error:
Code:

$ ../ConvertSkin.py .
File contains parsing errors: /home/simon/Descargas/Glossy Se7en/Glossy.ini
[line 149]: '[Profile 5\r\n'
Wrote: /home/simon/Descargas/Glossy Se7en/skin.xml



The skin is: http://www.customize.org/rainlendar/skins/69058

------------------------------------------------------------------------
Finally I have found one skin that this script was able convert.
The normal version of this skin: http://benijamino.deviantart.com/art/Imagine-for-Rainlendar-v2-41951891?q=boost%3Apopular+in%3Acustomization%2Fskins%2Fcalendars%2Frainlendar&qo=0
But Rainlendar2 doesn't recognize the skin converted.

This script is totally unusable.
JSimR
Ubuntu: Linux for human beings!
Senior Boarder
Posts: 70
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Barcelona
Last Edit: 2010/12/15 06:51 By JSimR.
The administrator has disabled public write access.
Rainlendar Pro v2.9(b104) 64 bit (with licence) on Ubuntu 10.04
 
#13939
Re:Convert ini-format skins to xml-format 3 Years, 8 Months ago  
First of all, i know nothing about Python, but yes about programming, so, here's my help. There are some problem which can be solved but simply i don't know how.

I think that your correction was correct about iniFiles[0]

In the first case, the SimpleNote skin (www.customize.org/rainlendar/skins/35411), i'm not sure, but i think that the problem is the skin doesn't have a event list window. And that is "TypeError: cannot serialize None (type NoneType)"
If you comment the CreateEventList line, you will have troubles again, because CreateTodoList checks for the header in the eventlist (which again, doesn't exist)
If you comment both lines, the calendar will be showed.

With the second skin (www.customize.org/rainlendar/skins/69058) the error is clear: if you look the Glossy.ini file you will find there is a missing square bracket in "Profile 5" section (the \r\n is the end of line and carriage return or Enter)

But after solve that, there is a problem with the ConvertSkin.py in CreateEventList and CreateTodoList

Code:

  if len(prefix) > 0:
    window.set("id", prefix + " - Event List")
  else:
    window.set("id", "Calendar")



The last line needs to be different: window.set("id", "Event List") and window.set("id", "Task List"). There can't be 3 different windows with the same id. (a bad copy/paste )

With this change, the 3rd skin works well, except the fact i need to rename those imaginev2_small_xxxxx.ini because Python error in today=ET.SubElement(calendar, "today"). calendar is None.

I hope this helps you.
Jorge_Luis
Platinum Boarder
Posts: 792
graphgraph
User Offline Click here to see the profile of this user
Gender: Male My Rainlendar Skins Location: Argentina Birthday: 03/15
The administrator has disabled public write access.
 
#13940
Re:Convert ini-format skins to xml-format 3 Years, 8 Months ago  
Jorge_Luis wrote:
...
Code:

  if len(prefix) > 0:
    window.set("id", prefix + " - Event List")
  else:
    window.set("id", "Calendar")



The last line needs to be different: window.set("id", "Event List") and window.set("id", "Task List"). There can't be 3 different windows with the same id. (a bad copy/paste )

Thanks. With this change I could translate and use the last skin: Imagine for Rainlendar v2 (it's perfect for me)

I attach the modified script.
File Attachment:
File Name: ConvertSkin-43d6c855195fd31c3453be46da5b0abe.py
File Size: 50201
JSimR
Ubuntu: Linux for human beings!
Senior Boarder
Posts: 70
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Barcelona
Last Edit: 2010/12/15 11:55 By JSimR.
The administrator has disabled public write access.
Rainlendar Pro v2.9(b104) 64 bit (with licence) on Ubuntu 10.04
 
#13941
Re:Convert ini-format skins to xml-format 3 Years, 8 Months ago  
I made the changes to the original script and added some more error handling too so it doesn't crash so easily.
Rainy
Moderator
Posts: 5940
graph
User Online Now Click here to see the profile of this user
The administrator has disabled public write access.
 
#13946
Re:Convert ini-format skins to xml-format 3 Years, 8 Months ago  
Rainy wrote:
I made the changes to the original script and added some more error handling too so it doesn't crash so easily.

I have a problem with the conversion of this skin: http://benijamino.deviantart.com/art/Imagine-for-Rainlendar-v2-41951891?q=boost%3Apopular+in%3Acustomization%2Fskins%2Fcalendars%2Frainlendar&amp;qo=0

The alarm window hasn't button to close or snooze.

I attach zip file with ini original and xml.
File Attachment:
File Name: imagine_v2.zip
File Size: 94716


It creates duplicates elements:
Code:


    <bitmap file="butt_edit.png" frames="3" id="button.butt_edit.png" />
    <bitmap file="butt_todo.png" frames="3" id="button.butt_todo.png" />
    <bitmap file="butt_event.png" frames="3" id="button.butt_event.png" />
    <bitmap file="butt_edit.png" frames="3" id="button.butt_edit.png" />
    <bitmap file="butt_close.png" frames="3" id="button.butt_close.png" />
    <bitmap file="butt_close.png" frames="3" id="button.butt_close.png" />

JSimR
Ubuntu: Linux for human beings!
Senior Boarder
Posts: 70
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Barcelona
Last Edit: 2010/12/16 05:14 By JSimR.
The administrator has disabled public write access.
Rainlendar Pro v2.9(b104) 64 bit (with licence) on Ubuntu 10.04
 
Go to topPage: 1234
get the latest posts directly to your desktop