我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用gtk.SORT_ASCENDING。
def refill_model(self): '''Update model.''' self.model.clear() for tag in [a.name for a in self.index.list_all_tags()]: if tag in self.icons_for_tags: icon_name = self.icons_for_tags[tag] rendered_icon = render_icon(ICONS[icon_name]) else: icon_name, rendered_icon = None, None self.model.append([tag, rendered_icon, icon_name, self.index.n_list_tagged_pages(tag)]) # Sort tags by number of pages and then by names. self.model.set_sort_column_id(self.TAG_COL, order = gtk.SORT_ASCENDING) self.model.set_sort_column_id(self.N_PAGES_COL, order = gtk.SORT_DESCENDING)
def refill_model(self): '''Update model.''' self.model.clear() tagview = TagsView.new_from_index(self.index) for tag in [a.name for a in tagview.list_all_tags()]: if tag in self.icons_for_tags: icon_name = self.icons_for_tags[tag] rendered_icon = render_icon(ICONS[icon_name]) else: icon_name, rendered_icon = None, None self.model.append([tag, rendered_icon, icon_name, tagview.n_list_pages(tag)]) # Sort tags by number of pages and then by names. self.model.set_sort_column_id(self.TAG_COL, order = gtk.SORT_ASCENDING) self.model.set_sort_column_id(self.N_PAGES_COL, order = gtk.SORT_DESCENDING)
def create_store(self): store = gtk.ListStore(str, gtk.gdk.Pixbuf, bool) store.set_sort_column_id(COL_PATH, gtk.SORT_ASCENDING) return store