def __dropLinks(self, links): if not links: return False dropMenu = QtGui.QMenu() repAct = dropMenu.addAction("Replicate here") copyAct = dropMenu.addAction("Copy here") dropMenu.addSeparator() dropMenu.addAction("Abort") copyAct.setEnabled( any([isinstance(l, struct.DocLink) for l in links])) action = dropMenu.exec_(QtGui.QCursor.pos()) if action is repAct: for link in links: self.insertLink(link) self.__parent.save() if isinstance(link, struct.DocLink): Connector().replicateDoc(link.store(), link.doc(), self.__store) else: Connector().replicateRev(link.store(), link.rev(), self.__store) elif action is copyAct: for link in links: if isinstance(link, struct.RevLink): self.insertLink(link) self.__parent.save() Connector().replicateRev(link.store(), link.rev(), self.__store) else: with struct.copyDoc(link, self.__store) as handle: self.insertLink(struct.DocLink(self.__store, handle.getDoc())) self.__parent.save() else: return False return True
def __dropLinks(self, links): if not links: return False dropMenu = QtGui.QMenu() repAct = dropMenu.addAction("Replicate here") copyAct = dropMenu.addAction("Copy here") dropMenu.addSeparator() dropMenu.addAction("Abort") copyAct.setEnabled( any([isinstance(l, connector.DocLink) for l in links])) action = dropMenu.exec_(QtGui.QCursor.pos()) if action is repAct: for link in links: if self.validateDragEnter(link): handle = ReplicateHelper(self.__parent, self.__store, link) try: self.insertLink(link) self.__parent.save() finally: handle.close() elif action is copyAct: for link in links: if isinstance(link, connector.RevLink): if self.validateDragEnter(link): handle = ReplicateHelper(self.__parent, self.__store, link) try: self.insertLink(link) self.__parent.save() finally: handle.close() else: with struct.copyDoc(link, self.__store) as handle: self.insertLink( connector.DocLink(self.__store, handle.getDoc())) self.__parent.save() else: return False return True
def __dropLinks(self, links): if not links: return False dropMenu = QtGui.QMenu() repAct = dropMenu.addAction("Replicate here") copyAct = dropMenu.addAction("Copy here") dropMenu.addSeparator() dropMenu.addAction("Abort") copyAct.setEnabled( any([isinstance(l, connector.DocLink) for l in links])) action = dropMenu.exec_(QtGui.QCursor.pos()) if action is repAct: for link in links: if self.validateDragEnter(link): handle = ReplicateHelper(self.__parent, self.__store, link) try: self.insertLink(link) self.__parent.save() finally: handle.close() elif action is copyAct: for link in links: if isinstance(link, connector.RevLink): if self.validateDragEnter(link): handle = ReplicateHelper(self.__parent, self.__store, link) try: self.insertLink(link) self.__parent.save() finally: handle.close() else: with struct.copyDoc(link, self.__store) as handle: self.insertLink(connector.DocLink(self.__store, handle.getDoc())) self.__parent.save() else: return False return True