Пример #1
0
    def setTimeRange(self, sTime, eTime):
        self.timeRangeMin = sTime
        self.timeRangeMax = eTime
        self.timeRange = eTime - sTime

        self.columndWidth = self.widget.getgridstep()
        leftbtnPos = self.leftbtn.x() + self.leftbtn.size().width() - 2
        if leftbtnPos < self.lbWidth:
            self.startTime = self.timeRangeMin
        else:
            x = (leftbtnPos -
                 self.lbWidth) * self.timeRange / (10 * self.columndWidth)
            # change time to seconds
            self.startTime = int(x) + self.timeRangeMin

        rightbtnPos = self.rightbtn.x() + 0.5
        if rightbtnPos > (self.lbWidth + self.columndWidth * 10):
            self.endTime = self.timeRangeMax
        else:
            x = (rightbtnPos -
                 self.lbWidth) * self.timeRange / (10 * self.columndWidth)
            # change time to seconds
            self.endTime = int(x) + self.timeRangeMin

        self.leftbtn.setToolTip(CommonMethod.Second2Time(self.startTime))
        self.rightbtn.setToolTip(CommonMethod.Second2Time(self.endTime))
Пример #2
0
    def rightbtnMove(self):
        if self.rightbtn.x() > self.timelineStep * 25:
            self.endTime = 24.0 * 3600
        else:
            x = (self.rightbtn.x() - self.timelineStep) / self.timelineStep
            # change time to seconds
            self.endTime = int(x * 3600)
        self.timeRangeChanged.emit()
        point = self.rightbtn.rect().topRight()
        global_point = self.rightbtn.mapToGlobal(point)
        QToolTip.showText(QPoint(global_point),
                          CommonMethod.Second2Time(self.endTime))
        self.rightbtn.setToolTip(CommonMethod.Second2Time(self.endTime))

        self.repaint()
Пример #3
0
    def leftbtnMove(self):
        leftbtnPos = self.leftbtn.x() + self.leftbtn.size().width()
        if leftbtnPos < self.timelineStep:
            self.startTime = 0.0
        else:
            x = (leftbtnPos - self.timelineStep) / self.timelineStep
            # change time to seconds
            self.startTime = int(x * 3600)
        # inform grid that time range is changed
        self.timeRangeChanged.emit()
        point = self.leftbtn.rect().topRight()
        global_point = self.leftbtn.mapToGlobal(point)
        QToolTip.showText(QPoint(global_point),
                          CommonMethod.Second2Time(self.startTime))
        self.leftbtn.setToolTip(CommonMethod.Second2Time(self.startTime))

        self.repaint()
Пример #4
0
 def timerTick(self):
     if self.keepMoving:
         # [True/False, time of moving vertical line]
         result = self.grid.moveVLine()
         self.keepMoving = result[0]
         #print(CommonMethod.Second2Time(result[1]))
         self.timeSignal.emit(result[1] * 1000)
         self.lblTime.setText(CommonMethod.Second2Time(result[1]))
     else:
         self.start = False
         self.timer.stop()
         self.playbtn.setIcon(QIcon(r'Pictures/play.png'))
Пример #5
0
    def rightbtnMove(self):
        self.vline.setVisible(False)
        self.moving = False
        self.widget.setRightLineXPos(self.rightbtn.x() + 0.5)
        # show time as btn moves
        point = self.rightbtn.rect().topRight()
        self.columndWidth = self.widget.getgridstep()
        global_point = self.rightbtn.mapToGlobal(point)
        rightbtnPos = self.rightbtn.x() + 0.5
        if rightbtnPos > (self.lbWidth + self.columndWidth * 10):
            self.endTime = self.timeRangeMax
        else:
            x = (rightbtnPos -
                 self.lbWidth) * self.timeRange / (10 * self.columndWidth)
            # change time to seconds
            self.endTime = int(x) + self.timeRangeMin
        self.rightbtn.setToolTip(CommonMethod.Second2Time(self.endTime))
        QToolTip.showText(QPoint(global_point),
                          CommonMethod.Second2Time(self.endTime))
        self.rightbtn.setToolTip(CommonMethod.Second2Time(self.endTime))

        self.widget.repaint()
Пример #6
0
    def leftbtnMove(self):
        self.vline.setVisible(False)
        self.moving = False
        self.widget.setLeftLineXPos(self.leftbtn.x() +
                                    self.leftbtn.size().width() - 2)
        # show time as btn moves
        point = self.leftbtn.rect().topRight()
        global_point = self.leftbtn.mapToGlobal(point)
        self.columndWidth = self.widget.getgridstep()
        leftbtnPos = self.leftbtn.x() + self.leftbtn.size().width() - 2
        if leftbtnPos < self.lbWidth:
            self.startTime = self.timeRangeMin
        else:
            x = (leftbtnPos -
                 self.lbWidth) * self.timeRange / (10 * self.columndWidth)
            # change time to seconds
            self.startTime = int(x) + self.timeRangeMin
        QToolTip.showText(QPoint(global_point),
                          CommonMethod.Second2Time(self.startTime))
        self.leftbtn.setToolTip(CommonMethod.Second2Time(self.startTime))

        self.widget.repaint()
Пример #7
0
 def drawMarkers(self):
     for p in self.data:
         p.markers = []
         for d in p.data:
             # copy.deepcopy(p.marker)
             marker = Marker.Marker(p.color, p.shape, 10, 10, 12, self)
             marker.origin_x = d[0]
             marker.origin_y = d[1]
             marker.move(d[0] * self.x_ratio, d[1] * self.y_ratio)
             marker.setVisible(False)
             marker.timeStamp = d[2]
             marker.setPositionTip(
                 str(d[0]) + ', ' + str(d[1]) + ", " +
                 CommonMethod.Second2Time(int(d[2]) / 1000))
             p.markers.append(marker)
Пример #8
0
 def paintEvent(self, e):
     qp = QPainter()
     qp.begin(self)
     CommonMethod.DrawMarker(self.size().width() / 2, 10, qp, self.shape,
                             self.color, 16)
     qp.end()