Home | Trees | Indices | Help |
---|
|
1 # -*- coding: utf-8 -*- 2 # Elisa - Home multimedia server 3 # Copyright (C) 2006-2008 Fluendo Embedded S.L. (www.fluendo.com). 4 # All rights reserved. 5 # 6 # This file is available under one of two license agreements. 7 # 8 # This file is licensed under the GPL version 3. 9 # See "LICENSE.GPL" in the root of this distribution including a special 10 # exception to use Elisa with Fluendo's plugins. 11 # 12 # The GPL part of Elisa is also available under a commercial licensing 13 # agreement from Fluendo. 14 # See "LICENSE.Elisa" in the root directory of this distribution package 15 # for details on that license. 16 17 18 __maintainer__ = 'Lionel Martin <lionel@fluendo.com>' 19 20 21 import pygtk 22 pygtk.require('2.0') 23 import gtk 24 25 from elisa.core import plugin_registry 26 TreeViewClass = plugin_registry.get_component_class('base:tree_view') 2729 """ 30 This class implements gtk tree view support 31 """ 32 33 supported_controllers = ('base:tree_controller', 'poblenou:tree_controller') 34 399741 treestore = gtk.TreeStore(str) 42 self.treeview = gtk.TreeView(treestore) 43 self.context_handle = self.treeview 44 tvcolumn = gtk.TreeViewColumn('Column 0') 45 self.treeview.append_column(tvcolumn) 46 cell = gtk.CellRendererText() 47 #self.cell1.set_property('cell-background', 'pink') 48 tvcolumn.pack_start(cell, True) 49 tvcolumn.add_attribute(cell, 'text', 0) 50 self.treeview.set_search_column(0) 51 52 tree_selection = self.treeview.get_selection() 53 tree_selection.set_mode(gtk.SELECTION_SINGLE) 54 self.treeview.connect("cursor-changed", self._gtk_selection_changed)55 5658 TreeViewClass.controller_changed(self, old_controller, new_controller) 59 self.select_from_view(self)60 6163 TreeViewClass.child_view_creating(self, view, controller, position) 64 view.create_node(controller, position)65 66 6971 path = tuple( view.get_path() ) 72 if path == (): 73 path = (0,) 74 selection = self.treeview.get_selection() 75 selection.select_path( path )76 8284 if key == 'current_index': 85 self.select_from_view(self[new_value]) 86 if key == 'selected': 87 if new_value == True: 88 index = self.controller.current_index 89 self.root.select_from_view(self[index])9092 treemodel, iter = self.treeview.get_selection().get_selected() 93 path = treemodel.get_path(iter) 94 selected_view = self.get_view_from_path(path) 95 selected_view.parent.controller.current_index = path[-1] 96 selected_view.parent.controller.selected = True
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Jan 16 19:10:49 2008 | http://epydoc.sourceforge.net |