本文整理汇总了Python中gtk.TreeViewColumn方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.TreeViewColumn方法的具体用法?Python gtk.TreeViewColumn怎么用?Python gtk.TreeViewColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.TreeViewColumn方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeColumn
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def makeColumn(name, index, onedit=None, cell=None, links=None):
"""
Return a default "TreeViewColumn" of name "name"
whose TreeModel index for the renderer is "index"
"""
if cell == None:
cell = gtk.CellRendererText()
if links == None:
links = {"text":index}
if onedit:
cell.set_property("editable", True)
cell.connect("edited", onedit)
col = gtk.TreeViewColumn(name,cell,**links)
col.set_property("clickable", True)
col.set_property("reorderable", True)
col.set_property("resizable",True)
col.set_property("sizing",1)
col.set_property("sort-indicator", True)
col.set_sort_column_id(index)
return col
示例2: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def __init__(self):
super(ShowLastPackets.PacketList, self).__init__()
self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
vscrollbar_policy=gtk.POLICY_AUTOMATIC)
self.table_model = gtk.ListStore(*([str]*4))
treeview = gtk.TreeView(self.table_model)
treeview.show()
self.add(treeview)
def add_column(descr, colid):
column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
treeview.append_column(column)
add_column("Time", self.COLUMN_TIME)
add_column("Interface", self.COLUMN_INTERFACE)
add_column("Size", self.COLUMN_SIZE)
add_column("Contents", self.COLUMN_CONTENTS)
示例3: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def __init__(self):
"""
Initializer
@param self this object
"""
super(ShowLastPackets.PacketList, self).__init__()
self.set_properties(hscrollbar_policy=gtk.POLICY_AUTOMATIC,
vscrollbar_policy=gtk.POLICY_AUTOMATIC)
self.table_model = gtk.ListStore(*([str]*4))
treeview = gtk.TreeView(self.table_model)
treeview.show()
self.add(treeview)
def add_column(descr, colid):
column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
treeview.append_column(column)
add_column("Time", self.COLUMN_TIME)
add_column("Interface", self.COLUMN_INTERFACE)
add_column("Size", self.COLUMN_SIZE)
add_column("Contents", self.COLUMN_CONTENTS)
示例4: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def __init__(self, o=None):
self.xml = x = gtk.glade.XML(sibpath(__file__, "inspectro.glade"))
self.tree_view = x.get_widget("treeview")
colnames = ["Name", "Value"]
for i in range(len(colnames)):
self.tree_view.append_column(
gtk.TreeViewColumn(
colnames[i], gtk.CellRendererText(), text=i))
d = {}
for m in reflect.prefixedMethods(self, "on_"):
d[m.im_func.__name__] = m
self.xml.signal_autoconnect(d)
if o is not None:
self.inspect(o)
self.ns = {'inspect': self.inspect}
iwidget = x.get_widget('input')
self.input = ConsoleInput(iwidget)
self.input.toplevel = self
iwidget.connect("key_press_event", self.input._on_key_press_event)
self.output = ConsoleOutput(x.get_widget('output'))
示例5: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def __init__(self, rfunction):
super(FunctionPanel, self).__init__()
self._rfunction = rfunction
formals = self._as_list(rfunction.formals())
formals_value = [x for x in formals.rx(-1)]
formals_name = [x for x in formals.rx(-1).names]
self._table = gtk.ListStore(str, str)
self._treeView = gtk.TreeView(model = self._table)
self._treeView.show()
self._valueColumns = [gtk.TreeViewColumn('parameter'),
gtk.TreeViewColumn('value'),]
self._valueCells = []
for col_i, col in enumerate(self._valueColumns):
self._treeView.append_column(col)
cr = gtk.CellRendererText()
col.pack_start(cr, True)
self._valueCells.append(cr)
col.set_attributes(cr, text=col_i)
for name, value in itertools.izip(formals_name, formals_value):
row = (name, value)
self._table.append(row)
sbox = gtk.HBox(homogeneous=False, spacing=0)
sbox.show()
示例6: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def __init__(self, path="gnome-connection-manager.glade",
root="wHost",
domain=domain_name, **kwargs):
path = os.path.join(glade_dir, path)
SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
self.treeModel = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
self.treeTunel.set_model(self.treeModel)
column = gtk.TreeViewColumn(_("Local"), gtk.CellRendererText(), text=0)
self.treeTunel.append_column( column )
column = gtk.TreeViewColumn(_("Host"), gtk.CellRendererText(), text=1)
self.treeTunel.append_column( column )
column = gtk.TreeViewColumn(_("Remoto"), gtk.CellRendererText(), text=2)
self.treeTunel.append_column( column )
#-- Whost.new {
示例7: new
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def new(self):
self.treeHosts = self.get_widget('treeHosts')
self.treeStore = gtk.TreeStore( gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_OBJECT )
for x in self.terms:
self.treeStore.append( None, (False, x[0], x[1]) )
self.treeHosts.set_model( self.treeStore )
crt = gtk.CellRendererToggle()
crt.set_property('activatable', True)
crt.connect('toggled', self.on_active_toggled)
col = gtk.TreeViewColumn(_("Activar"), crt, active=0)
self.treeHosts.append_column( col )
self.treeHosts.append_column(gtk.TreeViewColumn(_("Host"), gtk.CellRendererText(), text=1 ))
self.get_widget("txtCommands").history = []
#-- Wcluster.new }
#-- Wcluster custom methods {
# Write your own methods here
示例8: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def __init__(self, visualizer, node_index, statistics_collector):
InformationWindow.__init__(self)
self.win = gtk.Dialog(parent=visualizer.window,
flags=gtk.DIALOG_DESTROY_WITH_PARENT|gtk.DIALOG_NO_SEPARATOR,
buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
self.win.connect("response", self._response_cb)
self.win.set_title("Statistics for node %i" % node_index)
self.visualizer = visualizer
self.statistics_collector = statistics_collector
self.node_index = node_index
self.viz_node = visualizer.get_node(node_index)
self.table_model = gtk.ListStore(*([str]*13))
treeview = gtk.TreeView(self.table_model)
treeview.show()
self.win.vbox.add(treeview)
def add_column(descr, colid):
column = gtk.TreeViewColumn(descr, gtk.CellRendererText(), text=colid)
treeview.append_column(column)
add_column("Interface", self.COLUMN_INTERFACE)
add_column("Tx Packets", self.COLUMN_TX_PACKETS)
add_column("Tx Bytes", self.COLUMN_TX_BYTES)
add_column("Tx pkt/1s", self.COLUMN_TX_PACKET_RATE)
add_column("Tx bit/1s", self.COLUMN_TX_BIT_RATE)
add_column("Rx Packets", self.COLUMN_RX_PACKETS)
add_column("Rx Bytes", self.COLUMN_RX_BYTES)
add_column("Rx pkt/1s", self.COLUMN_RX_PACKET_RATE)
add_column("Rx bit/1s", self.COLUMN_RX_BIT_RATE)
self.visualizer.add_information_window(self)
self.win.show()
示例9: build_gui
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def build_gui(self):
"""
Build the GUI interface.
"""
vbox = gtk.VBox()
self.top = vbox
button_panel = gtk.Toolbar()
self.button_add = button_panel.insert_stock(gtk.STOCK_ADD, _("Add Mapping"), None, self.add_mapping_clicked, None, -1)
self.button_edit = button_panel.insert_stock(gtk.STOCK_EDIT, _("Edit Mapping"), None, self.edit_mapping_clicked, None, -1)
self.button_del = button_panel.insert_stock(gtk.STOCK_REMOVE, _("Remove Mapping"), None, self.remove_mapping_clicked, None, -1)
vbox.pack_start(button_panel, expand=False, fill=True, padding=5)
self.treestore = gtk.TreeStore(str, str)
self.treeview = gtk.TreeView(self.treestore)
self.treeview.connect("row-activated", self.row_double_clicked)
self.column1 = gtk.TreeViewColumn(_('Surname'))
self.column2 = gtk.TreeViewColumn(_('Group Name'))
self.treeview.append_column(self.column1)
self.treeview.append_column(self.column2)
self.cell1 = gtk.CellRendererText()
self.cell2 = gtk.CellRendererText()
self.column1.pack_start(self.cell1, True)
self.column1.add_attribute(self.cell1, 'text', 0)
self.column2.pack_start(self.cell2, True)
self.column2.add_attribute(self.cell2, 'text', 1)
self.treeview.set_search_column(0)
self.column1.set_sort_column_id(0)
self.column2.set_sort_column_id(1)
vbox.pack_start(self.treeview, expand=True, fill=True)
return vbox
示例10: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def __init__(self, items=()):
gtk.Dialog.__init__(self)
self.ret = None
self._started = 0
self.connect("destroy", self.quit)
self.connect("delete_event", self.quit)
self.set_geometry_hints(min_width=250, min_height=300)
scrolled_win = gtk.ScrolledWindow()
scrolled_win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scrolled_win.show()
self.vbox.pack_start(scrolled_win)
#self.vbox.show()
button = gtk.Button("Cancel")
button.connect("clicked", self.cancel)
button.set_flags(gtk.CAN_DEFAULT)
self.action_area.pack_start(button)
button.show()
ls = gtk.ListStore(gobject.TYPE_STRING)
for item in items:
iter = ls.append()
ls.set(iter, 0, item)
lister = gtk.TreeView(ls)
selection = lister.get_selection()
selection.set_mode(gtk.SELECTION_BROWSE)
selection.unselect_all()
lister.set_search_column(0)
scrolled_win.add_with_viewport(lister)
column = gtk.TreeViewColumn('Keyword', gtk.CellRendererText(), text=0)
lister.append_column(column)
lister.set_headers_visible(False)
lister.connect("row-activated", self.row_activated)
lister.show()
示例11: init_treestore
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def init_treestore(self, treeview, header):
"""builds the treestore that will be used to hold the files info
Args:
treeview: treeview widget to initialize.
header: the column Header to use.
"""
model = gtk.TreeStore(str, str)
treeview.set_model(model)
renderer = gtk.CellRendererText()
column = gtk.TreeViewColumn(header, renderer, text=1)
treeview.append_column(column)
示例12: populate_settings
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def populate_settings(self, settings):
"""populates the UI widgets with the given settings"""
# workaround for new settings being overwritten by previous settings
if self.gather_time:
if time.time() - self.gather_time < 1:
return
self.config = settings
self.saved_handlers = settings["saved_handlers"]
self.handlers_list.clear()
for name in self.saved_handlers:
self.handlers_list.add([name])
rules = settings["auto_sort_rules"]
if len(self.rules_list.view.get_columns()) == 4: # force refresh
self.rules_list.view.remove_column(self.rules_list.view.get_column(3))
self.rule_handler_combo = build_combo_cellrenderer(
self.handlers_list.model, self.on_rule_handler_combo_changed)
column_name = "Profile to Use:"
column = gtk.TreeViewColumn(column_name, self.rule_handler_combo, text=3)
self.rules_list.view.append_column(column)
self.rules_list.clear()
for rule in rules:
self.rules_list.add(rule[1:])
for column in self.rules_list.view.get_columns():
column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
column.set_resizable(True)
if not rules:
for column in self.rules_list.view.get_columns():
column.set_expand(True)
示例13: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeViewColumn [as 别名]
def __init__(self):
self.xml = gtk.glade.XML(util.sibpath(__file__,"gladereactor.glade"))
d = {}
for m in reflect.prefixedMethods(self, "on_"):
d[m.im_func.__name__] = m
self.xml.signal_autoconnect(d)
self.xml.get_widget('window1').connect('destroy',
lambda w: self.stop())
self.servers = self.xml.get_widget("servertree")
sel = self.servers.get_selection()
sel.set_mode(gtk.SELECTION_SINGLE)
sel.connect("changed",
self.servers_selection_changed)
## argh coredump: self.servers_selection_changed(sel)
self.xml.get_widget('suspend').set_sensitive(0)
self.xml.get_widget('disconnect').set_sensitive(0)
# setup model, connect it to my treeview
self.model = gtk.ListStore(str, object, gobject.TYPE_BOOLEAN,
gobject.TYPE_BOOLEAN)
self.servers.set_model(self.model)
self.servers.set_reorderable(1)
self.servers.set_headers_clickable(1)
# self.servers.set_headers_draggable(1)
# add a column
for col in [
gtk.TreeViewColumn('Server',
gtk.CellRendererText(),
text=0),
gtk.TreeViewColumn('Reading',
gtk.CellRendererToggle(),
active=2),
gtk.TreeViewColumn('Writing',
gtk.CellRendererToggle(),
active=3)]:
self.servers.append_column(col)
col.set_resizable(1)
sup.__init__(self)