def _hide_editor(self, save = False): self.unbind("<<TreeviewSelect>>") self.focus_displayof().update() item = getattr(self, "ITEM") if save: result = dict((name, widget.get()) for (name, widget) in self.editor.children.items()) record = self._2pdb(item) if record: self.pdb.update(record, **result) self.item(item, values = self._2tree(result)) else: id_ = self.pdb.insert(**result) self.pdb.update(self.pdb[id_]) self.item(item, tags = id_, values = self._2tree(result)) self.pdb.commit() if self.item(item, "tags") == "": Tree.delete(self, item) for widget in tuple(w for w in self.editor.children.values()): widget.clear() self.editor.place_forget() self.focus() delattr(self, "ITEM") delattr(self, "BBOX") self.unbind("<Configure>", getattr(self, "CNFEDIT")) delattr(self, "CNFEDIT")
def delete(self, event = None): selection = self.selection() self.pdb.delete(self._2pdb(item) for item in selection) self.pdb.commit() Tree.delete(self, *selection)