Multiple changes

- Remove google from the web radio plugin
- Change ocarina.py to use python2
- Seek in song using slider
This commit is contained in:
Bryan Schumaker 2010-10-18 21:04:09 -04:00
parent ff8d599008
commit d56f3b2d0a
5 changed files with 26 additions and 20 deletions

View File

@ -52,6 +52,11 @@ def stop():
return call("STOP", audio.stop)
def seek(prcnt):
global audio
return call("SEEK", audio.seek, prcnt)
def get_progress():
global audio
dur = audio.duration()

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python2
# Bryan Schumaker (8/13/2010)
import datetime

View File

@ -6,6 +6,7 @@ libsaria = ocarina.libsaria
button = None
entry = None
pbar = None
label = None
lib_get_cur_id = libsaria.collection.lib_get_cur_id
lib_get_attr = libsaria.collection.lib_get_attr
@ -50,7 +51,9 @@ class InfoBar(Bar):
self.title = gtk.Label("Ocarina 4.1")
self.title.show()
self.pack(self.title, True, True)
self.pack(label.TimeLabel())
self.pack(button.PlayButton())
self.pack(button.PauseButton())
self.pack(button.StopButton())
@ -73,6 +76,7 @@ class InfoTab(gtk.Notebook):
hbox = gtk.HBox()
hbox.show()
hbox.pack_start(label.TimeLabel())
hbox.pack_start(pbar.PBar(), True, True)
hbox.pack_start(button.PlayButton())
hbox.pack_start(button.PauseButton())
@ -115,10 +119,12 @@ def init():
global button
global entry
global pbar
global label
import button
import entry
import pbar
import label
info = TwoWayPane()
filter = FilterBar()

View File

@ -4,37 +4,36 @@ import ocarina
gtk = ocarina.gtk
gobject = ocarina.gobject
update = None
get_time = None
seek = None
def set_fns():
global update
global get_time
global seek
update = ocarina.libsaria.music.get_progress
get_time = ocarina.libsaria.music.get_time
seek = ocarina.libsaria.music.seek
ocarina.libsaria.event.invite("POSTSTART", set_fns)
#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)
adj = gtk.Adjustment(0.0, 0.0, 100.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_size_request(200, 20)
self.set_draw_value(False)
self.set_range(0, 101)
self.connect("format-value", self.format_value)
self.set_update_policy(gtk.UPDATE_DISCONTINUOUS)
self.connect("value-changed", self.value_changed)
gobject.timeout_add(500, self.update)
self.show()
def format_value(self, scale, value):
return get_time()
def update(self):
global update
self.set_value(update() * 100)
return True
def value_changed(self, scale):
global seek
value = scale.get_value()
seek(value / 100.0)

View File

@ -33,10 +33,6 @@ def start():
global children
import webkit
#google = WebPage("http://www.google.com")
#children.append("Google")
#ocarina.add_tab("Google", google)
pandora = WebPage("http://www.pandora.com")
children.append("Pandora")
ocarina.add_tab("Pandora", pandora)