wich is the method to get datas of a Treeview?
I have some rows and I'd like to save the data in an XML file, but I don't know how to keep the rows datas to pass to the XML function creator.
Thanks a lot!
Thanks for your reply! Here some code:
def create_xml(self, path, model):
from lxml import etree
print len(model) #that's work
self.model = self.treeview.get_model()
if(len(model) > 0):
root = etree.Element("lista_tareas")
iter = self.model.get_iter_first()
contatore = 1
while iter:
#from here doesn't work,
# 'gtk.ListStore' object has no attribute 'COL_DESCRIZIONE'
descrizione_c = self.model.get_value(iter, self.model.COL_DESCRIZIONE)
data_limite_c = model.get_value(iter, COL_DATA_LIMITE)
priorita_c = model.get_value(iter, COL_PRIORITA)
realizzato_c = model.get_value(iter, COL_REALIZZATO)
root.append(etree.Element("tarea", _id = contatore, realizzato = realizzato_c, data_limite = data_limite_c, priorita = priorita_c))
root.appendSubElement(tarea, "description")
tarea.text = descrizione_c
iter = model.iter_next(iter)
outFile = open('homemade.xml', 'w')
doc.write(outFile)
This is the button who call the function:
self.save_button.connect("clicked", self.create_xml, self.model_add)