def tableViewSelectionDidChange_(self, notification): if self.on_selection_changed is None: return table = notification.object() if table.numberOfSelectedRows() < 1: self.on_selection_changed([]) elif table.numberOfSelectedRows() > 1: raise NotImplementedError else: item = self.content.arrangedObjects()[table.selectedRow()] self.on_selection_changed([proxy_target(item)])
def objectAtArrangedIndexPath_(self, path): return proxy_target(self.arrangedObjects().objectAtIndexPath_(path))
def selected_objects(self): return [proxy_target(obj) for obj in self.selectedObjects()]
def onDoubleClick_(self, sender): row = self.table.clickedRow() items = self.content.arrangedObjects() if row >= 0 and row < len(items): self.double_click_callback(proxy_target(items[row]))
def representedObject(node): try: return proxy_target(node.representedObject()) except AttributeError: return proxy_target(node.observedObject())