Hi,
I am having an issue with the Gtk.PropertyExpression class. I tried different options but I always get an error similar to:
TypeError: No means to translate argument or return value for 'GtkPropertyExpression'
Below is my code snippet:
class AppColumnView(Gtk.ColumnView):
__gtype_name__ = "app_column_view"
def __init__(self,):
super().__init__()
self.folder_path = None
self.search_entry_value = None
self.set_show_row_separators(True)
self.set_show_column_separators(True)
self.single_selection = Gtk.SingleSelection()
self.sort_list_model = Gtk.SortListModel()
self.list_store = Gio.ListStore()
self.set_model(self.single_selection)
self.single_selection.set_model(self.sort_list_model)
self.sort_list_model.set_model(self.list_store)
self.sort_list_model.set_sorter(self.get_sorter())
columns = [
{"title": "Path", "property": "path", "expand": True, "setup": self.factory_setup_label, "bind": self.factory_bind_label},
{"title": "Points (nb)", "property": "points", "expand": False, "setup": self.factory_setup_label, "bind": self.factory_bind_label},
{"title": "Length (km)", "property": "length", "expand": False, "setup": self.factory_setup_label, "bind": self.factory_bind_label},
{"title": "UpHill (m)", "property": "up_hill", "expand": False, "setup": self.factory_setup_label, "bind": self.factory_bind_label},
{"title": "DownHill (m)", "property": "down_hill", "expand": False, "setup": self.factory_setup_label, "bind": self.factory_bind_label},
{"title": "Actions", "property": None, "expand": False, "setup": self.factory_setup_actions, "bind": None}
]
for column in columns:
column_view_column = Gtk.ColumnViewColumn()
column_view_column.set_title(column["title"])
column_view_column.set_expand(column["expand"])
signal_list_item_factory = Gtk.SignalListItemFactory()
signal_list_item_factory.connect("setup", column["setup"])
if column["bind"]:
signal_list_item_factory.connect("bind", column["bind"], column["property"])
property_expression = Gtk.PropertyExpression.new(Item, None, column["property"])
string_sorter = Gtk.StringSorter()
string_sorter.set_expression(property_expression)
column.set_sorter(string_sorter)
column_view_column.set_factory(signal_list_item_factory)
self.append_column(column_view_column)
KInd regards,
Vincent