ocarina: Added new save button

This saves playlists
This commit is contained in:
Bryan Schumaker 2011-04-24 18:09:49 -04:00
parent df3c9702be
commit 8891cb8c36
4 changed files with 10 additions and 11 deletions

View File

@ -4,6 +4,7 @@ import gtk
from libsaria.path import export from libsaria.path import export
from libsaria import controls from libsaria import controls
from libsaria import sources from libsaria import sources
from ocarina import fsselect
SIZE = gtk.ICON_SIZE_MENU SIZE = gtk.ICON_SIZE_MENU
@ -83,6 +84,13 @@ def export_button(show):
def update_button(show): def update_button(show):
return make_button(gtk.STOCK_REFRESH, sources.library.update_bg, "Update Library", show) return make_button(gtk.STOCK_REFRESH, sources.library.update_bg, "Update Library", show)
def save_button(show):
def save_func():
loc = fsselect.select_save()
if loc != None:
export.save_playlist(loc)
return make_button(gtk.STOCK_SAVE, save_func, "Save Current Playlist", show)
def up_button(show): def up_button(show):
def up_func(): def up_func():
from ocarina.body import footer from ocarina.body import footer

View File

@ -18,6 +18,7 @@ def add_button(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( "SAVE", button.save_button(True))
add_button("EXPORT", button.export_button(True)) add_button("EXPORT", button.export_button(True))
sep = gtk.VSeparator() sep = gtk.VSeparator()

View File

@ -38,16 +38,6 @@ class OpenButton(Button):
fsselect.run_chooser2(LS.path.files.universal_open) fsselect.run_chooser2(LS.path.files.universal_open)
ocarina.playlist.refresh() ocarina.playlist.refresh()
class SaveButton(Button):
def __init__(self):
Button.__init__(self, gtk.STOCK_SAVE, "Save current playlist")
def clicked(self, button):
from ocarina import fsselect
from libsaria.path import export
loc = fsselect.save()
if loc != None:
export.save_playlist(loc)
class SettingsButton(Button): class SettingsButton(Button):
def __init__(self): def __init__(self):
Button.__init__(self, gtk.STOCK_PREFERENCES, "Configure Preferences") Button.__init__(self, gtk.STOCK_PREFERENCES, "Configure Preferences")

View File

@ -82,6 +82,6 @@ def select_dir(title = "Select a directory"):
chooser = make_chooser(title, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) chooser = make_chooser(title, gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
return run_chooser(chooser) return run_chooser(chooser)
def save(title = "Select a location"): def select_save(title = "Select a location"):
chooser = make_chooser(title, gtk.FILE_CHOOSER_ACTION_SAVE) chooser = make_chooser(title, gtk.FILE_CHOOSER_ACTION_SAVE)
return run_chooser(chooser) return run_chooser(chooser)