本文整理汇总了Python中gtk.CellRendererToggle方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.CellRendererToggle方法的具体用法?Python gtk.CellRendererToggle怎么用?Python gtk.CellRendererToggle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.CellRendererToggle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererToggle [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
示例2: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import CellRendererToggle [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)