def pasteClipboard(self): """ """ if self.clip_board is None: return doc = self.manager.document part_item = self.part_item part = part_item.part() sgv = self.slice_graphics_view # 1. get mouse point at the paste qc = QCursor() global_pos = qc.pos() view_pt = sgv.mapFromGlobal(global_pos) s_pt = sgv.mapToScene(view_pt) to_pt = part_item.mapFromScene(s_pt) # print("To Grid Point", to_pt.x(), to_pt.y()) # self.vhi_hint_item.setParentItem(part_item) # self.setHintPos(to_pt) # self.vhi_hint_item.show() # 2. Calculate a delta from the CORNER of the selection box sf = part_item.scaleFactor() delta = to_pt - self.copy_pt distance_offset = delta.x() / sf, -delta.y() / sf part_instance = self.part_item.partInstance() new_vh_set = v3decode.importToPart(part_instance, self.clip_board, offset=distance_offset) self.modelClearSelected()
def pasteClipboard(self): """ """ if self.clip_board is None: return doc = self.manager.document part_item = self.part_item part = part_item.part() sgv = self.slice_graphics_view # 1. get mouse point at the paste qc = QCursor() global_pos = qc.pos() view_pt = sgv.mapFromGlobal(global_pos) s_pt = sgv.mapToScene(view_pt) to_pt = part_item.mapFromScene(s_pt) # print("To Grid Point", to_pt.x(), to_pt.y()) # self.vhi_hint_item.setParentItem(part_item) # self.setHintPos(to_pt) # self.vhi_hint_item.show() # 2. Calculate a delta from the CORNER of the selection box sf = part_item.scaleFactor() delta = to_pt - self.copy_pt distance_offset = delta.x()/sf, -delta.y()/sf part_instance = self.part_item.partInstance() new_vh_set = v3decode.importToPart( part_instance, self.clip_board, offset=distance_offset) self.modelClearSelected()
def pasteClipboard(self): """Summary Returns: TYPE: Description """ doc = self.manager.document part = self.part_item.part() part_instance = self.part_item.partInstance() doc.undoStack().beginMacro("Paste VirtualHelices") new_vh_set = v3decode.importToPart(part_instance, self.clipboard) doc.undoStack().endMacro() self.modelClear() doc.addVirtualHelicesToSelection(part, new_vh_set)
def pasteClipboard(self): """Summary Returns: TYPE: Description """ doc = self.manager.document part = self.part_item.part() part_instance = self.part_item.partInstance() doc.undoStack().beginMacro("Paste VirtualHelices") new_vh_set = v3decode.importToPart(part_instance, self.clip_board) doc.undoStack().endMacro() self.modelClear() doc.addVirtualHelicesToSelection(part, new_vh_set)
def pasteClipboard(self): """Summary Returns: TYPE: Description """ doc = self.manager.document # part = self.part_item.part() part_instance = self.part_item.partInstance() offset = self.part_item.copypaste_origin_offset # Abort if there is no offset (e.g. if the location is invalid) if offset is None: return doc.undoStack().beginMacro("Paste VirtualHelices") new_vh_set = v3decode.importToPart(part_instance, self.clipboard, offset, ignore_neighbors=True) doc.undoStack().endMacro() self.modelClear() self.clipboard = None # doc.addVirtualHelicesToSelection(part, new_vh_set) return new_vh_set
def pasteClipboard(self): """Summary Returns: TYPE: Description """ doc = self.manager.document # part = self.part_item.part() part_instance = self.part_item.partInstance() offset = self.part_item.copypaste_origin_offset # Abort if there is no offset (e.g. if the location is invalid) if offset is None: return doc.undoStack().beginMacro("Paste VirtualHelices") new_vh_set = v3decode.importToPart(part_instance, self.clipboard, offset) doc.undoStack().endMacro() self.modelClear() self.clipboard = None # doc.addVirtualHelicesToSelection(part, new_vh_set) return new_vh_set