コード例 #1
0
ファイル: timeline_status_bar.py プロジェクト: strawlab/rx
    def _update(self):
        if self.timeline.playhead is None or self.timeline.start_stamp is None:
            return

        # Raw timestamp
        self.SetStatusText('%d.%s' % (self.timeline.playhead.secs, str(self.timeline.playhead.nsecs)[:3]), self.timestamp_field)

        # Human-readable time
        self.SetStatusText(bag_helper.stamp_to_str(self.timeline.playhead), self.human_readable_field)

        # Elapsed time (in seconds)
        self.SetStatusText('%.3fs' % (self.timeline.playhead - self.timeline.start_stamp).to_sec(), self.elapsed_field)

        # Play speed
        spd = self.timeline.play_speed
        if spd != 0.0:
            if spd > 1.0:
                spd_str = '>> %.0fx' % spd
            elif spd == 1.0:
                spd_str = '>'
            elif spd > 0.0:
                spd_str = '> 1/%.0fx' % (1.0 / spd)
            elif spd > -1.0:
                spd_str = '< 1/%.0fx' % (1.0 / -spd)
            elif spd == 1.0:
                spd_str = '<'
            else:
                spd_str = '<< %.0fx' % -spd

            self.SetStatusText(spd_str, self.playspeed_field)
        else:
            self.SetStatusText('', self.playspeed_field)
コード例 #2
0
    def _update_status_bar(self):
        if self._timeline._timeline_frame.playhead is None or self._timeline._timeline_frame.start_stamp is None:
            return
        # TODO Figure out why this function is causing a "RuntimeError: wrapped C/C++ object of %S has been deleted" on close if the playhead is moving
        try:
            # Background Process Status
            self.progress_bar.setValue(self._timeline.background_progress)

            # Raw timestamp
            self.stamp_label.setText(
                '%.3fs' % self._timeline._timeline_frame.playhead.to_sec())

            # Human-readable time
            self.date_label.setText(
                bag_helper.stamp_to_str(
                    self._timeline._timeline_frame.playhead))

            # Elapsed time (in seconds)
            self.seconds_label.setText(
                '%.3fs' %
                (self._timeline._timeline_frame.playhead -
                 self._timeline._timeline_frame.start_stamp).to_sec())

            # File size
            self.filesize_label.setText(
                bag_helper.filesize_to_str(self._timeline.file_size()))

            # Play speed
            spd = self._timeline.play_speed
            if spd != 0.0:
                if spd > 1.0:
                    spd_str = '>> %.0fx' % spd
                elif spd == 1.0:
                    spd_str = '>'
                elif spd > 0.0:
                    spd_str = '> 1/%.0fx' % (1.0 / spd)
                elif spd > -1.0:
                    spd_str = '< 1/%.0fx' % (1.0 / -spd)
                elif spd == 1.0:
                    spd_str = '<'
                else:
                    spd_str = '<< %.0fx' % -spd
                self.playspeed_label.setText(spd_str)
            else:
                self.playspeed_label.setText('')
        except:
            return
コード例 #3
0
    def _update_status_bar(self):
        if self._timeline._timeline_frame.playhead is None or self._timeline._timeline_frame.start_stamp is None:
            return
        # TODO Figure out why this function is causing a "RuntimeError: wrapped C/C++ object of %S has been deleted" on close if the playhead is moving
        try:
            # Background Process Status
            self.progress_bar.setValue(self._timeline.background_progress)

            # Raw timestamp
            self.stamp_label.setText('%.3fs' % self._timeline._timeline_frame.playhead.to_sec())

            # Human-readable time
            self.date_label.setText(bag_helper.stamp_to_str(self._timeline._timeline_frame.playhead))

            # Elapsed time (in seconds)
            self.seconds_label.setText('%.3fs' % (self._timeline._timeline_frame.playhead - self._timeline._timeline_frame.start_stamp).to_sec())

            # File size
            self.filesize_label.setText(bag_helper.filesize_to_str(self._timeline.file_size()))

            # Play speed
            spd = self._timeline.play_speed
            if spd != 0.0:
                if spd > 1.0:
                    spd_str = '>> %.0fx' % spd
                elif spd == 1.0:
                    spd_str = '>'
                elif spd > 0.0:
                    spd_str = '> 1/%.0fx' % (1.0 / spd)
                elif spd > -1.0:
                    spd_str = '< 1/%.0fx' % (1.0 / -spd)
                elif spd == 1.0:
                    spd_str = '<'
                else:
                    spd_str = '<< %.0fx' % -spd
                self.playspeed_label.setText(spd_str)
            else:
                self.playspeed_label.setText('')
        except:
            return
コード例 #4
0
ファイル: timeline_status_bar.py プロジェクト: daju1-ros/ros
    def _update(self):
        if self.timeline.playhead is None or self.timeline.start_stamp is None:
            return

        # Raw timestamp
        self.SetStatusText(
            '%d.%s' % (self.timeline.playhead.secs,
                       str(self.timeline.playhead.nsecs)[:3]),
            self.timestamp_field)

        # Human-readable time
        self.SetStatusText(bag_helper.stamp_to_str(self.timeline.playhead),
                           self.human_readable_field)

        # Elapsed time (in seconds)
        self.SetStatusText(
            '%.3fs' %
            (self.timeline.playhead - self.timeline.start_stamp).to_sec(),
            self.elapsed_field)

        # Play speed
        spd = self.timeline.play_speed
        if spd != 0.0:
            if spd > 1.0:
                spd_str = '>> %.0fx' % spd
            elif spd == 1.0:
                spd_str = '>'
            elif spd > 0.0:
                spd_str = '> 1/%.0fx' % (1.0 / spd)
            elif spd > -1.0:
                spd_str = '< 1/%.0fx' % (1.0 / -spd)
            elif spd == 1.0:
                spd_str = '<'
            else:
                spd_str = '<< %.0fx' % -spd

            self.SetStatusText(spd_str, self.playspeed_field)
        else:
            self.SetStatusText('', self.playspeed_field)