Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TamTamEdit.activity/Edit/MainWindow.py24
-rw-r--r--TamTamJam.activity/Jam/JamMain.py37
-rwxr-xr-xscripts/create_symlinks.sh4
3 files changed, 27 insertions, 38 deletions
diff --git a/TamTamEdit.activity/Edit/MainWindow.py b/TamTamEdit.activity/Edit/MainWindow.py
index 538a9b2..a703205 100644
--- a/TamTamEdit.activity/Edit/MainWindow.py
+++ b/TamTamEdit.activity/Edit/MainWindow.py
@@ -78,6 +78,9 @@ class MainWindow( gtk.EventBox ):
self.trackInstrument = self.trackInstrumentDefault[:]
if len(self.trackInstrument) != Config.NUMBER_OF_TRACKS: raise 'error'
self.drumIndex = Config.NUMBER_OF_TRACKS - 1
+
+ self.last_clicked_instTrackID = 0
+ self.last_clicked_instPrimary = 'kalimba'
#second instrument for melodic tracks
self.trackInstrument2Default = [ None, None, None, None]
@@ -2049,6 +2052,7 @@ class InstrumentButton( gtk.DrawingArea ):
class instrumentPalette(Palette):
+ ICON_SIZE = (70,70)
def __init__(self, label, trackID, edit):
Palette.__init__(self, label)
@@ -2078,27 +2082,20 @@ class instrumentPalette(Palette):
self.volumeSlider.set_inverted(False)
self.volumeSlider.set_draw_value(False)
-
categories = Config.CATEGORIES
- instruments = self.getInstruments()
self.categoryBox = BigComboBox()
for category in categories:
image = Config.IMAGE_ROOT + category + '.png'
if not os.path.isfile(image):
image = Config.IMAGE_ROOT + 'generic.png'
- self.categoryBox.append_item(category, category, icon_name = image)
+ self.categoryBox.append_item(category, category, icon_name = image, size = instrumentPalette.ICON_SIZE)
self.categoryBox.set_active(0)
self.categoryBox.connect('changed', self.handleCategoryChange)
self.instrumentBox1 = BigComboBox()
- for instrument in instruments:
- image = Config.IMAGE_ROOT + instrument + '.png'
- if not os.path.isfile(image):
- image = Config.IMAGE_ROOT + 'generic.png'
- self.instrumentBox1.append_item(instrument, text = None, icon_name = image)
- self.instrumentBox1.set_active(0)
self.instrumentBox1.connect('changed', self.handleInstrumentChange)
+ self.loadInstrumentMenu(self.getInstruments())
self.volumeBox.pack_start(self.muteButton, padding = 5)
@@ -2118,17 +2115,18 @@ class instrumentPalette(Palette):
def handleCategoryChange(self, widget):
category = widget.props.value
- self.instrumentBox1.remove_all()
instruments = self.getInstruments(category)
+ self.loadInstrumentMenu(instruments)
+
+ def loadInstrumentMenu(self, instruments):
+ self.instrumentBox1.remove_all()
for instrument in instruments:
image = Config.IMAGE_ROOT + instrument + '.png'
if not os.path.isfile(image):
image = Config.IMAGE_ROOT + 'generic.png'
- self.instrumentBox1.append_item(instrument, text = None, icon_name = image)
+ self.instrumentBox1.append_item(instrument, text = None, icon_name = image, size = instrumentPalette.ICON_SIZE)
self.instrumentBox1.set_active(0)
-
-
def getInstruments(self, category = 'all'):
if category == 'all':
return sorted([instrument for instrument in Config.INSTRUMENTS.keys() if not instrument.startswith('drum') and not instrument.startswith('gui')])
diff --git a/TamTamJam.activity/Jam/JamMain.py b/TamTamJam.activity/Jam/JamMain.py
index 60a5899..505524b 100644
--- a/TamTamJam.activity/Jam/JamMain.py
+++ b/TamTamJam.activity/Jam/JamMain.py
@@ -774,32 +774,25 @@ class JamMain(gtk.EventBox):
# Pixmaps
def prepareInstrumentImage( self, id, img_path ):
+ win = gtk.gdk.get_default_root_window()
try:
- win = gtk.gdk.get_default_root_window()
pix = gtk.gdk.pixbuf_new_from_file( img_path )
- x = (Block.Block.WIDTH-pix.get_width())//2
- y = (Block.Block.HEIGHT-pix.get_height())//2
- img = gtk.gdk.Pixmap( win, Block.Block.WIDTH, Block.Block.HEIGHT )
- self.gc.foreground = self.colors["Bg_Inactive"]
- img.draw_rectangle( self.gc, True, 0, 0, Block.Block.WIDTH, Block.Block.HEIGHT )
- img.draw_pixbuf( self.gc, pix, 0, 0, x, y, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
- self.instrumentImage[id] = img
- img = gtk.gdk.Pixmap( win, Block.Block.WIDTH, Block.Block.HEIGHT )
- self.gc.foreground = self.colors["Bg_Active"]
- img.draw_rectangle( self.gc, True, 0, 0, Block.Block.WIDTH, Block.Block.HEIGHT )
- img.draw_pixbuf( self.gc, pix, 0, 0, x, y, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
- self.instrumentImageActive[id] = img
except:
if Config.DEBUG >= 5: print "JamMain:: file does not exist: " + img_path
- img = gtk.gdk.Pixmap( win, Block.Block.WIDTH, Block.Block.HEIGHT )
- self.gc.foreground = self.colors["Bg_Inactive"]
- img.draw_rectangle( self.gc, True, 0, 0, Block.Block.WIDTH, Block.Block.HEIGHT )
- self.instrumentImage[id] = img
- img = gtk.gdk.Pixmap( win, Block.Block.WIDTH, Block.Block.HEIGHT )
- self.gc.foreground = self.colors["Bg_Active"]
- img.draw_rectangle( self.gc, True, 0, 0, Block.Block.WIDTH, Block.Block.HEIGHT )
- self.instrumentImageActive[id] = img
-
+ pix = gtk.gdk.pixbuf_new_from_file( Config.IMAGE_ROOT + "/default_instrument.png" )
+ x = (Block.Block.WIDTH-pix.get_width())//2
+ y = (Block.Block.HEIGHT-pix.get_height())//2
+ img = gtk.gdk.Pixmap( win, Block.Block.WIDTH, Block.Block.HEIGHT )
+ self.gc.foreground = self.colors["Bg_Inactive"]
+ img.draw_rectangle( self.gc, True, 0, 0, Block.Block.WIDTH, Block.Block.HEIGHT )
+ img.draw_pixbuf( self.gc, pix, 0, 0, x, y, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.instrumentImage[id] = img
+ img = gtk.gdk.Pixmap( win, Block.Block.WIDTH, Block.Block.HEIGHT )
+ self.gc.foreground = self.colors["Bg_Active"]
+ img.draw_rectangle( self.gc, True, 0, 0, Block.Block.WIDTH, Block.Block.HEIGHT )
+ img.draw_pixbuf( self.gc, pix, 0, 0, x, y, pix.get_width(), pix.get_height(), gtk.gdk.RGB_DITHER_NONE )
+ self.instrumentImageActive[id] = img
+
def _drawNotes( self, pixmap, beats, notes, active ):
self.gc.set_clip_mask( self.sampleNoteMask )
for note in notes: # draw N notes
diff --git a/scripts/create_symlinks.sh b/scripts/create_symlinks.sh
index c25ae95..71eab02 100755
--- a/scripts/create_symlinks.sh
+++ b/scripts/create_symlinks.sh
@@ -1,7 +1,5 @@
#!/bin/sh
-rm -rf /usr/share/activities/TamTamEdit.activity
-rm -rf /usr/share/activities/TamTamJam.activity
-rm -rf /usr/share/activities/TamTamSynthlab.activity
+rm -rf /usr/share/activities/TamTam*
ln -s /home/olpc/tamtam/TamTamEdit.activity /usr/share/activities/TamTamEdit.activity
ln -s /home/olpc/tamtam/TamTamJam.activity /usr/share/activities/TamTamJam.activity