コード例 #1
0
    def mousePressEvent(self, event):
        '''
    On mouse button down, create a new (infinitesmal) SegmentString and PointerTrackGhost.
    freehandTool remembers and updates SegmentString.
    '''
        pointerEvent = PointerEvent()
        pointerEvent.makeFromEvent(mapper=self, event=event)
        '''
    freehandCurve as QGraphicsItem positioned at event in scene.
    It keeps its internal data in its local CS
    '''
        freehandCurve = SegmentString()
        self.scene().addItem(freehandCurve)
        freehandCurve.setPos(pointerEvent.scenePos)
        '''
    headGhost at (0,0) in scene
    it keeps its local data in CS equivalent to scene
    '''
        headGhost = PointerTrackGhost()
        self.scene().addItem(headGhost)

        self.freehandTool.setSegmentString(segmentString=freehandCurve,
                                           pathHeadGhost=headGhost,
                                           scenePosition=pointerEvent.scenePos)
        self.freehandTool.pointerPressEvent(pointerEvent)
コード例 #2
0
ファイル: freehandApp.py プロジェクト: bootchk/freehandTool
  def mousePressEvent(self, event):
    '''
    On mouse button down, create a new (infinitesmal) SegmentString and PointerTrackGhost.
    freehandTool remembers and updates SegmentString.
    '''
    pointerEvent = PointerEvent()
    pointerEvent.makeFromEvent(mapper=self, event=event)
    
    '''
    freehandCurve as QGraphicsItem positioned at event in scene.
    It keeps its internal data in its local CS
    '''
    freehandCurve = SegmentString()
    self.scene().addItem(freehandCurve)
    freehandCurve.setPos(pointerEvent.scenePos)

    '''
    headGhost at (0,0) in scene
    it keeps its local data in CS equivalent to scene
    '''
    headGhost = PointerTrackGhost()
    self.scene().addItem(headGhost)
    
    self.freehandTool.setSegmentString(segmentString=freehandCurve, 
                                       pathHeadGhost=headGhost, 
                                       scenePosition=pointerEvent.scenePos)
    self.freehandTool.pointerPressEvent(pointerEvent)
コード例 #3
0
 def mouseReleaseEvent(self, event):
     pointerEvent = PointerEvent()
     pointerEvent.makeFromEvent(mapper=self, event=event)
     self.freehandTool.pointerReleaseEvent(pointerEvent)
コード例 #4
0
 def mouseMoveEvent(self, event):
     ''' Tell freehandTool to update its SegmentString. '''
     pointerEvent = PointerEvent()
     pointerEvent.makeFromEvent(mapper=self, event=event)
     self.freehandTool.pointerMoveEvent(pointerEvent)
コード例 #5
0
ファイル: freehandApp.py プロジェクト: bootchk/freehandTool
 def mouseReleaseEvent(self, event):
   pointerEvent = PointerEvent()
   pointerEvent.makeFromEvent(mapper=self, event=event)
   self.freehandTool.pointerReleaseEvent(pointerEvent)
コード例 #6
0
ファイル: freehandApp.py プロジェクト: bootchk/freehandTool
 def mouseMoveEvent(self, event):
   ''' Tell freehandTool to update its SegmentString. '''
   pointerEvent = PointerEvent()
   pointerEvent.makeFromEvent(mapper=self, event=event)
   self.freehandTool.pointerMoveEvent(pointerEvent)