2011-03-11, 19:00
Hi everyone! I'm trying to write a script and I got stuck. I have filled a ControlList (self.list) with items, each item is a string from a file, I give the user the possibility to modify the list throgh virtual keyboard and then I would like to save the changes back to the file, but this seem not to work (bugs out when I try to get the size of the ControlList):
What am I doing wrong? Is there a better way insted of going through ControlList?
Cheers!
Code:
if dialog.yesno("Save", "do you want to save the file?"):
i = range(self.list.size())
while(i):
config = "\n".join(self.list.getListItem(i).getLabel())
fname = xbmc.translatePath('special://home/addons/myscript/myfile')
w = open(fname, 'w')
w.write(config)
w.close()
self.close()
What am I doing wrong? Is there a better way insted of going through ControlList?
Cheers!