Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Edit/MainWindow.py22
-rw-r--r--Util/InstrumentPanel.py (renamed from Util/InstrumentsPanel.py)14
2 files changed, 26 insertions, 10 deletions
diff --git a/Edit/MainWindow.py b/Edit/MainWindow.py
index 859a500..f11647a 100644
--- a/Edit/MainWindow.py
+++ b/Edit/MainWindow.py
@@ -21,6 +21,8 @@ from Util.NoteDB import NoteDB
from Edit.TrackInterface import TrackInterface, TrackInterfaceParasite
from Edit.TuneInterface import TuneInterface, TuneInterfaceParasite
+from Util.InstrumentPanel import InstrumentPanel
+
from Util.Profiler import TP
from Generation.Generator import generator1, variate
@@ -71,6 +73,8 @@ class MainWindow( gtk.EventBox ):
return box
def init_GUI():
+ self.instrumentPanel = InstrumentPanel( self.donePickInstrument, enterMode = True )
+
self.GUI = {}
self.GUI["2main"] = gtk.HBox()
@@ -106,9 +110,10 @@ class MainWindow( gtk.EventBox ):
self.GUI["2instrument1volumeSlider"].set_size_request( 30, -1 )
self.GUI["2instrument1volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 0 )
self.GUI["2instrument1Box"].pack_start( self.GUI["2instrument1volumeSlider"], False, False, 0 )
- #self.GUI["2instrument1Button"] = gtk.Button("Inst 1")
- #self.GUI["2instrument1Box"].pack_start( self.GUI["2instrument1Button"] )
- self.GUI["2instrument1Box"].pack_start( track_menu(0,'?') )
+ self.GUI["2instrument1Button"] = gtk.Button("Inst 1")
+ self.GUI["2instrument1Button"].connect("pressed", self.pickInstrument, 0 )
+ self.GUI["2instrument1Box"].pack_start( self.GUI["2instrument1Button"] )
+ #self.GUI["2instrument1Box"].pack_start( track_menu(0,'?') )
self.GUI["2instrumentPanel"].pack_start( self.GUI["2instrument1Box"] )
# + + instrument 2 box
self.GUI["2instrument2Box"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
@@ -587,6 +592,17 @@ class MainWindow( gtk.EventBox ):
self.kb_record = self.GUI["playButton"].get_active() and self.GUI["2recordButton"].get_active()
+ def pickInstrument( self, widget, num ):
+ print "pickInstrument", widget, num
+ self.GUI["2main"].remove( self.GUI["2rightPanel"] )
+ self.GUI["2main"].pack_start( self.instrumentPanel )
+
+ def donePickInstrument( self, instrumentName ):
+ print "picked", instrumentName
+ self.GUI["2main"].remove( self.instrumentPanel )
+ self.GUI["2main"].pack_start( self.GUI["2rightPanel"] )
+ #self.instrumentPanel.destroy()
+
#-----------------------------------
# generation functions
#-----------------------------------
diff --git a/Util/InstrumentsPanel.py b/Util/InstrumentPanel.py
index afd708b..0c40f50 100644
--- a/Util/InstrumentsPanel.py
+++ b/Util/InstrumentPanel.py
@@ -8,7 +8,7 @@ import Config
from Util.ThemeWidgets import *
Tooltips = Config.Tooltips
-class InstrumentsPanel(gtk.EventBox):
+class InstrumentPanel(gtk.EventBox):
def __init__(self,setInstrument = None, playInstrument = None, enterMode = False):
gtk.EventBox.__init__(self)
@@ -51,7 +51,7 @@ class InstrumentsPanel(gtk.EventBox):
instrumentNum = len(self.getInstrumentList(category))
instruments = self.getInstrumentList(category)
- cols = 8
+ cols = 9
if instrumentNum < cols:
cols = instrumentNum
rows = (instrumentNum // cols)
@@ -72,13 +72,13 @@ class InstrumentsPanel(gtk.EventBox):
def handleInstrumentButtonClick(self,widget,instrument):
if widget.get_active() is True:
- self.setInstrument(instrument)
- self.playInstrument(instrument)
+ if self.setInstrument: self.setInstrument(instrument)
+ if self.playInstrument: self.playInstrument(instrument)
if self.enterMode:
pass #Close the window
def handleInstrumentButtonEnter(self,widget,instrument):
- self.playInstrument(instrument)
+ if self.playInstrument: self.playInstrument(instrument)
def draw_mic_lab_box(self):
hbox = gtk.HBox()
@@ -152,8 +152,8 @@ class InstrumentsPanel(gtk.EventBox):
if __name__ == "__main__":
win = gtk.Window()
- wc = InstrumentsPanel()
+ wc = InstrumentPanel()
win.add(wc)
win.show()
#start the gtk event loop
- gtk.main() \ No newline at end of file
+ gtk.main()