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


Python gtk.TreeStore方法代码示例

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


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

示例1: new

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

示例2: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeStore [as 别名]
def __init__(self, cfg, cfgname=None):
        """
        A dialog for editing config options.  If you specify "cfgname",
        all changes will be saved out to the specified file
        as they happen.
        """
        dname = os.path.dirname(vwidget.__file__)
        fname = os.path.join(dname, "config.glade")
        vw_windows.VWindow.__init__(self, fname, (0,0,500,300))

        self.setGeometry((0,0,500,300))

        self.cfg = cfg
        self.cfgname = cfgname

        tree = self.getWidget("ConfigTree")
        tree.append_column(vw_util.makeColumn("Section",1))
        tree.append_column(vw_util.makeColumn("Option",2))
        tree.append_column(vw_util.makeColumn("Value", 3, self.OptionEdited))

        model = gtk.TreeStore(str,str,str,str)
        tree.set_model(model)

        secs = cfg.sections()
        secs.sort()
        for sec in secs:
            i = model.append(None, (None, sec, None, None))
            opts = cfg.options(sec)
            opts.sort()
            for opt in opts:
                model.append(i, ("%s|%s" % (sec,opt), None, opt, cfg.get(sec, opt))) 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:33,代码来源:config.py

示例3: setupHeapTree

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeStore [as 别名]
def setupHeapTree(self):
        tree = self.getWidget("Win32HeapTree")
        tree.modify_font(self.font)
        col1 = vw_util.makeColumn("Heap", 1)
        col2 = vw_util.makeColumn("Segment", 2)
        tree.append_column(col1)
        tree.append_column(col2)
        store =  gtk.TreeStore(object,str,str)
        tree.set_model(store)
        self.updateHeapTree(tree) 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:12,代码来源:windows.py

示例4: build_gui

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeStore [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 
开发者ID:gramps-project,项目名称:addons-source,代码行数:40,代码来源:SurnameMappingGramplet.py

示例5: init_treestore

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

示例6: initLeftPane

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeStore [as 别名]
def initLeftPane(self):
        global groups       

        self.treeModel = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT, gtk.gdk.Pixbuf)
        self.treeServers.set_model(self.treeModel)

        self.treeServers.set_level_indentation(5)
        #Force the alternating row colors, by default it's off with one column
        self.treeServers.set_property('rules-hint', True)
        gtk.rc_parse_string( """
                style "custom-treestyle"{
                    GtkTreeView::allow-rules = 1
                }
                widget "*treeServers*" style "custom-treestyle"
            """)
        column = gtk.TreeViewColumn()
        column.set_title('Servers')
        self.treeServers.append_column( column )

        renderer = gtk.CellRendererPixbuf()
        column.pack_start(renderer, expand=False)
        column.add_attribute(renderer, 'pixbuf', 2)

        renderer = gtk.CellRendererText()
        column.pack_start(renderer, expand=True)
        column.add_attribute(renderer, 'text', 0)
        
        self.treeServers.set_has_tooltip(True)
        self.treeServers.connect('query-tooltip', self.on_treeServers_tooltip)
        self.loadConfig()
        self.updateTree() 
开发者ID:mjun,项目名称:gnome-connection-manager,代码行数:33,代码来源:gnome_connection_manager.py

示例7: load_treestore

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeStore [as 别名]
def load_treestore(self, treeview, file_data, clear=False, title=None):
        """
        Loads file_data into given treeview
        Args:
            file_data: dict containing file info from deluge
            treeview: treeview widget to load into
            clear: clear the treestore of old data
            title: The title at the top of treeview widget (requires clear)

        Returns: None
        """
        if clear:
            if title:
                for column in treeview.get_columns():
                    treeview.remove_column(column)
                self.init_treestore(treeview, title)
            model = gtk.TreeStore(str, str)
            treeview.set_model(model)
        if not file_data:
            return
        index_path_pairs = [(f["index"], f["path"]) for f in file_data]
        model = treeview.get_model()
        folder_iterators = {}
        folder_structure = {}
        for index, path in index_path_pairs:
            path_parts = path.split('/')
            if len(path_parts) == 1:
                model.append(None, [index, path])

            else:  # not a single file, torrent is a folder.
                for path_depth in range(len(path_parts)):
                    try:
                        folder_structure[path_depth]
                    except KeyError:
                        folder_structure[path_depth] = []

                    if path_parts[path_depth] not in folder_structure[path_depth]:
                        folder_structure[path_depth].append(path_parts[path_depth])

                        try:
                            parent = folder_iterators[path_depth - 1]
                        except KeyError:
                            parent = None

                        if path_parts[path_depth] == os.path.basename(path):
                            model.append(parent, [str(index), path_parts[path_depth]])
                        else:
                            folder_iterator = model.append(parent,
                                                           ['', path_parts[path_depth]])
                            folder_iterators[path_depth] = folder_iterator

        treeview.expand_all() 
开发者ID:Laharah,项目名称:deluge-FileBotTool,代码行数:54,代码来源:rename_dialog.py

示例8: _init_gui

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import TreeStore [as 别名]
def _init_gui(self):
    self._tree_model = gtk.TreeStore(*[column[1] for column in self._COLUMNS])
    
    self._tree_view = gtk.TreeView(model=self._tree_model)
    self._tree_view.set_headers_visible(False)
    self._tree_view.set_enable_search(False)
    self._tree_view.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
    
    self._init_icons()
    
    self._init_tags_menu()
    
    column = gtk.TreeViewColumn(b"")
    
    cell_renderer_icon_layer = gtk.CellRendererPixbuf()
    column.pack_start(cell_renderer_icon_layer, expand=False)
    column.set_attributes(cell_renderer_icon_layer, pixbuf=self._COLUMN_ICON_LAYER[0])
    
    cell_renderer_icon_tag = gtk.CellRendererPixbuf()
    cell_renderer_icon_tag.set_property("pixbuf", self._icons["tag"])
    column.pack_start(cell_renderer_icon_tag, expand=False)
    column.set_attributes(
      cell_renderer_icon_tag,
      visible=self._COLUMN_ICON_TAG_VISIBLE[0])
    
    cell_renderer_layer_name = gtk.CellRendererText()
    column.pack_start(cell_renderer_layer_name, expand=False)
    column.set_attributes(
      cell_renderer_layer_name,
      text=self._COLUMN_LAYER_NAME[0],
      sensitive=self._COLUMN_LAYER_NAME_SENSITIVE[0])
    
    self._tree_view.append_column(column)
    
    self._scrolled_window = gtk.ScrolledWindow()
    self._scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
    self._scrolled_window.add(self._tree_view)
    
    self.pack_start(self._scrolled_window)
    
    self._tree_view.connect("row-collapsed", self._on_tree_view_row_collapsed)
    self._tree_view.connect("row-expanded", self._on_tree_view_row_expanded)
    self._tree_view.get_selection().connect("changed", self._on_tree_selection_changed)
    self._tree_view.connect("event", self._on_tree_view_right_button_press_event) 
开发者ID:khalim19,项目名称:gimp-plugin-export-layers,代码行数:46,代码来源:preview_name.py


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