Added the beginnings of a progress bar

This commit is contained in:
Bryan Schumaker 2010-10-11 20:48:43 -04:00
parent 6934974d75
commit eb7932fad2
4 changed files with 42 additions and 2 deletions

View File

@ -93,8 +93,11 @@ def seek(prcnt):
global player
global time
global gst
spot = duration() * prcnt
player.seek_simple(time, gst.SEEK_FLAG_FLUSH, spot)
try:
spot = duration() * prcnt
player.seek_simple(time, gst.SEEK_FLAG_FLUSH, spot)
except:
pass
def volume(prcnt):

View File

@ -48,6 +48,12 @@ class PauseButton(Button):
LS.music.pause()
class StopButton(Button):
def __init__(self):
Button.__init__(self, gtk.STOCK_MEDIA_STOP)
def clicked(self, button):
LS.music.stop()
class OpenButton(Button):
def __init__(self):
Button.__init__(self, gtk.STOCK_OPEN)

View File

@ -5,6 +5,7 @@ gtk = ocarina.gtk
libsaria = ocarina.libsaria
button = None
entry = None
pbar = None
lib_get_cur_id = libsaria.collection.lib_get_cur_id
lib_get_attr = libsaria.collection.lib_get_attr
@ -52,6 +53,7 @@ class InfoBar(Bar):
self.pack(self.title, True, True)
self.pack(button.PlayButton())
self.pack(button.PauseButton())
self.pack(button.StopButton())
self.pack(button.UpButton(up_button))
libsaria.event.invite("POSTLOAD", self.change_title)
@ -69,8 +71,11 @@ class InfoTab(gtk.Notebook):
hbox = gtk.HBox()
hbox.show()
hbox.pack_start(pbar.PBar(), True, True)
hbox.pack_start(button.PlayButton())
hbox.pack_start(button.PauseButton())
hbox.pack_start(button.StopButton())
hbox.pack_start(button.DownButton(down_button))
self.set_action_widget(hbox, gtk.PACK_END)
@ -108,9 +113,11 @@ def init():
global filter
global button
global entry
global pbar
import button
import entry
import pbar
info = TwoWayPane()
filter = FilterBar()

24
ocarina/pbar.py Normal file
View File

@ -0,0 +1,24 @@
# Bryan Schumaker (10/11/2010)
import ocarina
gtk = ocarina.gtk
#class PBar(gtk.ProgressBar):
# def __init__(self):
# gtk.ProgressBar.__init__(self)
# self.set_size_request(300, 20)
# self.show()
# print self.size_request()
class PBar(gtk.HScale):
def __init__(self):
adj = gtk.Adjustment(0.0, 0.0, 101.0, 0.1, 1.0, 1.0)
gtk.HScale.__init__(self, adj)
self.set_size_request(300, 20)
self.set_value_pos(gtk.POS_LEFT)
self.set_range(0, 101)
self.connect("format-value", self.format_value)
self.show()
def format_value(self, scale, value):
return "00:00"