Пример #1
0
 def updateLocation(self, pathHelix, scenePos, *args):
     AbstractPathTool.updateLocation(self, pathHelix, scenePos, *args)
     if pathHelix == None:
         return
     posItem = pathHelix.mapFromScene(scenePos)
     strandType, baseIdx = self.baseAtPoint(pathHelix, posItem)
     vh = pathHelix.vhelix()
     if strandType == StrandType.Scaffold:
         oppositeStrand = StrandType.Staple
     else:
         oppositeStrand = StrandType.Scaffold
     if vh.hasLoopOrSkipAt(strandType, baseIdx) > 0:
         loopBases = vh.hasLoopOrSkipAt(strandType, baseIdx)
         compLoopBases = vh.hasLoopOrSkipAt(oppositeStrand, baseIdx)
         if loopBases != compLoopBases and strandType == StrandType.Staple:
             newLoc = pathHelix.baseLocation(strandType, baseIdx)
             if self.pos() != newLoc:
                 self.setPos(*newLoc)
             if not self.isVisible():
                 self.show()
             return
     if vh.hasEmptyAt(strandType, baseIdx):
         if self.isVisible():
             self.hide()
         return
     fivePBase = pathHelix.vhelix().fivePEndOfSegmentThrough(StrandType.Scaffold, baseIdx)
     if fivePBase == None:
         self.hide()
     else:
         vh, strandType, idx = fivePBase
         phg = pathHelix.pathHelixGroup()
         ph2 = phg.pathHelixForVHelix(vh)
         fivePBaseLoc = QPointF(*ph2.baseLocation(strandType, idx))
         fivePBaseLocSelfCoords = pathHelix.mapFromItem(ph2, fivePBaseLoc)
         self.setPos(fivePBaseLocSelfCoords)
         if not self.isVisible():
             self.show()