ocarina: clear current page
This clears whatever is on the current page and saves changes (in the case of the playlist and library)
This commit is contained in:
parent
3b50c4071c
commit
86bac243d2
|
@ -45,6 +45,9 @@ def cur_page_filter(text):
|
||||||
def cur_page_goto():
|
def cur_page_goto():
|
||||||
current_page().goto()
|
current_page().goto()
|
||||||
|
|
||||||
|
def cur_page_clear():
|
||||||
|
current_page().clear()
|
||||||
|
|
||||||
#import ocarina
|
#import ocarina
|
||||||
#Label = gtk.Label
|
#Label = gtk.Label
|
||||||
#prefs = ocarina.libsaria.prefs
|
#prefs = ocarina.libsaria.prefs
|
||||||
|
|
|
@ -54,3 +54,6 @@ def next_button(show):
|
||||||
|
|
||||||
def goto_button(goto_func, show):
|
def goto_button(goto_func, show):
|
||||||
return make_button(gtk.STOCK_JUMP_TO, goto_func, "Go To Current Song", show)
|
return make_button(gtk.STOCK_JUMP_TO, goto_func, "Go To Current Song", show)
|
||||||
|
|
||||||
|
def clear_button(clear_func, show):
|
||||||
|
return make_button(gtk.STOCK_CLEAR, clear_func, "Clear Current Source", show)
|
||||||
|
|
|
@ -16,12 +16,17 @@ def goto_func():
|
||||||
from ocarina import body
|
from ocarina import body
|
||||||
body.cur_page_goto()
|
body.cur_page_goto()
|
||||||
|
|
||||||
|
def clear_func():
|
||||||
|
from ocarina import body
|
||||||
|
body.cur_page_clear()
|
||||||
|
|
||||||
def add_button(name, button):
|
def add_button(name, button):
|
||||||
globals()[name] = button
|
globals()[name] = button
|
||||||
header_body.pack_start(button, False, False)
|
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))
|
add_button( "GOTO", button.goto_button(goto_func, True))
|
||||||
|
add_button("CLEAR", button.clear_button(clear_func, True))
|
||||||
|
|
||||||
#import ocarina
|
#import ocarina
|
||||||
#from ocarina.components import button
|
#from ocarina.components import button
|
||||||
|
|
|
@ -37,22 +37,11 @@ class OcarinaPage(gtk.Table):
|
||||||
def filter(self, text):
|
def filter(self, text):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def goto(self, text):
|
def goto(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#self.content = content
|
def clear(self):
|
||||||
#self.attrs = content.__dict__
|
pass
|
||||||
#self.vis_func = self.attrs.get("visible", None)
|
|
||||||
#self.invis_func = self.attrs.get("invisible", None)
|
|
||||||
#self.add_header = add_header
|
|
||||||
#self.add_footer = add_footer
|
|
||||||
#self.show()
|
|
||||||
|
|
||||||
#def reset(self):
|
|
||||||
#self.content.reset()
|
|
||||||
|
|
||||||
#def goto(self):
|
|
||||||
#self.content.goto()
|
|
||||||
|
|
||||||
#def visible(self):
|
#def visible(self):
|
||||||
#if self.add_header == True:
|
#if self.add_header == True:
|
||||||
|
|
|
@ -62,13 +62,6 @@ class ExportButton(Button):
|
||||||
from libsaria.path import export
|
from libsaria.path import export
|
||||||
export.export()
|
export.export()
|
||||||
|
|
||||||
class GotoButton(Button):
|
|
||||||
def __init__(self):
|
|
||||||
Button.__init__(self, gtk.STOCK_JUMP_TO, "Go To Current Song")
|
|
||||||
def clicked(self, button):
|
|
||||||
from ocarina import body
|
|
||||||
body.cur_page_goto()
|
|
||||||
|
|
||||||
class UpdateButton(Button):
|
class UpdateButton(Button):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Button.__init__(self, gtk.STOCK_REFRESH, "Update Library")
|
Button.__init__(self, gtk.STOCK_REFRESH, "Update Library")
|
||||||
|
|
|
@ -18,6 +18,10 @@ def fill_library():
|
||||||
set_label_text()
|
set_label_text()
|
||||||
fill_library()
|
fill_library()
|
||||||
|
|
||||||
|
def refresh():
|
||||||
|
lib_page.clear()
|
||||||
|
fill_library()
|
||||||
|
|
||||||
def do_refilter(list, iter):
|
def do_refilter(list, iter):
|
||||||
return library.is_visible(list[iter][0])
|
return library.is_visible(list[iter][0])
|
||||||
lib_page.set_filter_func(do_refilter)
|
lib_page.set_filter_func(do_refilter)
|
||||||
|
@ -30,6 +34,16 @@ LIB_PAGE.filter = filter
|
||||||
|
|
||||||
import playlist
|
import playlist
|
||||||
import queue
|
import queue
|
||||||
|
|
||||||
|
def clear():
|
||||||
|
queue.clear()
|
||||||
|
playlist.clear()
|
||||||
|
lib_page.clear()
|
||||||
|
library.reset()
|
||||||
|
library.save()
|
||||||
|
refresh()
|
||||||
|
LIB_PAGE.clear = clear
|
||||||
|
|
||||||
menu_items = [
|
menu_items = [
|
||||||
("Add to Queue", queue.add_to_queue),
|
("Add to Queue", queue.add_to_queue),
|
||||||
("Add to Playlist", playlist.add_to_playlist),
|
("Add to Playlist", playlist.add_to_playlist),
|
||||||
|
|
|
@ -32,6 +32,13 @@ def filter(text):
|
||||||
set_label_text()
|
set_label_text()
|
||||||
PLAYLIST_PAGE.filter = filter
|
PLAYLIST_PAGE.filter = filter
|
||||||
|
|
||||||
|
def clear():
|
||||||
|
playlist_page.clear()
|
||||||
|
playlist.reset()
|
||||||
|
playlist.save()
|
||||||
|
refresh()
|
||||||
|
PLAYLIST_PAGE.clear = clear
|
||||||
|
|
||||||
def add_to_playlist(menu):
|
def add_to_playlist(menu):
|
||||||
ids = menu.source.get_selected_ids()
|
ids = menu.source.get_selected_ids()
|
||||||
playlist.add_ids(ids)
|
playlist.add_ids(ids)
|
||||||
|
|
|
@ -39,6 +39,12 @@ def filter(text):
|
||||||
set_label_text()
|
set_label_text()
|
||||||
QUEUE_PAGE.filter = filter
|
QUEUE_PAGE.filter = filter
|
||||||
|
|
||||||
|
def clear():
|
||||||
|
queue_page.clear()
|
||||||
|
queue.reset()
|
||||||
|
refresh()
|
||||||
|
QUEUE_PAGE.clear = clear
|
||||||
|
|
||||||
def add_to_queue(menu):
|
def add_to_queue(menu):
|
||||||
ids = menu.source.get_selected_ids()
|
ids = menu.source.get_selected_ids()
|
||||||
queue.add_ids(ids)
|
queue.add_ids(ids)
|
||||||
|
@ -66,10 +72,6 @@ queue_page.set_right_click(show_menu)
|
||||||
#menu.add_queue_menu_item("Remove from queue", rm_selected_from_queue)
|
#menu.add_queue_menu_item("Remove from queue", rm_selected_from_queue)
|
||||||
#queue_page.fill(queue.walk, True)
|
#queue_page.fill(queue.walk, True)
|
||||||
|
|
||||||
#def reset():
|
|
||||||
#queue_page.clear()
|
|
||||||
#queue.reset()
|
|
||||||
|
|
||||||
#def play_id(id):
|
#def play_id(id):
|
||||||
#queue.play_id(id)
|
#queue.play_id(id)
|
||||||
#refresh()
|
#refresh()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user