Reset page button
The reset page button will reset the library or playlist and then clear the list on that page.
This commit is contained in:
parent
4c916f2fd3
commit
930834222a
|
@ -84,6 +84,13 @@ class OpenButton(Button):
|
||||||
from ocarina import fsselect
|
from ocarina import fsselect
|
||||||
fsselect.run_chooser2(LS.data.universal_open)
|
fsselect.run_chooser2(LS.data.universal_open)
|
||||||
|
|
||||||
|
class ClearButton(Button):
|
||||||
|
def __init__(self):
|
||||||
|
Button.__init__(self, gtk.STOCK_CLEAR, gtk.ICON_SIZE_BUTTON)
|
||||||
|
def clicked(self, button):
|
||||||
|
from ocarina import tabs
|
||||||
|
tabs.reset_current_page()
|
||||||
|
|
||||||
class RandomButton(gtk.ToggleButton):
|
class RandomButton(gtk.ToggleButton):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
gtk.ToggleButton.__init__(self)
|
gtk.ToggleButton.__init__(self)
|
||||||
|
|
|
@ -89,6 +89,10 @@ class Library(Collection):
|
||||||
self.clear()
|
self.clear()
|
||||||
self.populate()
|
self.populate()
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
collection.lib_reset()
|
||||||
|
self.clear()
|
||||||
|
|
||||||
def mouse_motion(self, row):
|
def mouse_motion(self, row):
|
||||||
return (collection.lib_get_attr(row[0], "playcount"),
|
return (collection.lib_get_attr(row[0], "playcount"),
|
||||||
collection.lib_get_attr(row[0], "score"))
|
collection.lib_get_attr(row[0], "score"))
|
||||||
|
@ -122,6 +126,10 @@ class Playlist(Collection):
|
||||||
self.clear()
|
self.clear()
|
||||||
self.populate()
|
self.populate()
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
collection.plist_reset()
|
||||||
|
self.clear()
|
||||||
|
|
||||||
def populate(self):
|
def populate(self):
|
||||||
#import datetime
|
#import datetime
|
||||||
#before = datetime.datetime.now()
|
#before = datetime.datetime.now()
|
||||||
|
|
|
@ -43,6 +43,7 @@ class FilterBar(Bar):
|
||||||
|
|
||||||
self.pack(entry.FilterEntry(), True, True)
|
self.pack(entry.FilterEntry(), True, True)
|
||||||
self.pack(button.OpenButton())
|
self.pack(button.OpenButton())
|
||||||
|
self.pack(button.ClearButton())
|
||||||
self.pack(button.RandomButton())
|
self.pack(button.RandomButton())
|
||||||
self.pack(button.VolumeButton())
|
self.pack(button.VolumeButton())
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,10 @@ class TabPage(gtk.VBox):
|
||||||
if hasattr(self.content, "filter"):
|
if hasattr(self.content, "filter"):
|
||||||
self.content.filter(text)
|
self.content.filter(text)
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
if hasattr(self.content, "reset"):
|
||||||
|
self.content.reset()
|
||||||
|
|
||||||
def visible(self):
|
def visible(self):
|
||||||
global bottom
|
global bottom
|
||||||
global top
|
global top
|
||||||
|
@ -92,6 +96,15 @@ def switch_page(notebook, page, page_num):
|
||||||
new.visible()
|
new.visible()
|
||||||
cur_page = page_num
|
cur_page = page_num
|
||||||
|
|
||||||
|
def get_current_page():
|
||||||
|
global tabs
|
||||||
|
global cur_page
|
||||||
|
return tabs.get_nth_page(cur_page)
|
||||||
|
|
||||||
|
def reset_current_page():
|
||||||
|
get_current_page().reset()
|
||||||
|
|
||||||
|
|
||||||
def filter(text = None):
|
def filter(text = None):
|
||||||
#global cur_page
|
#global cur_page
|
||||||
p = tabs.get_nth_page(cur_page)
|
p = tabs.get_nth_page(cur_page)
|
||||||
|
|
Loading…
Reference in New Issue