示例#1
0
    def mousePressEvent(self, event):
        # Select the track
        selected_track = Track.whichTrack(event.y())
        if selected_track <= len(self._tracks):
            self._selected_track = selected_track

        # Select the period bar
        self._selected = self.selectDelta(event.x(), event.y())
        self._moving = False
        self._resizingBegin = False
        self._resizingEnd = False

        if self._selected is not None:
            # Select the action
            if event.buttons() == QtCore.Qt.LeftButton:
                if self._selected.canSlideEnd(event.x(), event.y()):
                    self._resizingEnd = True
                elif self._selected.canSlideBegin(event.x(), event.y()):
                    self._resizingBegin = True
                elif self._selected.collide(event.x(), event.y()):
                    self._moving = True
        if event.y() <= 20 and not self._moving:
            self._pointer.position = self.x2frame(event.x())

        self.repaint()
    def mousePressEvent(self, event):
        # Select the track
        selected_track = Track.whichTrack(event.y())
        if selected_track <= len(self._tracks):
            self._selected_track = selected_track

        # Select the period bar
        self._selected = self.selectDelta(event.x(), event.y())
        self._moving = False
        self._resizingBegin = False
        self._resizingEnd = False

        if self._selected is not None:
            # Select the action
            if event.buttons() == QtCore.Qt.LeftButton:
                if self._selected.canSlideEnd(event.x(), event.y()):
                    self._resizingEnd = True
                elif self._selected.canSlideBegin(event.x(), event.y()):
                    self._resizingBegin = True
                elif self._selected.collide(event.x(), event.y()):
                    self._moving = True
        if event.y() <= 20 and not self._moving:
            self._pointer.position = event.x()

        self.repaint()
示例#3
0
    def move(self, x, y):
        if self._lock: return

        if (self.begin + x) >= 0 and (self.end + x) <= self._parent.width():
            self._begin += x / self._parent._scale
            self._end   += x / self._parent._scale
        current_track = self.track
        new_track     = Track.whichTrack(y)

        if current_track != new_track and new_track >= 0 and new_track <= self._parent.numberoftracks:
            self.track = new_track
            self.checkNumberOfTracks()
示例#4
0
 def selectDelta(self, x, y):
     # Check if the timeline pointer was selected
     if y <= 20:
         if self._pointer.collide(x, y):
             return self._pointer
         else:
             return None
     # Check if the timeline periods were selected
     i = Track.whichTrack(y)
     if i>=len(self._tracks): return None
     
     return self._tracks[i].selectDelta(x,y)
示例#5
0
    def move(self, x, y):
        if self._lock: return

        if (self.begin + x) >= 0 and (self.end + x) <= self._parent.width():
            self._begin += x / self._parent._scale
            self._end += x / self._parent._scale
        current_track = self.track
        new_track = Track.whichTrack(y)

        if current_track != new_track and new_track >= 0 and new_track <= self._parent.numberoftracks:
            self.track = new_track
            self.checkNumberOfTracks()
示例#6
0
    def selectDelta(self, x, y):
        # Check if the timeline pointer was selected
        if y <= 20:
            if self._pointer.collide(x, y):
                return self._pointer
            else:
                return None
        # Check if the timeline periods were selected
        i = Track.whichTrack(y)
        if i >= len(self._tracks): return None

        return self._tracks[i].selectDelta(x, y)
示例#7
0
    def track(self): return Track.whichTrack(self._top)


    @track.setter
示例#8
0
 def track(self):
     return Track.whichTrack(self._top)