Esempio n. 1
0
 def set_items(self, items, parent = None):
     logger.debug('setting items for current navpane section')
     section_tree = self.findChild(QtGui.QWidget, 'SectionTree')
     if section_tree:
         if parent == None:
             # take a copy, so the copy can be extended
             self._items = list(i for i in items)
             section_tree.clear()
             section_tree.clear_model_items()
             parent = section_tree
 
         if not items: return
 
         for item in items:
             label = item.get_verbose_name()
             icon = item.get_icon()
             model_item = ModelItem( parent, 
                                     [unicode(label)],
                                     item )
             if icon:
                 model_item.set_icon(icon.getQIcon())
             section_tree.modelitems.append( model_item )
             if isinstance( item, Section ):
                 child_items = item.get_items()
                 self.set_items( child_items, parent = model_item )
                 self._items.extend( child_items )
                 
         section_tree.resizeColumnToContents( 0 )
Esempio n. 2
0
 def set_items(self, items):
     logger.debug('setting items for current navpane section')
     section_tree = self.findChild(QtGui.QWidget, 'SectionTree')
     self._items = items
     if section_tree:
         section_tree.clear()
         section_tree.clear_model_items()
 
         if not items: return
 
         for item in items:
             label = item.get_verbose_name()
             icon = item.get_icon()
             model_item = ModelItem( section_tree, 
                                     [unicode(label)],
                                     item )
             if icon:
                 model_item.set_icon(icon.getQIcon())
             section_tree.modelitems.append( model_item )
         section_tree.resizeColumnToContents( 0 )