Exemplo n.º 1
0
 def change(self, item):
     row_index = self.table.rowForView(self._view_for_row[item])
     row_indexes = NSIndexSet.indexSetWithIndex(row_index)
     column_indexes = NSIndexSet.indexSetWithIndexesInRange(
         NSRange(0, len(self.columns)))
     self.table.reloadDataForRowIndexes(row_indexes,
                                        columnIndexes=column_indexes)
Exemplo n.º 2
0
    def insert(self, index, item):
        # set parent = None if inserting to the root item
        index_set = NSIndexSet.indexSetWithIndex(index)

        self.table.insertRowsAtIndexes(
            index_set,
            withAnimation=NSTableViewAnimation.EffectNone
        )
Exemplo n.º 3
0
 def remove(self, item):
     try:
         index = self.tree.childIndexForItem(item._impl)
     except AttributeError:
         pass
     else:
         index_set = NSIndexSet.indexSetWithIndex(index)
         parent = self.tree.parentForItem(item._impl)
         self.tree.removeItemsAtIndexes(
             index_set,
             inParent=parent,
             withAnimation=NSTableViewAnimation.SlideUp.value)
Exemplo n.º 4
0
    def insert(self, parent, index, item):
        # set parent = None if inserting to the root item
        index_set = NSIndexSet.indexSetWithIndex(index)
        if parent is self.interface.data:
            parent = None
        else:
            parent = getattr(parent, '_impl', None)

        self.tree.insertItemsAtIndexes(
            index_set,
            inParent=parent,
            withAnimation=NSTableViewAnimation.SlideDown.value)
Exemplo n.º 5
0
 def remove(self, item):
     try:
         # We can't get the index from self.interface.data because the
         # row has already been removed. Instead we look up the index
         # from an associated view.
         view = self._view_for_row.pop(item)
         index = self.table.rowForView(view)
     except KeyError:
         pass
     else:
         indexes = NSIndexSet.indexSetWithIndex(index)
         self.table.removeRowsAtIndexes(
             indexes, withAnimation=NSTableViewAnimation.SlideUp)
Exemplo n.º 6
0
 def remove(self, index, item):
     indexes = NSIndexSet.indexSetWithIndex(index)
     self.table.removeRowsAtIndexes(
         indexes, withAnimation=NSTableViewAnimation.EffectNone)