내가 발견 한 스 니펫을 사용하여 ListStore 비 텍스트 개체를 유지하려고했습니다. 트 리뷰가 표시행에 GtkListStore 객체 속성을 저장하는 방법은 무엇입니까?
class Series(gobject.GObject, object):
def __init__(self, title):
super(Series, self).__init__()
self.title = title
gobject.type_register(Series)
class SeriesListStore(gtk.ListStore):
def __init__(self):
super(SeriesListStore, self).__init__(Series)
self._col_types = [Series]
def get_n_columns(self):
return len(self._col_types)
def get_column_type(self, index):
return self._col_types[index]
def get_value(self, iter, column):
obj = gtk.ListStore.get_value(self, iter, 0)
return obj
그리고 지금 내가 만들려고 노력 해요 : : 다음은 객체
...
liststore = SeriesListStore()
liststore.clear()
for title in full_conf['featuring']:
series = Series(title)
liststore.append([series])
def get_series_title(column, cell, model, iter):
cell.set_property('text', liststore.get_value(iter, column).title)
return
selected = builder.get_object("trvMain")
selected.set_model(liststore)
col = gtk.TreeViewColumn(_("Series title"))
cell = gtk.CellRendererText()
col.set_cell_data_func(cell, get_series_title)
col.pack_start(cell)
col.add_attribute(cell, "text", 0)
selected.append_column(col)
...
그러나 그것은 오류와 함께 실패합니다
GtkWarning : gtk_tree_view_column_cell_layout_set_cell_data_func : 주장
info != NULL' failed
텍스트 '
col.set_cell_data_func(cell, get_series_title) Warning: unable to set propertygchararray' from value of type
데이터의 + TrayIcon + Series',210 window.show_all() 경고 : 재산text' of type
gchararray 설정할 수 없습니다 ' 유형의 값에서을'데이터 + TrayIcon에 + 시리즈 '
gtk.main() gtk.main()
내가해야 작동하게 만드시겠습니까?