From 3bdc08476b0bc51a17e3206eee8e830fe5c77671 Mon Sep 17 00:00:00 2001 From: bjschuma Date: Mon, 18 Jan 2010 19:25:12 -0500 Subject: [PATCH] Gui lists all tracks --- nbproject/private/private.xml | 4 +++ src/extra/guiOGTK/__init__.py | 5 +++ src/extra/guiOGTK/listPage.py | 46 +++++++++++++++++++++++++++ src/extra/ogtk.py | 59 +++++++++++++++++++++++++++++++++++ src/release | 13 ++++++++ 5 files changed, 127 insertions(+) create mode 100644 nbproject/private/private.xml create mode 100644 src/extra/guiOGTK/__init__.py create mode 100644 src/extra/guiOGTK/listPage.py create mode 100644 src/extra/ogtk.py create mode 100755 src/release diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml new file mode 100644 index 00000000..c1f155a7 --- /dev/null +++ b/nbproject/private/private.xml @@ -0,0 +1,4 @@ + + + + diff --git a/src/extra/guiOGTK/__init__.py b/src/extra/guiOGTK/__init__.py new file mode 100644 index 00000000..61249cf3 --- /dev/null +++ b/src/extra/guiOGTK/__init__.py @@ -0,0 +1,5 @@ +__author__="bjschuma" +__date__ ="$Jan 16, 2010 12:46:48 PM$" + + +__all__ = ["listPage"] \ No newline at end of file diff --git a/src/extra/guiOGTK/listPage.py b/src/extra/guiOGTK/listPage.py new file mode 100644 index 00000000..ba21a40c --- /dev/null +++ b/src/extra/guiOGTK/listPage.py @@ -0,0 +1,46 @@ +#! /usr/bin/python + +# To change this template, choose Tools | Templates +# and open the template in the editor. + +__author__="bjschuma" +__date__ ="$Jan 16, 2010 12:47:28 PM$" + +import gtk +from guiGTK import * +from bt.message import * + + +from tools import database + +def library(): + select = "track.name, artist.name, album.name" + frm = "track,artist,album" + where = "track.artist=artist.id AND track.album=album.id" + return database.select(select,frm,where).fetchall() + + +class ListPage(box.VBox): + def __init__(self,name): + box.VBox.__init__(self) + self.labelText = name + self.label = label.Label(self.labelText) + self.label.rotate(90) + self.list = list.List(gtk.ListStore(str,str,str), ["Title", "Artist", "Album"]) + self.list.rules(True) + self.pack(self.list,True,True) + if name == "Library": + self.fromLibrary() + self.setLabel() + + + def fromLibrary(self): + for track in library(): + self.list.insert(track) + + + def setLabel(self): + text = self.labelText + " (" + text += str( self.list.count() ) + text += ")" + self.label.change(text) \ No newline at end of file diff --git a/src/extra/ogtk.py b/src/extra/ogtk.py new file mode 100644 index 00000000..c804b9eb --- /dev/null +++ b/src/extra/ogtk.py @@ -0,0 +1,59 @@ +# This is a simple test plugin, to make sure everything is working + +__author__="bjschuma" +__date__ ="$Jan 16, 2010 12:18:10 PM$" + + +global name, app, type, path, opt +name = "test" +app = "scion" +type = "extra" +path = "" +opt = [] + +from bt.message import write +from manager import manager +import settings +from guiGTK import * +from guiOGTK import * + + +global window +global vbox +global bar +global tabs + + +# Called when the plugin needs to perform some action +def run(args): + if args == None: + manager.run("sgtk") + else: + global window, vbox, bar, tabs + window = args[0] + vbox = args[1] + bar = args[2] + window.resize(settings.get("winsize")) + tabs = tabs.Tabs() + vbox.pack(tabs,True,True) + library = listPage.ListPage("Library") + tabs.append(library,library.label) + tabs.tabpos("left") + + + +# Called every time the plugin is enabled +def open(): + # Enable scion GTK when we are enabled + manager.run("enable", ["sgtk"]) + settings.set("gtkfuncs",run) + settings.set("winsize",(800,600)) + + +# Called every time the plugin is stopped +def close(): + pass + + +def help(): + return "Ocarina GTK functions" diff --git a/src/release b/src/release new file mode 100755 index 00000000..814846fc --- /dev/null +++ b/src/release @@ -0,0 +1,13 @@ +#!/bin/bash + +DIR=ocarina.`date +%F` +SCION=/opt/scion/ + +sh ./clean +mkdir $DIR +cp -r core $DIR +cp -r extra $DIR +cp -r $SCION/base $DIR +cp -r $SCION/core $DIR +cp -r $SCION/extra $DIR +