当前位置: 首页>>代码示例>>Python>>正文


Python gtk.ListStore方法代码示例

本文整理汇总了Python中gtk.ListStore方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.ListStore方法的具体用法?Python gtk.ListStore怎么用?Python gtk.ListStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gtk的用法示例。


在下文中一共展示了gtk.ListStore方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [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) 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:19,代码来源:show_last_packets.py

示例2: inflate_list_store_combo

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [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) 
开发者ID:Laharah,项目名称:deluge-FileBotTool,代码行数:21,代码来源:common.py

示例3: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [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) 
开发者ID:KTH,项目名称:royal-chaos,代码行数:23,代码来源:show_last_packets.py

示例4: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [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() 
开发者ID:rpy2,项目名称:rpy2,代码行数:27,代码来源:radmin.py

示例5: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [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 { 
开发者ID:mjun,项目名称:gnome-connection-manager,代码行数:19,代码来源:gnome_connection_manager.py

示例6: setupChunkList

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [as 别名]
def setupChunkList(self):
        tree = self.getWidget("Win32ChunkList")
        tree.modify_font(self.font)
        col1 = vw_util.makeColumn("Chunkaddr", 1)
        col2 = vw_util.makeColumn("Size", 2)
        col3 = vw_util.makeColumn("Busy", 3) # FIXME make a picture?
        col4 = vw_util.makeColumn("Bytes", 4)
        tree.append_column(col1)
        tree.append_column(col2)
        tree.append_column(col3)
        tree.append_column(col4)
        store =  gtk.ListStore(object,str,str,str,str)
        tree.set_model(store) 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:15,代码来源:windows.py

示例7: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [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() 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:38,代码来源:interface_statistics.py

示例8: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [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() 
开发者ID:kdart,项目名称:pycopia,代码行数:38,代码来源:gtktools.py

示例9: set_value

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [as 别名]
def set_value(self, iter, column, value):
        """See gtk.ListStore.set_value"""
        self.model.set_value(iter, column, value) 
开发者ID:Laharah,项目名称:deluge-FileBotTool,代码行数:5,代码来源:common.py

示例10: clear

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [as 别名]
def clear(self):
        """clear the ListStore"""
        self.model.clear() 
开发者ID:Laharah,项目名称:deluge-FileBotTool,代码行数:5,代码来源:common.py

示例11: replace_model

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [as 别名]
def replace_model(self, new_model):
        """
        replace the model with new_model
        Args:
            new_model: gtk.ListStore
        """

        self.model = new_model
        self.view.set_model(self.model) 
开发者ID:Laharah,项目名称:deluge-FileBotTool,代码行数:11,代码来源:common.py

示例12: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [as 别名]
def __init__(self, p):
        self.p = p
        vals = [time.time()]
        if p.inLog:
            vals.append(p.inLog[0][0])
        if p.outLog:
            vals.append(p.outLog[0][0])
        self.startTime = min(vals)
        p.logViewer = self
        self.xml = x = gtk.glade.XML(sibpath(__file__, "logview.glade"))
        self.xml.signal_autoconnect(self)
        self.loglist = self.xml.get_widget("loglist")
        # setup model, connect it to my treeview
        self.model = gtk.ListStore(str, str, str)
        self.loglist.set_model(self.model)
        self.loglist.set_reorderable(1)
        self.loglist.set_headers_clickable(1)
        # self.servers.set_headers_draggable(1)
        # add a column
        for col in [
            gtk.TreeViewColumn('Time',
                               gtk.CellRendererText(),
                               text=0),
            gtk.TreeViewColumn('D',
                               gtk.CellRendererText(),
                               text=1),
            gtk.TreeViewColumn('Data',
                               gtk.CellRendererText(),
                               text=2)]:
            self.loglist.append_column(col)
            col.set_resizable(1)
        r = []
        for t, data in p.inLog:
            r.append(((str(t - self.startTime), "R", repr(data)[1:-1])))
        for t, data in p.outLog:
            r.append(((str(t - self.startTime), "S", repr(data)[1:-1])))
        r.sort()
        for i in r:
            self.model.append(i) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:41,代码来源:_inspectro.py

示例13: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import ListStore [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) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:40,代码来源:gladereactor.py


注:本文中的gtk.ListStore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。