diff options
author | Nat <Nat@localhost.localdomain> | 2007-02-20 01:41:12 (GMT) |
---|---|---|
committer | Nat <Nat@localhost.localdomain> | 2007-02-20 01:41:12 (GMT) |
commit | f0d7d9a5e84acd64ece9454eb26f9a3a0e75f226 (patch) | |
tree | 1ae4f96a32bd96918eac90210fd14b9f235abec7 /Util/InstrumentPanel.py | |
parent | 37e1496cb788b3a7d9d3d4a16d3d48f395506908 (diff) |
Moved mic and lab to main instpanel
Diffstat (limited to 'Util/InstrumentPanel.py')
-rw-r--r-- | Util/InstrumentPanel.py | 70 |
1 files changed, 48 insertions, 22 deletions
diff --git a/Util/InstrumentPanel.py b/Util/InstrumentPanel.py index a122970..cc983e1 100644 --- a/Util/InstrumentPanel.py +++ b/Util/InstrumentPanel.py @@ -25,12 +25,11 @@ class InstrumentPanel(gtk.EventBox): self.recstate = False self.instDic = {} - self.generateInstDic() - self.mainVBox = gtk.VBox() self.draw_toolbar() + self.generateInstDic() self.draw_instruments_panel() - self.draw_mic_lab_box() + self.add(self.mainVBox) self.show_all() @@ -106,7 +105,6 @@ class InstrumentPanel(gtk.EventBox): if self.playInstrument: self.playInstrument(instrument) def draw_mic_lab_box(self): - hbox = gtk.HBox() for n in ['mic1','mic2','mic3','mic4']: vbox1 = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS) @@ -122,7 +120,8 @@ class InstrumentPanel(gtk.EventBox): vbox1.pack_start(micRecBtn,False,False) vbox1.pack_start(micBtn,False,False) - hbox.pack_start(vbox1,True,True) + self.instDic[n] = vbox1 + for n in ['lab1','lab2','lab3','lab4']: vbox2 = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS) @@ -138,9 +137,7 @@ class InstrumentPanel(gtk.EventBox): vbox2.pack_start(synthRecBtn,False,False) vbox2.pack_start(synthBtn,False,False) - hbox.pack_start(vbox2,True,True) - - self.mainVBox.pack_end(hbox,False,False) + self.instDic[n] = vbox2 def handleMicRecButtonClick(self,widget,mic): self.recstate = False @@ -158,28 +155,57 @@ class InstrumentPanel(gtk.EventBox): def generateInstDic(self): self.firstInstButton = None - for instrument in self.getInstrumentList(): - instBox = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS) - instBox.set_border_width(Config.PANEL_SPACING) - instButton = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + instrument + '.png' , Config.IMAGE_ROOT + instrument + 'sel.png', Config.IMAGE_ROOT + instrument + 'sel.png') - instButton.connect('clicked',self.handleInstrumentButtonClick, instrument) - if self.enterMode: - instButton.connect('enter',self.handleInstrumentButtonEnter, instrument) - instBox.pack_start(instButton) - self.instDic[instrument] = instBox - if self.firstInstButton == None: - self.firstInstButton = instButton + for instrument in self.getInstrumentList('all'): + if instrument[0:3] == 'lab' or instrument[0:3] == 'mic': + vbox = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS) + vbox.set_border_width(Config.PANEL_SPACING) + + Btn = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + instrument + '.png' , Config.IMAGE_ROOT + instrument + 'sel.png', Config.IMAGE_ROOT + instrument + 'sel.png') + if self.firstInstButton == None: + self.firstInstButton = Btn + RecBtn = ImageButton(Config.IMAGE_ROOT + 'record.png' , Config.IMAGE_ROOT + 'recordsel.png', Config.IMAGE_ROOT + 'recordhi.png') + self.tooltips.set_tip(RecBtn,Tooltips.RECMIC) + if instrument[0:3] == 'lab': + self.tooltips.set_tip(RecBtn,Tooltips.RECLAB) + + Btn.connect('clicked', self.handleInstrumentButtonClick, instrument) + if instrument[0:3] == 'mic': + RecBtn.connect('clicked', self.handleMicRecButtonClick, instrument) + if instrument[0:3] == 'lab': + RecBtn.connect('clicked', self.handleSynthRecButtonClick, instrument) + RecBtn.connect('pressed', self.handleRecButtonPress, Btn) + + vbox.pack_start(RecBtn,False,False) + vbox.pack_start(Btn,False,False) + self.instDic[instrument] = vbox + + else: + instBox = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS) + instBox.set_border_width(Config.PANEL_SPACING) + instButton = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + instrument + '.png' , Config.IMAGE_ROOT + instrument + 'sel.png', Config.IMAGE_ROOT + instrument + 'sel.png') + instButton.connect('clicked',self.handleInstrumentButtonClick, instrument) + if self.enterMode: + instButton.connect('enter',self.handleInstrumentButtonEnter, instrument) + instBox.pack_start(instButton) + self.instDic[instrument] = instBox + if self.firstInstButton == None: + self.firstInstButton = instButton + def getInstrumentList(self,category = 'all'): - instrumentList = [instrument for instrument in Config.INSTRUMENTS.keys() if instrument[0:4] != 'drum' and instrument[0:3] != 'mic' and instrument[0:3] != 'lab' and instrument[0:4] != 'guid'] + ['drum1kit', 'drum2kit', 'drum3kit'] + instrumentList = [instrument for instrument in Config.INSTRUMENTS.keys() if instrument[0:4] != 'drum' and instrument[0:4] != 'guid' and instrument[0:3] != 'mic' and instrument[0:3] != 'lab'] + ['drum1kit', 'drum2kit', 'drum3kit', 'mic1', 'mic2', 'mic3', 'mic4', 'lab1', 'lab2', 'lab3', 'lab4'] if self.enterMode: - instrumentList = [instrument for instrument in Config.INSTRUMENTS.keys() if instrument[0:4] != 'drum' and instrument[0:3] != 'mic' and instrument[0:3] != 'lab' and instrument[0:4] != 'guid'] + instrumentList = [instrument for instrument in Config.INSTRUMENTS.keys() if instrument[0:4] != 'drum' and instrument[0:4] != 'guid' and instrument[0:3] != 'mic' and instrument[0:3] != 'lab'] + ['mic1', 'mic2', 'mic3', 'mic4', 'lab1', 'lab2', 'lab3', 'lab4'] if category != 'all': - instrumentList = [instrument for instrument in Config.INSTRUMENTS.keys() if instrument[0:4] != 'drum' and instrument[0:3] != 'mic' and instrument[0:3] != 'lab' and instrument[0:4] != 'guid' and Config.INSTRUMENTS[instrument].category == category] + instrumentList = [instrument for instrument in Config.INSTRUMENTS.keys() if instrument[0:4] != 'drum' and instrument[0:4] != 'guid' and Config.INSTRUMENTS[instrument].category == category] if category == 'percussions' and not self.enterMode: instrumentList = ['drum1kit', 'drum2kit', 'drum3kit'] + instrumentList + if category == 'people': + instrumentList = instrumentList + ['mic1', 'mic2', 'mic3', 'mic4'] + if category == 'electronic': + instrumentList = instrumentList + ['lab1', 'lab2', 'lab3', 'lab4'] #instrumentList = instrumentList.sort(lambda g,l: cmp(Config.INSTRUMENTS[g].category, Config.INSTRUMENTS[l].category) ) return instrumentList |