def create_second_treeview(self):
self.treeview2 = gtk.TreeView()
self.treeview2.add_events(gdk.BUTTON_PRESS_MASK)
self.treeview2.connect('button-press-event', self.pop_menu)
self.treeview2.connect('cursor-changed', self.tv2_selected)
self.treeview2.connect('row_activated', self.tv_row_activated)
self.treeview2.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_VERTICAL)
self.treeview2.set_show_expanders(self.pref.tv2_expandable)
if self.pref.tv2_expandable :
self.treeview2.set_level_indentation(-5)
else :
self.treeview2.set_level_indentation(12)
# icon and name
col = gtk.TreeViewColumn(_("Name"))
cell = gtk.CellRendererPixbuf()
cell.set_fixed_size(treeview_icon_size, treeview_icon_size)
self.tv2_icon_cell = cell
col.pack_start(cell, expand = False)
col.set_cell_data_func(cell, self.get_col_icon)
self.name_cell2 = gtk.CellRendererText()
self.name_cell2.set_property('xpad', 2)
self.name_cell2.set_property('ellipsize', self.pref.name_ellipsis)
col.pack_start(self.name_cell2, expand = True)
col.set_cell_data_func(self.name_cell2, self.get_col_name)
col.set_resizable(True)
col.set_min_width(int(self.col_width_adj.get_value()))
self.treeview2.append_column(col)
# value
col = gtk.TreeViewColumn(_("Value"))
cell = CellRendererMx(self.treeview2)
cell.set_property("editable", True)
cell.edited = self.edited
cell.set_preediting(self.get_editinfo)
cell.set_refresh_fn(self.get_selected_feature)
col.pack_start(cell, expand = False)
col.set_cell_data_func(cell, self.get_col_value)
col.set_resizable(True)
col.set_min_width(200)
self.treeview2.append_column(col)
self.treeview2.set_tooltip_column(1)
self.treeview2.set_model(self.treestore)
self.treeview2.set_model(self.details_filter)
self.params_scroll.add(self.treeview2)
self.treeview2.connect('key-press-event', self.tv_key_pressed_event)
评论列表
文章目录