Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Util/InstrumentPanel.py
diff options
context:
space:
mode:
authorNat <Nat@localhost.localdomain>2007-02-26 21:26:49 (GMT)
committer Nat <Nat@localhost.localdomain>2007-02-26 21:26:49 (GMT)
commitc8759c3281a18519d4271cf17571e4c9f3fc6b09 (patch)
treec0c515a5dc061b2a68fb56d9bf33663e7b4dd16b /Util/InstrumentPanel.py
parente368be29f122dd03965e9ce8db8fb46c4b3dcc2b (diff)
Added drum selection
Diffstat (limited to 'Util/InstrumentPanel.py')
-rw-r--r--Util/InstrumentPanel.py34
1 files changed, 32 insertions, 2 deletions
diff --git a/Util/InstrumentPanel.py b/Util/InstrumentPanel.py
index 84c8f11..fc6185c 100644
--- a/Util/InstrumentPanel.py
+++ b/Util/InstrumentPanel.py
@@ -8,7 +8,7 @@ import Config
from Util.ThemeWidgets import *
Tooltips = Config.Tooltips
-class InstrumentPanel(gtk.EventBox):
+class InstrumentPanel( gtk.EventBox ):
def __init__(self,setInstrument = None, playInstrument = None, enterMode = False, micRec = None, synthRec = None, rowLen = 8, _instDic = None ):
gtk.EventBox.__init__(self)
color = gtk.gdk.color_parse(Config.PANEL_BCK_COLOR)
@@ -190,9 +190,39 @@ class InstrumentPanel(gtk.EventBox):
#instrumentList = instrumentList.sort(lambda g,l: cmp(Config.INSTRUMENTS[g].category, Config.INSTRUMENTS[l].category) )
return instrumentList
+class DrumPanel( gtk.EventBox ):
+ def __init__(self, setDrum = None):
+ gtk.EventBox.__init__(self)
+ color = gtk.gdk.color_parse(Config.PANEL_BCK_COLOR)
+ self.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.setDrum = setDrum
+ self.drawDrums()
+
+ def drawDrums(self):
+ firstBtn = None
+ btnBox = RoundHBox(fillcolor = '#6F947B', bordercolor = Config.PANEL_BCK_COLOR, radius = Config.PANEL_RADIUS)
+ btnBox.set_border_width(Config.PANEL_SPACING)
+ self.drums = {}
+ for drumkit in Config.DRUMKITS:
+ instBox = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS)
+ instBox.set_border_width(Config.PANEL_SPACING)
+ self.drums[drumkit] = ImageRadioButton(firstBtn, Config.IMAGE_ROOT + drumkit + '.png' , Config.IMAGE_ROOT + drumkit + 'sel.png', Config.IMAGE_ROOT + drumkit + 'sel.png')
+ self.drums[drumkit].connect('clicked',self.setDrums,drumkit)
+ if firstBtn == None:
+ firstBtn = self.drums[drumkit]
+ instBox.pack_start(self.drums[drumkit], False, False, 0)
+ btnBox.pack_start(instBox, False, False, 0)
+ self.add(btnBox)
+ self.show_all()
+
+ def setDrums(self,widget,data):
+ if widget.get_active():
+ if self.setDrum: self.setDrum(data)
+
if __name__ == "__main__":
win = gtk.Window()
- wc = InstrumentPanel()
+ wc = DrumPanel(None)
win.add(wc)
win.show()
#start the gtk event loop