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)
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 )
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)
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)
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)
def remove(self, index, item): indexes = NSIndexSet.indexSetWithIndex(index) self.table.removeRowsAtIndexes( indexes, withAnimation=NSTableViewAnimation.EffectNone)