示例#1
0
 def mousePressEvent(self, e):
     pe = e.pos()
     ps = e.scenePos()
     pc = self.path().currentPosition()
     logger.debug(
         'DragPoint.mousePressEvent at point (%6.1f, %6.1f) on scene (%6.1f, %6.1f) currentPosition (%6.1f, %6.1f)'
         % (pe.x(), pe.y(), ps.x(), ps.y(), pc.x(), pc.y()))
     self.setSelected(True)
     #print("DragPoint is selected: ", self.isSelected())
     QGraphicsPathItem.mousePressEvent(self, e)
     parent = self.parentItem()
     if parent is not None: parent.mousePressEvent(e)
示例#2
0
    def mousePress(self, event):
        if event.button() != Qt.LeftButton:
            return QGraphicsPathItem.mousePressEvent(self, event)

        if event.modifiers() & Qt.ShiftModifier:
            return  # ignore shift click, user is probably trying to merge

        if self._is_active:
            from_vh = self._from_vh_item.virtualHelix()
            to_vh = self._to_vh_item.virtualHelix()
            from_ss = from_vh.getStrandSetByType(self._strand_type)
            to_ss = to_vh.getStrandSetByType(self._strand_type)
            from_strand = from_ss.getStrand(self._idx)
            to_strand = to_ss.getStrand(self._idx)
            part = self._from_vh_item.part()
            # determine if we are a 5' or a 3' end
            if self.path() in [_PPATH_LU, _PPATH_RD]:  # 3' end of strand5p clicked
                strand5p = from_strand
                strand3p = to_strand
            else:  # 5'
                strand5p = to_strand
                strand3p = from_strand

            # Gotta clear selections when installing a prexover
            # otherwise parenting in screwed up
            self._from_vh_item.viewroot().clearStrandSelections()

            part.createXover(strand5p, self._idx, strand3p, self._idx)
        else:
            event.setAccepted(False)