47 lines
1.0 KiB
Python
47 lines
1.0 KiB
Python
#! /usr/bin/python
|
|
|
|
# To change this template, choose Tools | Templates
|
|
# and open the template in the editor.
|
|
|
|
__author__="bjschuma"
|
|
__date__ ="$Mar 16, 2010 6:17:38 PM$"
|
|
|
|
|
|
import gtk
|
|
import gobject
|
|
|
|
import guibuilder
|
|
import gstreamer
|
|
from et import times
|
|
|
|
class ProgressBar(gtk.EventBox):
|
|
def __init__(self):
|
|
gtk.EventBox.__init__(self)
|
|
self.bar = gtk.ProgressBar()
|
|
self.bar.set_fraction(0)
|
|
|
|
self.connect("button_release_event",self.clicked)
|
|
gobject.timeout_add(500,self.updatebar)
|
|
|
|
self.add(self.bar)
|
|
self.bar.show()
|
|
self.show()
|
|
|
|
|
|
def clicked(self,widgit,data):
|
|
if data.button == 1:
|
|
prcnt = float(data.x) / float(self.bar.get_allocation()[2])
|
|
self.bar.set_fraction(prcnt)
|
|
gstreamer.seek(prcnt)
|
|
|
|
|
|
def updatebar(self):
|
|
self.bar.set_fraction(gstreamer.getProgress())
|
|
current = times.ftime(gstreamer.currentpos())
|
|
duration = times.ftime(gstreamer.duration())
|
|
self.bar.set_text(current + " / " + duration)
|
|
return True
|
|
|
|
|
|
def make_progbar(attrs):return ProgressBar()
|
|
guibuilder.parts["progbar"] = make_progbar |