ocarina: goto current song
I do this when the goto button is pressed and also when the song changes.
This commit is contained in:
parent
bce7651be5
commit
3b50c4071c
|
@ -42,6 +42,9 @@ def switch_page(notebook, page, pagenum):
|
||||||
def cur_page_filter(text):
|
def cur_page_filter(text):
|
||||||
current_page().filter(text)
|
current_page().filter(text)
|
||||||
|
|
||||||
|
def cur_page_goto():
|
||||||
|
current_page().goto()
|
||||||
|
|
||||||
#import ocarina
|
#import ocarina
|
||||||
#Label = gtk.Label
|
#Label = gtk.Label
|
||||||
#prefs = ocarina.libsaria.prefs
|
#prefs = ocarina.libsaria.prefs
|
||||||
|
|
|
@ -51,3 +51,6 @@ def stop_button(show):
|
||||||
|
|
||||||
def next_button(show):
|
def next_button(show):
|
||||||
return make_button(gtk.STOCK_MEDIA_NEXT, controls.next, "Next", show)
|
return make_button(gtk.STOCK_MEDIA_NEXT, controls.next, "Next", show)
|
||||||
|
|
||||||
|
def goto_button(goto_func, show):
|
||||||
|
return make_button(gtk.STOCK_JUMP_TO, goto_func, "Go To Current Song", show)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Bryan Schumaker (11/25/2010)
|
# Bryan Schumaker (11/25/2010)
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
from ocarina.body.button import make_button
|
from ocarina.body import button
|
||||||
import entry
|
import entry
|
||||||
|
|
||||||
header = gtk.VBox()
|
header = gtk.VBox()
|
||||||
|
@ -12,7 +12,16 @@ header.pack_start(header_body)
|
||||||
header.pack_start(header_sep)
|
header.pack_start(header_sep)
|
||||||
header.show_all()
|
header.show_all()
|
||||||
|
|
||||||
|
def goto_func():
|
||||||
|
from ocarina import body
|
||||||
|
body.cur_page_goto()
|
||||||
|
|
||||||
|
def add_button(name, button):
|
||||||
|
globals()[name] = button
|
||||||
|
header_body.pack_start(button, False, False)
|
||||||
|
|
||||||
header_body.pack_start(entry.entry)
|
header_body.pack_start(entry.entry)
|
||||||
|
add_button("GOTO", button.goto_button(goto_func, True))
|
||||||
|
|
||||||
#import ocarina
|
#import ocarina
|
||||||
#from ocarina.components import button
|
#from ocarina.components import button
|
||||||
|
|
|
@ -37,6 +37,9 @@ class OcarinaPage(gtk.Table):
|
||||||
def filter(self, text):
|
def filter(self, text):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def goto(self, text):
|
||||||
|
pass
|
||||||
|
|
||||||
#self.content = content
|
#self.content = content
|
||||||
#self.attrs = content.__dict__
|
#self.attrs = content.__dict__
|
||||||
#self.vis_func = self.attrs.get("visible", None)
|
#self.vis_func = self.attrs.get("visible", None)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import libsaria
|
import libsaria
|
||||||
import queue
|
import queue
|
||||||
|
from ocarina import body
|
||||||
from ocarina.body import footer
|
from ocarina.body import footer
|
||||||
|
|
||||||
invite = libsaria.event.invite
|
invite = libsaria.event.invite
|
||||||
|
@ -21,4 +22,5 @@ invite("POSTSTOP", on_stop)
|
||||||
def on_load(*args):
|
def on_load(*args):
|
||||||
footer.on_load()
|
footer.on_load()
|
||||||
queue.refresh()
|
queue.refresh()
|
||||||
|
body.cur_page_goto()
|
||||||
invite("POSTLOAD", on_load)
|
invite("POSTLOAD", on_load)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import body
|
||||||
library = libsaria.sources.library
|
library = libsaria.sources.library
|
||||||
lib_page = sources.Source()
|
lib_page = sources.Source()
|
||||||
LIB_PAGE = body.add_page(lib_page, "Library")
|
LIB_PAGE = body.add_page(lib_page, "Library")
|
||||||
|
LIB_PAGE.goto = lib_page.goto
|
||||||
|
|
||||||
def set_label_text():
|
def set_label_text():
|
||||||
LIB_PAGE.label.set_text("Library (%s)" % library.num_visible())
|
LIB_PAGE.label.set_text("Library (%s)" % library.num_visible())
|
||||||
|
|
|
@ -7,6 +7,7 @@ import body
|
||||||
playlist = libsaria.sources.playlist
|
playlist = libsaria.sources.playlist
|
||||||
playlist_page = sources.Source()
|
playlist_page = sources.Source()
|
||||||
PLAYLIST_PAGE = body.add_page(playlist_page, "Playlist")
|
PLAYLIST_PAGE = body.add_page(playlist_page, "Playlist")
|
||||||
|
PLAYLIST_PAGE.goto = playlist_page.goto
|
||||||
|
|
||||||
def set_label_text():
|
def set_label_text():
|
||||||
PLAYLIST_PAGE.label.set_text("Playlist (%s)" % playlist.num_visible())
|
PLAYLIST_PAGE.label.set_text("Playlist (%s)" % playlist.num_visible())
|
||||||
|
|
|
@ -7,6 +7,7 @@ import body
|
||||||
queue = libsaria.sources.queue
|
queue = libsaria.sources.queue
|
||||||
queue_page = sources.Source()
|
queue_page = sources.Source()
|
||||||
QUEUE_PAGE = body.add_page(queue_page, "Queue")
|
QUEUE_PAGE = body.add_page(queue_page, "Queue")
|
||||||
|
QUEUE_PAGE.goto = queue_page.goto
|
||||||
|
|
||||||
def set_label_text():
|
def set_label_text():
|
||||||
QUEUE_PAGE.label.set_text("Queue (%s)" % queue.num_visible())
|
QUEUE_PAGE.label.set_text("Queue (%s)" % queue.num_visible())
|
||||||
|
|
|
@ -23,3 +23,4 @@ class Source(gtk.ScrolledWindow):
|
||||||
self.refilter = self.listview.refilter
|
self.refilter = self.listview.refilter
|
||||||
self.insert = self.listview.insert_rows
|
self.insert = self.listview.insert_rows
|
||||||
self.clear = self.listview.clear
|
self.clear = self.listview.clear
|
||||||
|
self.goto = self.listview.goto
|
||||||
|
|
|
@ -99,25 +99,25 @@ class ListView(gtk.TreeView):
|
||||||
self.filter_model.refilter()
|
self.filter_model.refilter()
|
||||||
self.thaw()
|
self.thaw()
|
||||||
|
|
||||||
#def goto(self, *args):
|
def goto(self, *args):
|
||||||
#id = sources.get_attrs("id")
|
id = libsaria.sources.get_attrs("id")
|
||||||
#if id == -1: # Bad id
|
if id == -1: # Bad id
|
||||||
#return
|
return
|
||||||
#vis = self.get_visible_rect()
|
vis = self.get_visible_rect()
|
||||||
#if vis[3] == 0: # The widget hasn't been realized yet
|
if vis[3] == 0: # The widget hasn't been realized yet
|
||||||
#return
|
return
|
||||||
#for index, row in enumerate(self.filter_model):
|
for index, row in enumerate(self.filter_model):
|
||||||
#if row[0] == id:
|
if row[0] == id:
|
||||||
#col = self.get_column(0)
|
col = self.get_column(0)
|
||||||
#row_vis = self.get_cell_area(index, col)
|
row_vis = self.get_cell_area(index, col)
|
||||||
#if row_vis[3] > 0:
|
if row_vis[3] > 0:
|
||||||
#n = vis[3] / row_vis[3]
|
n = vis[3] / row_vis[3]
|
||||||
#path = index - (n / 2)
|
path = index - (n / 2)
|
||||||
#if path < 0:
|
if path < 0:
|
||||||
#path = 0
|
path = 0
|
||||||
#self.scroll_to_cell(path, None, True, 0, 0)
|
self.scroll_to_cell(path, None, True, 0, 0)
|
||||||
#self.set_cursor_on_cell(index, None, None, False)
|
self.set_cursor_on_cell(index, None, None, False)
|
||||||
#return
|
return
|
||||||
|
|
||||||
#def query_tooltip(self, widget, x, y, keyboard, tip):
|
#def query_tooltip(self, widget, x, y, keyboard, tip):
|
||||||
#row = self.get_dest_row_at_pos(x,y)
|
#row = self.get_dest_row_at_pos(x,y)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user