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:
parent
ff8d599008
commit
d56f3b2d0a
|
@ -52,6 +52,11 @@ def stop():
|
||||||
return call("STOP", audio.stop)
|
return call("STOP", audio.stop)
|
||||||
|
|
||||||
|
|
||||||
|
def seek(prcnt):
|
||||||
|
global audio
|
||||||
|
return call("SEEK", audio.seek, prcnt)
|
||||||
|
|
||||||
|
|
||||||
def get_progress():
|
def get_progress():
|
||||||
global audio
|
global audio
|
||||||
dur = audio.duration()
|
dur = audio.duration()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python2
|
||||||
# Bryan Schumaker (8/13/2010)
|
# Bryan Schumaker (8/13/2010)
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
|
@ -6,6 +6,7 @@ libsaria = ocarina.libsaria
|
||||||
button = None
|
button = None
|
||||||
entry = None
|
entry = None
|
||||||
pbar = None
|
pbar = None
|
||||||
|
label = None
|
||||||
|
|
||||||
lib_get_cur_id = libsaria.collection.lib_get_cur_id
|
lib_get_cur_id = libsaria.collection.lib_get_cur_id
|
||||||
lib_get_attr = libsaria.collection.lib_get_attr
|
lib_get_attr = libsaria.collection.lib_get_attr
|
||||||
|
@ -50,7 +51,9 @@ class InfoBar(Bar):
|
||||||
|
|
||||||
self.title = gtk.Label("Ocarina 4.1")
|
self.title = gtk.Label("Ocarina 4.1")
|
||||||
self.title.show()
|
self.title.show()
|
||||||
|
|
||||||
self.pack(self.title, True, True)
|
self.pack(self.title, True, True)
|
||||||
|
self.pack(label.TimeLabel())
|
||||||
self.pack(button.PlayButton())
|
self.pack(button.PlayButton())
|
||||||
self.pack(button.PauseButton())
|
self.pack(button.PauseButton())
|
||||||
self.pack(button.StopButton())
|
self.pack(button.StopButton())
|
||||||
|
@ -73,6 +76,7 @@ class InfoTab(gtk.Notebook):
|
||||||
hbox = gtk.HBox()
|
hbox = gtk.HBox()
|
||||||
hbox.show()
|
hbox.show()
|
||||||
|
|
||||||
|
hbox.pack_start(label.TimeLabel())
|
||||||
hbox.pack_start(pbar.PBar(), True, True)
|
hbox.pack_start(pbar.PBar(), True, True)
|
||||||
hbox.pack_start(button.PlayButton())
|
hbox.pack_start(button.PlayButton())
|
||||||
hbox.pack_start(button.PauseButton())
|
hbox.pack_start(button.PauseButton())
|
||||||
|
@ -115,10 +119,12 @@ def init():
|
||||||
global button
|
global button
|
||||||
global entry
|
global entry
|
||||||
global pbar
|
global pbar
|
||||||
|
global label
|
||||||
|
|
||||||
import button
|
import button
|
||||||
import entry
|
import entry
|
||||||
import pbar
|
import pbar
|
||||||
|
import label
|
||||||
|
|
||||||
info = TwoWayPane()
|
info = TwoWayPane()
|
||||||
filter = FilterBar()
|
filter = FilterBar()
|
||||||
|
|
|
@ -4,37 +4,36 @@ import ocarina
|
||||||
gtk = ocarina.gtk
|
gtk = ocarina.gtk
|
||||||
gobject = ocarina.gobject
|
gobject = ocarina.gobject
|
||||||
update = None
|
update = None
|
||||||
get_time = None
|
seek = None
|
||||||
|
|
||||||
def set_fns():
|
def set_fns():
|
||||||
global update
|
global update
|
||||||
global get_time
|
global get_time
|
||||||
|
global seek
|
||||||
update = ocarina.libsaria.music.get_progress
|
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)
|
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):
|
class PBar(gtk.HScale):
|
||||||
def __init__(self):
|
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)
|
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.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)
|
gobject.timeout_add(500, self.update)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def format_value(self, scale, value):
|
|
||||||
return get_time()
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
global update
|
global update
|
||||||
self.set_value(update() * 100)
|
self.set_value(update() * 100)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def value_changed(self, scale):
|
||||||
|
global seek
|
||||||
|
value = scale.get_value()
|
||||||
|
seek(value / 100.0)
|
||||||
|
|
|
@ -33,10 +33,6 @@ def start():
|
||||||
global children
|
global children
|
||||||
import webkit
|
import webkit
|
||||||
|
|
||||||
#google = WebPage("http://www.google.com")
|
|
||||||
#children.append("Google")
|
|
||||||
#ocarina.add_tab("Google", google)
|
|
||||||
|
|
||||||
pandora = WebPage("http://www.pandora.com")
|
pandora = WebPage("http://www.pandora.com")
|
||||||
children.append("Pandora")
|
children.append("Pandora")
|
||||||
ocarina.add_tab("Pandora", pandora)
|
ocarina.add_tab("Pandora", pandora)
|
||||||
|
|
Loading…
Reference in New Issue