Exemplo n.º 1
0
 def GetParent(self, item):
     index = self._to_index(item)
     if index == Root:
         return DataViewItem()
     parent, row = self.model.index_manager.get_parent_and_row(index)
     parent_id = self.model.index_manager.id(parent)
     if parent_id == 0:
         return DataViewItem()
     return DataViewItem(parent_id)
Exemplo n.º 2
0
 def GetChildren(self, item, children):
     index = self._to_index(item)
     row_index = self.model.index_manager.to_sequence(index)
     n_children = self.model.get_row_count(row_index)
     for i in range(n_children):
         child_index = self.model.index_manager.create_index(index, i)
         child_id = self.model.index_manager.id(child_index)
         children.append(DataViewItem(child_id))
     return n_children
Exemplo n.º 3
0
 def _to_item(self, row_index):
     if len(row_index) == 0:
         return DataViewItem()
     index = self.model.index_manager.from_sequence(row_index)
     id = self.model.index_manager.id(index)
     return DataViewItem(id)