Exemplo n.º 1
0
 def _newTime(self, value, frame=-1):
     self.info("value:%s, frame:%d", gst.TIME_ARGS(value), frame)
     self.current_time = value
     self.current_frame = frame
     self.timelabel.set_markup("<tt>%s</tt>" % time_to_string(value))
     if not self.moving_slider:
         self.posadjust.set_value(float(value))
     return False
Exemplo n.º 2
0
 def _newTime(self, value, frame=-1):
     self.info("value:%s, frame:%d", gst.TIME_ARGS(value), frame)
     self.current_time = value
     self.current_frame = frame
     self.timelabel.set_markup("<tt>%s</tt>" % time_to_string(value))
     if not self.moving_slider:
         self.posadjust.set_value(float(value))
     return False
Exemplo n.º 3
0
 def _sliderButtonReleaseCb(self, slider, unused_event):
     self.info("slider button release at %s",
               time_to_string(long(slider.get_value())))
     self.moving_slider = False
     if self.valuechangedid:
         slider.disconnect(self.valuechangedid)
         self.valuechangedid = 0
     # revert to previous state
     if self.currentState == gst.STATE_PAUSED:
         self.pipeline.pause()
     else:
         self.pipeline.play()
     return False
Exemplo n.º 4
0
 def _sliderButtonReleaseCb(self, slider, event):
     # borrow totem hack for seek-on-click behavior
     event.button = 2
     self.info("slider button release at %s", time_to_string(long(slider.get_value())))
     self.moving_slider = False
     if self.valuechangedid:
         slider.disconnect(self.valuechangedid)
         self.valuechangedid = 0
     # revert to previous state
     if self.currentState == gst.STATE_PAUSED:
         self.pipeline.pause()
     else:
         self.pipeline.play()
     return False
Exemplo n.º 5
0
 def _sliderButtonReleaseCb(self, slider, event):
     # borrow totem hack for seek-on-click behavior
     event.button = 2
     self.info("slider button release at %s", time_to_string(long(slider.get_value())))
     self.moving_slider = False
     if self.valuechangedid:
         slider.disconnect(self.valuechangedid)
         self.valuechangedid = 0
     # revert to previous state
     if self.currentState == gst.STATE_PAUSED:
         self.pipeline.pause()
     else:
         self.pipeline.play()
     return False
Exemplo n.º 6
0
    def drawRuler(self, allocation):
        layout = self.create_pango_layout(time_to_string(0))
        textwidth, textheight = layout.get_pixel_size()

        for scale in self.scale:
            spacing = Zoomable.zoomratio * scale
            if spacing >= textwidth * 1.5:
                break

        offset = self.pixmap_offset % spacing

        zoomRatio = self.zoomratio
        self.drawFrameBoundaries(allocation)
        self.drawTicks(allocation, offset, spacing, scale)
        self.drawTimes(allocation, offset, spacing, scale, layout)
Exemplo n.º 7
0
    def drawRuler(self, allocation):
        layout = self.create_pango_layout(time_to_string(0))
        textwidth, textheight = layout.get_pixel_size()

        for scale in self.scale:
            spacing = Zoomable.zoomratio * scale
            if spacing >= textwidth * 1.5:
                break

        offset = self.pixmap_offset % spacing

        zoomRatio = self.zoomratio
        self.drawFrameBoundaries(allocation)
        self.drawTicks(allocation, offset, spacing, scale)
        self.drawTimes(allocation, offset, spacing, scale, layout)
Exemplo n.º 8
0
    def drawTimes(self, allocation, offset, spacing, scale, layout):
        # figure out what the optimal offset is
        interval = long(gst.SECOND * scale)
        seconds = self.pixelToNs(self.pixmap_offset)
        paintpos = float(self.border) + 2
        if offset > 0:
            seconds = seconds - (seconds % interval) + interval
            paintpos += spacing - offset
        shaded = self.getShadedDurationWidth()

        while paintpos < allocation.width:
            timevalue = time_to_string(long(seconds))
            layout.set_text(timevalue)
            if paintpos < shaded:
                state = gtk.STATE_ACTIVE
            else:
                state = gtk.STATE_NORMAL
            self.pixmap.draw_layout(self.style.fg_gc[state], int(paintpos), 0,
                                    layout)
            paintpos += spacing
            seconds += interval
Exemplo n.º 9
0
    def drawTimes(self, allocation, offset, spacing, scale, layout):
        # figure out what the optimal offset is
        interval = long(gst.SECOND * scale)
        seconds = self.pixelToNs(self.pixmap_offset)
        paintpos = float(self.border) + 2
        if offset > 0:
            seconds = seconds - (seconds % interval) + interval
            paintpos += spacing - offset
        shaded = self.getShadedDurationWidth()

        while paintpos < allocation.width:
            timevalue = time_to_string(long(seconds))
            layout.set_text(timevalue)
            if paintpos < shaded:
                state = gtk.STATE_ACTIVE
            else:
                state = gtk.STATE_NORMAL
            self.pixmap.draw_layout(
                self.style.fg_gc[state],
                int(paintpos), 0, layout)
            paintpos += spacing
            seconds += interval
Exemplo n.º 10
0
 def setWidgetValue(self, value, send_signal=True):
     TextWidget.setWidgetValue(self, time_to_string(value),
                             send_signal=send_signal)
Exemplo n.º 11
0
 def setWidgetValue(self, value, send_signal=True):
     TextWidget.setWidgetValue(self,
                               time_to_string(value),
                               send_signal=send_signal)