I have a row like that -> [name],[mp3names],[suggested_names] suggested_names is a list for combobox and each row has different suggested names. So I need a combobox for them. but I dont know how to do.
edit: I read my csv file at first, then I add all them in a list, then I handle all columns. I have name suggestions for every row, but i don't know how to add this suggestions. Now I can only once define the suggestions and use for all rows, but it is not correct, I need different suggestions for every row.
for i in range(self.row_len):
outliers_list.append([str(self.columns[1][i])]+[str(self.columns[self.col_count-2][i])]+[str(self.columns[self.col_count-1][i])]+[corrected]+[audio_name])
self.col_len = len(outliers_list[0]);
#dynamically liststore column adding
self.liststore = Gtk.ListStore(*([str] * 5))
# You need to use self.fillStore() instead.
for item in outliers_list:
self.liststore.append(item)
liststore_suggestions = Gtk.ListStore(str)
suggestions = correct("axse")
for item in suggestions:
liststore_suggestions.append([item])
renderer_text = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Name", renderer_text, text=0)
treeview.append_column(column)
renderer_text = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("mp3Names", renderer_text, text=1)
treeview.append_column(column)
renderer_combo = Gtk.CellRendererCombo()
renderer_combo.set_property("editable", True)
renderer_combo.set_property("model",liststore_suggestions)
renderer_combo.set_property("text-column", 0)
renderer_combo.set_property("has-entry", True)
renderer_combo.connect("edited", self.on_combo_changed)
column_combo = Gtk.TreeViewColumn("Suggest", renderer_combo, text=2)
treeview.append_column(column_combo)
here suggestions = correct("axse") would change for every row, I only defined it for showing you, the correct one ise :
suggestions = correct(str(self.columns[1][i]))
At last, what I want is changing this code, because it stores only one list and use it for every row.
renderer_combo.set_property("model",liststore_suggestions)
But what I want is something like that. Loading dynamically combobox liststores for every row.
renderer_combo.set_property("model",liststore_suggestions[i])
Finally I found my way. So at first I added
Then I added the new function. It gets the first column value of row and do correction, suggests names and update combobox.