本文整理汇总了Python中gtk.CellRendererText方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.CellRendererText方法的具体用法?Python gtk.CellRendererText怎么用?Python gtk.CellRendererText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.CellRendererText方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeColumn
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [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 CellRendererText [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: inflate_list_store_combo
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [as 别名]
def inflate_list_store_combo(model_data, combo_widget):
"""inflates an individual combo box
Args:
model_data: data to be loaded into a list store (list)
combo_widget: the widget to load data into.
"""
empty = True
if combo_widget.get_model():
empty = False
list_store = gtk.ListStore(str)
for datum in model_data:
list_store.append([datum])
combo_widget.set_model(list_store)
if empty:
renderer = gtk.CellRendererText()
combo_widget.pack_start(renderer, expand=True)
combo_widget.add_attribute(renderer, "text", 0)
示例4: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [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)
示例5: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [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'))
示例6: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [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()
示例7: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [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 {
示例8: new
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [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
示例9: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [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()
示例10: on_selection_changed
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [as 别名]
def on_selection_changed(self, *args):
(path, col) = self.get_cursor()
ren = col.get_cell_renderers()[0]
if isinstance(ren, gtk.CellRendererText):
self.set_cursor_on_cell(path, col, ren, start_editing=True)
示例11: build_gui
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [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
示例12: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [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()
示例13: init_treestore
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [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)
示例14: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererText [as 别名]
def __init__(self):
self.__gobject_init__()
self.prend = gtk.CellRendererPixbuf()
self.trend = gtk.CellRendererText()
self.percent = 0