From 92fd8e508d0dd16b9b800da14eedfe0ec9f89bf2 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Sat, 18 Jun 2011 11:10:18 -0400 Subject: [PATCH] ocarina: Show library information I create a panel for each library path showing the full path and the number of songs. I also have a dummy button for removing the path from the library. --- ocarina/settings/library.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/ocarina/settings/library.py b/ocarina/settings/library.py index 4241b453..9b7536e0 100644 --- a/ocarina/settings/library.py +++ b/ocarina/settings/library.py @@ -1,6 +1,38 @@ # Bryan Schumaker (6 / 18 / 2011) import gtk +import libsaria page = gtk.VBox() text = "Library" + +def remove_path(button, path): + print "Removing:", path + +def add_panel(panel): + full_box = gtk.VBox() + full_box.pack_start(panel) + full_box.pack_start(gtk.HSeparator()) + full_box.show_all() + page.pack_start(full_box, False, False) + +def show_source(path, lib): + panel = gtk.HBox() + info_box = gtk.VBox() + + path_lbl = gtk.Label() + path_lbl.set_markup("%s" % path) + count_lbl = gtk.Label() + count_lbl.set_markup("%s songs" % len(lib)) + + remove_button = gtk.Button("Remove", gtk.STOCK_REMOVE) + remove_button.connect("clicked", remove_path, path) + + info_box.pack_start(path_lbl) + info_box.pack_start(count_lbl) + panel.pack_start(info_box) + panel.pack_start(remove_button, False, False) + add_panel(panel) + +for path, lib in libsaria.sources.library.list_paths(): + show_source(path, lib)