本文整理汇总了Python中gtk.ListStore.set_sort_column_id方法的典型用法代码示例。如果您正苦于以下问题:Python ListStore.set_sort_column_id方法的具体用法?Python ListStore.set_sort_column_id怎么用?Python ListStore.set_sort_column_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk.ListStore
的用法示例。
在下文中一共展示了ListStore.set_sort_column_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PeersTab
# 需要导入模块: from gtk import ListStore [as 别名]
# 或者: from gtk.ListStore import set_sort_column_id [as 别名]
class PeersTab(Tab):
def __init__(self):
super(PeersTab, self).__init__('Peers', 'peers_tab', 'peers_tab_label')
self.peer_menu = self.main_builder.get_object('menu_peer_tab')
component.get('MainWindow').connect_signals(self)
self.listview = self.main_builder.get_object('peers_listview')
self.listview.props.has_tooltip = True
self.listview.connect('button-press-event', self._on_button_press_event)
self.listview.connect('query-tooltip', self._on_query_tooltip)
# flag, ip, client, downspd, upspd, country code, int_ip, seed/peer icon, progress
self.liststore = ListStore(Pixbuf, str, str, int, int, str, float, Pixbuf, float)
self.cached_flag_pixbufs = {}
self.seed_pixbuf = icon_seeding
self.peer_pixbuf = icon_downloading
# key is ip address, item is row iter
self.peers = {}
# Country column
column = TreeViewColumn()
render = CellRendererPixbuf()
column.pack_start(render, False)
column.add_attribute(render, 'pixbuf', 0)
column.set_sort_column_id(5)
column.set_clickable(True)
column.set_resizable(True)
column.set_expand(False)
column.set_min_width(20)
column.set_reorderable(True)
self.listview.append_column(column)
# Address column
column = TreeViewColumn(_('Address'))
render = CellRendererPixbuf()
column.pack_start(render, False)
column.add_attribute(render, 'pixbuf', 7)
render = CellRendererText()
column.pack_start(render, False)
column.add_attribute(render, 'text', 1)
column.set_sort_column_id(6)
column.set_clickable(True)
column.set_resizable(True)
column.set_expand(False)
column.set_min_width(100)
column.set_reorderable(True)
self.listview.append_column(column)
# Client column
column = TreeViewColumn(_('Client'))
render = CellRendererText()
column.pack_start(render, False)
column.add_attribute(render, 'text', 2)
column.set_sort_column_id(2)
column.set_clickable(True)
column.set_resizable(True)
column.set_expand(False)
column.set_min_width(100)
column.set_reorderable(True)
self.listview.append_column(column)
# Progress column
column = TreeViewColumn(_('Progress'))
render = CellRendererProgress()
column.pack_start(render, True)
column.set_cell_data_func(render, cell_data_peer_progress, 8)
column.set_sort_column_id(8)
column.set_clickable(True)
column.set_resizable(True)
column.set_expand(False)
column.set_min_width(100)
column.set_reorderable(True)
self.listview.append_column(column)
# Down Speed column
column = TreeViewColumn(_('Down Speed'))
render = CellRendererText()
column.pack_start(render, False)
column.set_cell_data_func(render, cell_data_speed_down, 3)
column.set_sort_column_id(3)
column.set_clickable(True)
column.set_resizable(True)
column.set_expand(False)
column.set_min_width(50)
column.set_reorderable(True)
self.listview.append_column(column)
# Up Speed column
column = TreeViewColumn(_('Up Speed'))
render = CellRendererText()
column.pack_start(render, False)
column.set_cell_data_func(render, cell_data_speed_up, 4)
column.set_sort_column_id(4)
column.set_clickable(True)
column.set_resizable(True)
column.set_expand(False)
column.set_min_width(50)
#.........这里部分代码省略.........