From 656f1073c5b71222d40ff896103e10c3c83b89fe Mon Sep 17 00:00:00 2001 From: bjschuma Date: Tue, 20 Apr 2010 23:11:21 -0400 Subject: [PATCH] Added a volume slider --- src/extra/oGtk/__init__.py | 2 +- src/extra/oGtk/list.py | 4 +--- src/extra/oGtk/menu.py | 3 +-- src/extra/oGtk/tabs.py | 1 + src/extra/oGtk/volume.py | 41 ++++++++++++++++++++++++++++++++++++++ src/themes/classic.xml | 1 + src/themes/simple.xml | 11 +++++++++- 7 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 src/extra/oGtk/volume.py diff --git a/src/extra/oGtk/__init__.py b/src/extra/oGtk/__init__.py index 3de756d6..984cc009 100644 --- a/src/extra/oGtk/__init__.py +++ b/src/extra/oGtk/__init__.py @@ -3,4 +3,4 @@ __date__ ="$Mar 14, 2010 10:21:40 PM$" __all__ = ["box", "button", "dialog","entry", "label", "label", "list", "menu", - "progbar", "tabs", "window"] \ No newline at end of file + "progbar", "tabs", "window", "volume"] \ No newline at end of file diff --git a/src/extra/oGtk/list.py b/src/extra/oGtk/list.py index f604012d..d8bc2477 100644 --- a/src/extra/oGtk/list.py +++ b/src/extra/oGtk/list.py @@ -61,7 +61,6 @@ class SongList(gtk.TreeView): file = list(db.gettrack(trackid)) file[2] = times.ftime(file[2]) self.list.append(file) - #self.list.insert(len(self.list),file) if self.countvar != None: ocarina.vars[self.countvar] += 1 @@ -70,8 +69,7 @@ class SongList(gtk.TreeView): text = ocarina.vars["$filterText"] self.results = index.search(ocarina.vars["$filterText"]) if self.countvar != None: - c = len(self.results) - ocarina.vars[self.countvar] = c + ocarina.vars[self.countvar] = len(self.results) self.filterModel.refilter() diff --git a/src/extra/oGtk/menu.py b/src/extra/oGtk/menu.py index f792382c..2f90fa4c 100644 --- a/src/extra/oGtk/menu.py +++ b/src/extra/oGtk/menu.py @@ -102,8 +102,7 @@ class MenuSongSelect(gtk.MenuItem): def onclick(self,menu): file = dialog.FileChooser("Select a song").choose() - if file!=None: - cmd.run("load " + file) + call.load(file) diff --git a/src/extra/oGtk/tabs.py b/src/extra/oGtk/tabs.py index 043ad5b6..6b07df8b 100644 --- a/src/extra/oGtk/tabs.py +++ b/src/extra/oGtk/tabs.py @@ -13,6 +13,7 @@ import guibuilder class Tabs(gtk.Notebook): def __init__(self): gtk.Notebook.__init__(self) + self.set_show_border(True) self.show() diff --git a/src/extra/oGtk/volume.py b/src/extra/oGtk/volume.py new file mode 100644 index 00000000..2f409f22 --- /dev/null +++ b/src/extra/oGtk/volume.py @@ -0,0 +1,41 @@ +#! /usr/bin/python + +# To change this template, choose Tools | Templates +# and open the template in the editor. + +__author__="bjschuma" +__date__ ="$Apr 20, 2010 10:07:25 PM$" + +import gtk +import guibuilder +import ocarina +import gstreamer + +class VolumeControl(gtk.VolumeButton): + def __init__(self,attrs): + gtk.VolumeButton.__init__(self) + relief = gtk.RELIEF_NORMAL + for a in attrs: + if a=="relief": + if attrs[a] == "none": + relief = gtk.RELIEF_NONE + elif attrs[a] == "half": + relief = gtk.RELIEF_HALF + self.set_relief(relief) + + adj = self.get_adjustment() + adj.set_page_increment(ocarina.vars["$volumeincr"]) + self.setValue() + self.connect("value-changed",self.valueChanged) + self.show() + + + def setValue(self): + self.set_value(ocarina.vars["$volume"]) + + def valueChanged(self, widget, value): + gstreamer.setvol(value) + + +def make_volume(attrs):return VolumeControl(attrs) +guibuilder.parts["volume"] = make_volume diff --git a/src/themes/classic.xml b/src/themes/classic.xml index d7d39dff..7be4d459 100644 --- a/src/themes/classic.xml +++ b/src/themes/classic.xml @@ -59,6 +59,7 @@ + diff --git a/src/themes/simple.xml b/src/themes/simple.xml index 23946aeb..7b9377d5 100644 --- a/src/themes/simple.xml +++ b/src/themes/simple.xml @@ -13,11 +13,20 @@ - + + + + + + + + + +