Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames <olpc@localhost.localdomain>2007-02-27 20:51:35 (GMT)
committer James <olpc@localhost.localdomain>2007-02-27 20:51:35 (GMT)
commitab211b6ab4a10d3840dbb33a09c58711dd12fa9e (patch)
tree7434d4d19150c1a427dbbc14c696be59c4c64c68
parentde7605b1d093b7089d7ae5ecd182b25f1f658c80 (diff)
parentefde4e823dc4418763514e0634fc3c1393ba36d8 (diff)
merge
-rw-r--r--Edit/MainWindow.py113
-rw-r--r--Edit/TrackInterface.py18
-rw-r--r--FActivity.py9
-rw-r--r--Resources/Images/synthRecord1.pngbin0 -> 1804 bytes
-rw-r--r--Resources/Images/synthRecord1Down.pngbin0 -> 2295 bytes
-rw-r--r--Resources/Images/synthRecord1Over.pngbin0 -> 2110 bytes
-rw-r--r--Resources/Images/synthRecord2.pngbin0 -> 1998 bytes
-rw-r--r--Resources/Images/synthRecord2Down.pngbin0 -> 2965 bytes
-rw-r--r--Resources/Images/synthRecord2Over.pngbin0 -> 2300 bytes
-rw-r--r--Resources/Images/synthRecord3.pngbin0 -> 2063 bytes
-rw-r--r--Resources/Images/synthRecord3Down.pngbin0 -> 3023 bytes
-rw-r--r--Resources/Images/synthRecord3Over.pngbin0 -> 2362 bytes
-rw-r--r--Resources/Images/synthRecord4.pngbin0 -> 1912 bytes
-rw-r--r--Resources/Images/synthRecord4Down.pngbin0 -> 2879 bytes
-rw-r--r--Resources/Images/synthRecord4Over.pngbin0 -> 2205 bytes
-rw-r--r--Resources/Images/synthRecord5.pngbin0 -> 2054 bytes
-rw-r--r--Resources/Images/synthRecord5Down.pngbin0 -> 3024 bytes
-rw-r--r--Resources/Images/synthRecord5Over.pngbin0 -> 2344 bytes
-rw-r--r--Resources/Images/synthRecord6.pngbin0 -> 2065 bytes
-rw-r--r--Resources/Images/synthRecord6Down.pngbin0 -> 3008 bytes
-rw-r--r--Resources/Images/synthRecord6Over.pngbin0 -> 2366 bytes
-rw-r--r--SynthLab/SynthLabWindow.py2
-rwxr-xr-xTamTam.py15
-rw-r--r--Util/InstrumentPanel.py28
-rw-r--r--Util/ThemeWidgets.py86
-rw-r--r--activity/activity.info2
-rw-r--r--miniTamTam/miniTamTamMain.py6
27 files changed, 211 insertions, 68 deletions
diff --git a/Edit/MainWindow.py b/Edit/MainWindow.py
index 0137bd6..4a18ef6 100644
--- a/Edit/MainWindow.py
+++ b/Edit/MainWindow.py
@@ -123,8 +123,8 @@ class MainWindow( SubActivity ):
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"] = ImageButton(Config.IMAGE_ROOT + self._data['track_inst'][0] + '.png')
- self.GUI["2instrument1Button"].connect("pressed", self.pickInstrument, 0 )
+ self.GUI["2instrument1Button"] = ImageToggleButton(Config.IMAGE_ROOT + self._data['track_inst'][0] + '.png', Config.IMAGE_ROOT + self._data['track_inst'][0] + '.png')
+ self.GUI["2instrument1Button"].connect("toggled", 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"] )
@@ -138,8 +138,8 @@ class MainWindow( SubActivity ):
self.GUI["2instrument2volumeSlider"].set_size_request( 30, -1 )
self.GUI["2instrument2volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 1 )
self.GUI["2instrument2Box"].pack_start( self.GUI["2instrument2volumeSlider"], False, False, 0 )
- self.GUI["2instrument2Button"] = ImageButton(Config.IMAGE_ROOT + self._data['track_inst'][1] + '.png')
- self.GUI["2instrument2Button"].connect("pressed", self.pickInstrument, 1 )
+ self.GUI["2instrument2Button"] = ImageToggleButton(Config.IMAGE_ROOT + self._data['track_inst'][1] + '.png', Config.IMAGE_ROOT + self._data['track_inst'][1] + '.png')
+ self.GUI["2instrument2Button"].connect("toggled", self.pickInstrument, 1 )
self.GUI["2instrument2Box"].pack_start( self.GUI["2instrument2Button"] )
#self.GUI["2instrument2Button"] = gtk.Button("Inst 2")
#self.GUI["2instrument2Box"].pack_start( self.GUI["2instrument2Button"] )
@@ -155,8 +155,8 @@ class MainWindow( SubActivity ):
self.GUI["2instrument3volumeSlider"].set_size_request( 30, -1 )
self.GUI["2instrument3volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 2 )
self.GUI["2instrument3Box"].pack_start( self.GUI["2instrument3volumeSlider"], False, False, 0 )
- self.GUI["2instrument3Button"] = ImageButton(Config.IMAGE_ROOT + self._data['track_inst'][2] + '.png')
- self.GUI["2instrument3Button"].connect("pressed", self.pickInstrument, 2 )
+ self.GUI["2instrument3Button"] = ImageToggleButton(Config.IMAGE_ROOT + self._data['track_inst'][2] + '.png', Config.IMAGE_ROOT + self._data['track_inst'][2] + '.png')
+ self.GUI["2instrument3Button"].connect("toggled", self.pickInstrument, 2 )
self.GUI["2instrument3Box"].pack_start( self.GUI["2instrument3Button"] )
#self.GUI["2instrument3Button"] = gtk.Button("Inst 3")
#self.GUI["2instrument3Box"].pack_start( self.GUI["2instrument3Button"] )
@@ -172,8 +172,8 @@ class MainWindow( SubActivity ):
self.GUI["2instrument4volumeSlider"].set_size_request( 30, -1 )
self.GUI["2instrument4volumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 3 )
self.GUI["2instrument4Box"].pack_start( self.GUI["2instrument4volumeSlider"], False, False, 0 )
- self.GUI["2instrument4Button"] = ImageButton(Config.IMAGE_ROOT + self._data['track_inst'][3] + '.png')
- self.GUI["2instrument4Button"].connect("pressed", self.pickInstrument, 3 )
+ self.GUI["2instrument4Button"] = ImageToggleButton(Config.IMAGE_ROOT + self._data['track_inst'][3] + '.png', Config.IMAGE_ROOT + self._data['track_inst'][3] + '.png')
+ self.GUI["2instrument4Button"].connect("toggled", self.pickInstrument, 3 )
self.GUI["2instrument4Box"].pack_start( self.GUI["2instrument4Button"] )
#self.GUI["2instrument4Button"] = gtk.Button("Inst 4")
#self.GUI["2instrument4Box"].pack_start( self.GUI["2instrument4Button"] )
@@ -189,8 +189,8 @@ class MainWindow( SubActivity ):
self.GUI["2drumvolumeSlider"].set_size_request( 30, -1 )
self.GUI["2drumvolumeAdjustment"].connect( "value-changed", self.handleTrackVolume, 4 )
self.GUI["2drumBox"].pack_start( self.GUI["2drumvolumeSlider"], False, False, 0 )
- self.GUI["2drumButton"] = ImageButton(Config.IMAGE_ROOT + 'drum1kit' + '.png')
- self.GUI["2drumButton"].connect("pressed", self.pickDrum)
+ self.GUI["2drumButton"] = ImageToggleButton(Config.IMAGE_ROOT + 'drum1kit' + '.png', Config.IMAGE_ROOT + 'drum1kit' + '.png')
+ self.GUI["2drumButton"].connect("toggled", self.pickDrum)
self.GUI["2drumBox"].pack_start( self.GUI["2drumButton"] )
#self.GUI["2instrument1Box"].pack_start( track_menu(4,'?') )
self.GUI["2instrumentPanel"].pack_start( self.GUI["2drumBox"] )
@@ -234,7 +234,7 @@ class MainWindow( SubActivity ):
#self.GUI["2XYSlider"] = XYSlider( self.GUI["2XYSliderFixed"], self.GUI["2XYSliderButton"], self.GUI["2XYSliderXAdjustment"], self.GUI["2XYSliderYAdjustment"], True, True )
#self.GUI["2rightPanel"].pack_start( self.GUI["2XYSlider"], False, False, 0 )
self.trackInterface = TrackInterface( self.noteDB, self )
- self.noteDB.addListener( self.trackInterface, TrackInterfaceParasite )
+ self.noteDB.addListener( self.trackInterface, TrackInterfaceParasite, True )
self.trackInterface.set_size_request( -1, 713 )
self.GUI["2rightPanel"].pack_start( self.trackInterface, False, False, 0 )
# + tool panel
@@ -375,8 +375,10 @@ class MainWindow( SubActivity ):
self.GUI["2pauseButton"].connect( "clicked", self.handleStop, False )
self.GUI["2pauseBox"].pack_start( self.GUI["2pauseButton"] )
self.GUI["2pauseBox"].show_all()
- self.GUI["2loopButton"] = ImageToggleButton( Config.IMAGE_ROOT+"loop.png", Config.IMAGE_ROOT+"loop.png", Config.IMAGE_ROOT+"loop.png", backgroundFill = Config.BG_COLOR )
- self.GUI["2loopButton"].connect( "toggled", self.handleLoopButton )
+ #self.GUI["2loopButton"] = ImageToggleButton( Config.IMAGE_ROOT+"loop.png", Config.IMAGE_ROOT+"loop.png", Config.IMAGE_ROOT+"loop.png", backgroundFill = Config.BG_COLOR )
+ #self.GUI["2loopButton"].connect( "toggled", self.handleLoopButton )
+ self.GUI["2loopButton"] = ImageButton( Config.IMAGE_ROOT+"close.png" )
+ self.GUI["2loopButton"].connect( "pressed", self.handleClose)
self.GUI["2transportBox"].pack_start( self.GUI["2loopButton"] )
self.GUI["2toolPanel"].pack_start( self.GUI["2transportBox"] )
# + tune box
@@ -411,13 +413,30 @@ class MainWindow( SubActivity ):
self.generationParametersWindow = GenerationParametersWindow( self.generate, self.variate, self.handleCloseGenerationParametersWindow )
- # playback scope
+ # Popups
+ # + instrument panel
+ self.GUI["9instrumentPopup"] = gtk.Window(gtk.WINDOW_POPUP)
+ self.GUI["9instrumentPopup"].move( 400, 100 )
+ self.GUI["9instrumentPopup"].resize( 800, 452 )
+ self.GUI["9instrumentPopup"].set_modal(True)
+ self.GUI["9instrumentPopup"].add_events( gtk.gdk.BUTTON_PRESS_MASK )
+ self.GUI["9instrumentPopup"].connect("button-release-event", lambda w,e:self.cancelInstrumentSelection() )
+ self.GUI["9instrumentPopup"].add( self.instrumentPanel )
+ # + drum panel
+ self.GUI["9drumPopup"] = gtk.Window(gtk.WINDOW_POPUP)
+ self.GUI["9drumPopup"].move( 400, 100 )
+ self.GUI["9drumPopup"].resize( 400, 100 )
+ self.GUI["9drumPopup"].set_modal(True)
+ self.GUI["9drumPopup"].add_events( gtk.gdk.BUTTON_PRESS_MASK )
+ self.GUI["9drumPopup"].connect("button-release-event", lambda w,e:self.cancelDrumSelection() )
+ self.GUI["9drumPopup"].add( self.drumPanel )
+ # + playback scope
self.GUI["9loopPopup"] = gtk.Window(gtk.WINDOW_POPUP)
self.GUI["9loopPopup"].move( 100, 100 )
self.GUI["9loopPopup"].resize( 300, 100 )
self.GUI["9loopPopup"].set_modal(True)
self.GUI["9loopPopup"].add_events( gtk.gdk.BUTTON_PRESS_MASK )
- self.GUI["9loopPopup"].connect("button-press-event", lambda w,e:self.GUI["2loopButton"].set_active(False) )
+ self.GUI["9loopPopup"].connect("button-release-event", lambda w,e:self.GUI["2loopButton"].set_active(False) )
self.GUI["9loopBox"] = formatRoundBox( RoundHBox(), Config.BG_COLOR )
self.GUI["9loopAllOnce"] = gtk.Button("AO")
self.GUI["9loopBox"].pack_start( self.GUI["9loopAllOnce"] )
@@ -479,6 +498,14 @@ class MainWindow( SubActivity ):
self.GUI["2trackBox"].hide()
self.GUI["2noteBox"].hide()
self.setContext( CONTEXT.PAGE )
+
+ def onActivate( self ):
+ SubActivity.onActivate( self )
+ # whatever needs to be done on initialization
+
+ def onDeactivate( self ):
+ SubActivity.onDeactivate( self )
+ # clean up things like popups etc
def updateFPS( self ):
t = time.time()
@@ -593,6 +620,9 @@ class MainWindow( SubActivity ):
else: id = self.tuneInterface.getFirstSelected()
self.trackInterface.setPlayhead( 0 )
self.displayPage( id )
+
+ def handleClose(self,widget):
+ self.set_mode("welcome")
def onTimeout(self):
self.updateFPS()
@@ -681,29 +711,49 @@ class MainWindow( SubActivity ):
self.kb_record = self.GUI["playButton"].get_active() and self.GUI["2recordButton"].get_active()
def pickInstrument( self, widget, num ):
- self.last_clicked_instTrackID = num
- self.instrumentPanel.selectFirstCat()
- self.instrumentPanel.set_activeInstrument( self._data['track_inst'][num], True )
- self.GUI["2main"].remove( self.GUI["2rightPanel"] )
- self.GUI["2main"].pack_start( self.instrumentPanel )
+ if widget.get_active(): # show the panel
+ self.last_clicked_instTrackID = num
+ self.instrumentPanel.selectFirstCat()
+ self.instrumentPanel.set_activeInstrument( self._data['track_inst'][num], True )
+ winLoc = self.parent.window.get_position()
+ alloc = widget.get_allocation()
+ x = alloc.x + alloc.width + winLoc[0]
+ y = alloc.y + winLoc[1]
+ self.GUI["9instrumentPopup"].move( x, y )
+ self.GUI["9instrumentPopup"].show()
+ else: # hide the panel
+ self.GUI["9instrumentPopup"].hide()
+
+ def cancelInstrumentSelection( self ):
+ self.GUI["2instrument" + str(self.last_clicked_instTrackID+1) + "Button"].set_active(False)
def donePickInstrument( self, instrumentName ):
self.handleInstrumentChanged( (self.last_clicked_instTrackID, instrumentName) )
#self.instrumentPanel.set_activeInstrument( self._data['track_inst'][self.last_clicked_instTrackID], False )
- self.GUI["2main"].remove( self.instrumentPanel )
- self.GUI["2main"].pack_start( self.GUI["2rightPanel"] )
- self.GUI["2instrument" + str(self.last_clicked_instTrackID+1) + "Button"].load_pixmap( "main", self.GUI["2instrumentIcons"][instrumentName] )
- #self.instrumentPanel.destroy()
+ btn = self.GUI["2instrument" + str(self.last_clicked_instTrackID+1) + "Button"]
+ btn.load_pixmap( "main", self.GUI["2instrumentIcons"][instrumentName] )
+ btn.load_pixmap( "alt", self.GUI["2instrumentIcons"][instrumentName] )
+ btn.set_active( False )
def pickDrum( self, widget , data = None ):
- self.GUI["2main"].remove( self.GUI["2rightPanel"] )
- self.GUI["2main"].pack_start( self.drumPanel )
+ if widget.get_active(): # show the panel
+ winLoc = self.parent.window.get_position()
+ alloc = widget.get_allocation()
+ x = alloc.x + alloc.width + winLoc[0]
+ y = alloc.y + winLoc[1]
+ self.GUI["9drumPopup"].move( x, y )
+ self.GUI["9drumPopup"].show()
+ else: # hide the panel
+ self.GUI["9drumPopup"].hide()
+ def cancelDrumSelection( self ):
+ self.GUI["2drumButton"].set_active( False )
+
def donePickDrum( self, drum ):
self._data['track_inst'][4] = drum
self.GUI["2drumButton"].load_pixmap( "main", self.GUI["2instrumentIcons"][drum] )
- self.GUI["2main"].remove( self.drumPanel )
- self.GUI["2main"].pack_start( self.GUI["2rightPanel"] )
+ self.GUI["2drumButton"].load_pixmap( "alt", self.GUI["2instrumentIcons"][drum] )
+ self.GUI["2drumButton"].set_active( False )
#-----------------------------------
# generation functions
@@ -1110,9 +1160,6 @@ class MainWindow( SubActivity ):
key = event.hardware_keycode
- if key == 53 and Config.ModKeys.ctrlDown: # q == 53
- self.destroy( self )
-
if not self.kb_active:
return
if self.kb_record:
@@ -1225,9 +1272,9 @@ class MainWindow( SubActivity ):
else:
self.updateContextNavButtons()
- def setContext( self, context ):
+ def setContext( self, context, force = False ):
- if self.context == context: return
+ if self.context == context and not force: return
if self.context == CONTEXT.PAGE: self.GUI["2pageBox"].hide()
elif self.context == CONTEXT.TRACK: self.GUI["2trackBox"].hide()
diff --git a/Edit/TrackInterface.py b/Edit/TrackInterface.py
index 4acba12..cbe9673 100644
--- a/Edit/TrackInterface.py
+++ b/Edit/TrackInterface.py
@@ -185,6 +185,22 @@ class TrackInterface( gtk.EventBox ):
self.clipboardDrumTrack = self.clipboardArea["tracks"][self.drumIndex]
#=======================================================
+ # NoteDB notifications
+
+ def notifyPageAdd( self, id, at ):
+ return
+
+ def notifyPageDelete( self, which, safe ):
+ if self.screenBufPage[self.preScreen] in which:
+ self.screenBufPage[self.preScreen] = -1
+
+ def notifyPageDuplicate( self, new, at ):
+ return
+
+ def notifyPageMove( self, which, low, high ):
+ return
+
+ #=======================================================
# Module Interface
def getDrawingPackage( self, track ):
@@ -359,7 +375,7 @@ class TrackInterface( gtk.EventBox ):
id = self.noteDB.addNote( self.curPage, i, cs )
n = self.noteDB.getNote( self.curPage, i, id, self )
self.selectNotes( { i:[n] }, True )
- n.playSampleNote()
+ n.playSampleNote( False )
if i != self.drumIndex: # switch to drag duration
self.updateDragLimits()
self.clickLoc[0] += self.ticksToPixels( self.curBeats, 1 )
diff --git a/FActivity.py b/FActivity.py
new file mode 100644
index 0000000..2708a05
--- /dev/null
+++ b/FActivity.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+
+import pygtk
+pygtk.require( '2.0' )
+import gtk
+
+class FakeActivity(gtk.Window):
+ def __init__(self, handle):
+ gtk.Window.__init__(self) \ No newline at end of file
diff --git a/Resources/Images/synthRecord1.png b/Resources/Images/synthRecord1.png
new file mode 100644
index 0000000..6e08836
--- /dev/null
+++ b/Resources/Images/synthRecord1.png
Binary files differ
diff --git a/Resources/Images/synthRecord1Down.png b/Resources/Images/synthRecord1Down.png
new file mode 100644
index 0000000..d96320d
--- /dev/null
+++ b/Resources/Images/synthRecord1Down.png
Binary files differ
diff --git a/Resources/Images/synthRecord1Over.png b/Resources/Images/synthRecord1Over.png
new file mode 100644
index 0000000..5ea13d5
--- /dev/null
+++ b/Resources/Images/synthRecord1Over.png
Binary files differ
diff --git a/Resources/Images/synthRecord2.png b/Resources/Images/synthRecord2.png
new file mode 100644
index 0000000..25b6b1f
--- /dev/null
+++ b/Resources/Images/synthRecord2.png
Binary files differ
diff --git a/Resources/Images/synthRecord2Down.png b/Resources/Images/synthRecord2Down.png
new file mode 100644
index 0000000..041dbd0
--- /dev/null
+++ b/Resources/Images/synthRecord2Down.png
Binary files differ
diff --git a/Resources/Images/synthRecord2Over.png b/Resources/Images/synthRecord2Over.png
new file mode 100644
index 0000000..822da6d
--- /dev/null
+++ b/Resources/Images/synthRecord2Over.png
Binary files differ
diff --git a/Resources/Images/synthRecord3.png b/Resources/Images/synthRecord3.png
new file mode 100644
index 0000000..bc38371
--- /dev/null
+++ b/Resources/Images/synthRecord3.png
Binary files differ
diff --git a/Resources/Images/synthRecord3Down.png b/Resources/Images/synthRecord3Down.png
new file mode 100644
index 0000000..c230124
--- /dev/null
+++ b/Resources/Images/synthRecord3Down.png
Binary files differ
diff --git a/Resources/Images/synthRecord3Over.png b/Resources/Images/synthRecord3Over.png
new file mode 100644
index 0000000..9539043
--- /dev/null
+++ b/Resources/Images/synthRecord3Over.png
Binary files differ
diff --git a/Resources/Images/synthRecord4.png b/Resources/Images/synthRecord4.png
new file mode 100644
index 0000000..b90db3c
--- /dev/null
+++ b/Resources/Images/synthRecord4.png
Binary files differ
diff --git a/Resources/Images/synthRecord4Down.png b/Resources/Images/synthRecord4Down.png
new file mode 100644
index 0000000..8f31d2b
--- /dev/null
+++ b/Resources/Images/synthRecord4Down.png
Binary files differ
diff --git a/Resources/Images/synthRecord4Over.png b/Resources/Images/synthRecord4Over.png
new file mode 100644
index 0000000..b255fd4
--- /dev/null
+++ b/Resources/Images/synthRecord4Over.png
Binary files differ
diff --git a/Resources/Images/synthRecord5.png b/Resources/Images/synthRecord5.png
new file mode 100644
index 0000000..1aebb42
--- /dev/null
+++ b/Resources/Images/synthRecord5.png
Binary files differ
diff --git a/Resources/Images/synthRecord5Down.png b/Resources/Images/synthRecord5Down.png
new file mode 100644
index 0000000..30a8556
--- /dev/null
+++ b/Resources/Images/synthRecord5Down.png
Binary files differ
diff --git a/Resources/Images/synthRecord5Over.png b/Resources/Images/synthRecord5Over.png
new file mode 100644
index 0000000..2b7e0d8
--- /dev/null
+++ b/Resources/Images/synthRecord5Over.png
Binary files differ
diff --git a/Resources/Images/synthRecord6.png b/Resources/Images/synthRecord6.png
new file mode 100644
index 0000000..a0c7f87
--- /dev/null
+++ b/Resources/Images/synthRecord6.png
Binary files differ
diff --git a/Resources/Images/synthRecord6Down.png b/Resources/Images/synthRecord6Down.png
new file mode 100644
index 0000000..b0eefe9
--- /dev/null
+++ b/Resources/Images/synthRecord6Down.png
Binary files differ
diff --git a/Resources/Images/synthRecord6Over.png b/Resources/Images/synthRecord6Over.png
new file mode 100644
index 0000000..f520548
--- /dev/null
+++ b/Resources/Images/synthRecord6Over.png
Binary files differ
diff --git a/SynthLab/SynthLabWindow.py b/SynthLab/SynthLabWindow.py
index d53116a..3f3fd26 100644
--- a/SynthLab/SynthLabWindow.py
+++ b/SynthLab/SynthLabWindow.py
@@ -185,6 +185,8 @@ class SynthLabWindow(SubActivity):
self.presetCallback(self.presets,0)
self.tooltips.set_tip(self.durationSlider, Tooltips.SOUNDDUR + ': ' + self.durString)
+
+ self.show_all()
def onDestroy(self):
pass
diff --git a/TamTam.py b/TamTam.py
index 5c4383d..d75fc0d 100755
--- a/TamTam.py
+++ b/TamTam.py
@@ -15,8 +15,7 @@ from SynthLab.SynthLabWindow import SynthLabWindow
try :
from sugar.activity.Activity import Activity
except ImportError:
- from gtk import Window as Activity
-
+ from FActivity import FakeActivity as Activity
if not os.path.isdir(Config.PREF_DIR):
os.mkdir(Config.PREF_DIR)
@@ -34,8 +33,8 @@ class TamTam(Activity):
# - the synth lab
# - edit mode
- def __init__(self, mode='welcome'):
- Activity.__init__(self)
+ def __init__(self, handle, mode='welcome'):
+ Activity.__init__(self, handle)
color = gtk.gdk.color_parse(Config.PANEL_BCK_COLOR)
self.modify_bg(gtk.STATE_NORMAL, color)
@@ -87,7 +86,6 @@ class TamTam(Activity):
else:
self.add( self.modeList[ self.mode ] )
self.modeList[ self.mode ].onActivate(arg)
- self.show_all()
def onFocusIn(self, event, data=None):
print 'DEBUG: TamTam::onFocusOut in TamTam.py'
@@ -113,6 +111,9 @@ class TamTam(Activity):
elif key == 25: #W
self.set_mode('welcome')
return
+ elif key == 53: #X
+ self.destroy()
+ return
self.modeList[ self.mode ].onKeyPress(widget, event)
def onKeyRelease(self, widget, event):
@@ -137,9 +138,9 @@ class TamTam(Activity):
if __name__ == "__main__":
if len(sys.argv) > 1 :
- mainwin = TamTam(sys.argv[1])
+ mainwin = TamTam(None, sys.argv[1])
else:
- mainwin = TamTam('welcome')
+ mainwin = TamTam(None, 'welcome')
gtk.main()
diff --git a/Util/InstrumentPanel.py b/Util/InstrumentPanel.py
index fc6185c..0e00dbc 100644
--- a/Util/InstrumentPanel.py
+++ b/Util/InstrumentPanel.py
@@ -24,8 +24,9 @@ class InstrumentPanel( gtk.EventBox ):
self.enterMode = enterMode
self.instrumentBox = None
self.recstate = False
+ self.lastInstrumentWidget = None
self.instDic = {}
-
+
self.mainVBox = gtk.VBox()
self.draw_toolbar()
if _instDic == None:
@@ -56,7 +57,7 @@ class InstrumentPanel( gtk.EventBox ):
self.firstTbBtn.set_active(True)
def handleToolbarBtnPress(self, widget, category):
- self.draw_instruments_panel(category)
+ self.draw_instruments_panel(category)
def draw_instruments_panel(self,category = 'all'):
@@ -100,13 +101,16 @@ class InstrumentPanel( gtk.EventBox ):
tableEventBox.modify_bg(gtk.STATE_NORMAL, color)
tableEventBox.add(self.instTable)
self.scrollWin.add_with_viewport(tableEventBox)
+ tableEventBox.get_parent().set_shadow_type( gtk.SHADOW_NONE )
self.instrumentBox.pack_start(self.scrollWin,True,True,0)
self.mainVBox.pack_start(self.instrumentBox)
self.show_all()
def handleInstrumentButtonClick(self,widget,instrument):
if widget.get_active() is True and self.recstate == False:
- if self.setInstrument: self.setInstrument(instrument)
+ if self.setInstrument:
+ widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event
+ self.setInstrument(instrument)
if self.playInstrument: self.playInstrument(instrument)
if self.enterMode:
pass #Close the window
@@ -127,7 +131,7 @@ class InstrumentPanel( gtk.EventBox ):
def handleRecButtonPress(self,widget,btn):
self.recstate = True
btn.set_active(True)
-
+
def getInstDic(self):
instDic = {}
self.firstInstButton = None
@@ -144,7 +148,7 @@ class InstrumentPanel( gtk.EventBox ):
if instrument[0:3] == 'lab':
self.tooltips.set_tip(RecBtn,Tooltips.RECLAB)
- Btn.connect('clicked', self.handleInstrumentButtonClick, instrument)
+ Btn.clickedHandler = Btn.connect('clicked', self.handleInstrumentButtonClick, instrument)
if instrument[0:3] == 'mic':
RecBtn.connect('clicked', self.handleMicRecButtonClick, instrument)
if instrument[0:3] == 'lab':
@@ -157,7 +161,7 @@ class InstrumentPanel( gtk.EventBox ):
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)
+ instButton.clickedHandler = instButton.connect('clicked',self.handleInstrumentButtonClick, instrument)
if self.enterMode:
instButton.connect('enter',self.handleInstrumentButtonEnter, instrument)
instBox.pack_start(instButton,False,False)
@@ -170,8 +174,10 @@ class InstrumentPanel( gtk.EventBox ):
if len(self.instDic) > 0:
for key in self.instDic:
if key == instrument:
- self.instDic[key].get_children()[0].set_active(state)
-
+ btn = self.instDic[key].get_children()[0]
+ btn.handler_block(btn.clickedHandler)
+ btn.set_active(state)
+ btn.handler_unblock(btn.clickedHandler)
def getInstrumentList(self,category = 'all'):
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'] + Config.DRUMKITS + ['mic1', 'mic2', 'mic3', 'mic4', 'lab1', 'lab2', 'lab3', 'lab4']
@@ -208,7 +214,7 @@ class DrumPanel( gtk.EventBox ):
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)
+ self.drums[drumkit].clickedHandler = self.drums[drumkit].connect('clicked',self.setDrums,drumkit)
if firstBtn == None:
firstBtn = self.drums[drumkit]
instBox.pack_start(self.drums[drumkit], False, False, 0)
@@ -218,7 +224,9 @@ class DrumPanel( gtk.EventBox ):
def setDrums(self,widget,data):
if widget.get_active():
- if self.setDrum: self.setDrum(data)
+ if self.setDrum:
+ widget.event( gtk.gdk.Event( gtk.gdk.LEAVE_NOTIFY ) ) # fake the leave event
+ self.setDrum(data)
if __name__ == "__main__":
win = gtk.Window()
diff --git a/Util/ThemeWidgets.py b/Util/ThemeWidgets.py
index b62a73e..5c1bca2 100644
--- a/Util/ThemeWidgets.py
+++ b/Util/ThemeWidgets.py
@@ -795,6 +795,8 @@ class ImageButton(gtk.Button):
return True
def load_pixmap(self, name, pixmap):
+ if name == "main" and self.image["main"] == self.image["enter"]:
+ self.image["enter"] = pixmap
self.image[name] = pixmap
self.queue_draw()
@@ -826,6 +828,7 @@ class ImageToggleButton(gtk.ToggleButton):
gtk.ToggleButton.__init__(self)
self.alloc = None
self.within = False
+ self.clicked = False
win = gtk.gdk.get_default_root_window()
self.gc = gtk.gdk.GC( win )
@@ -863,16 +866,26 @@ class ImageToggleButton(gtk.ToggleButton):
if enterImg_path != None:
prepareImage( "enter", enterImg_path )
- self.connect('enter-notify-event',self.on_btn_enter)
- self.connect('leave-notify-event',self.on_btn_leave)
-
- self.connect('toggled',self.toggleImage, None)
+ else:
+ self.image["enter"] = self.image["main"]
+ self.itype["enter"] = self.itype["main"]
+ self.iwidth["enter"] = self.iwidth["main"]
+ self.iwidthDIV2["enter"] = self.iwidthDIV2["main"]
+ self.iheight["enter"] = self.iheight["main"]
+ self.iheightDIV2["enter"] = self.iheightDIV2["main"]
+
+ self.connect('enter-notify-event',self.on_btn_enter)
+ self.connect('leave-notify-event',self.on_btn_leave)
+
+ self.connect('toggled',self.toggleImage)
+ self.connect('pressed',self.pressed )
+ self.connect('released',self.released )
self.connect('expose-event', self.expose)
self.connect('size-allocate', self.size_allocate)
self.set_size_request(self.iwidth["main"],self.iheight["main"])
- self.toggleImage( self, None )
+ self.toggleImage( self )
def size_allocate(self, widget, allocation):
self.alloc = allocation
@@ -886,7 +899,13 @@ class ImageToggleButton(gtk.ToggleButton):
self.window.draw_drawable( self.gc, self.image[self.curImage], 0, 0, self.drawX - self.iwidthDIV2[self.curImage], self.drawY - self.iheightDIV2[self.curImage], self.iwidth[self.curImage], self.iheight[self.curImage] )
return True
- def toggleImage(self, widget, event):
+ def load_pixmap(self, name, pixmap):
+ if name == "main" and self.image["main"] == self.image["enter"]:
+ self.image["enter"] = pixmap
+ self.image[name] = pixmap
+ self.queue_draw()
+
+ def toggleImage(self, widget):
if not self.get_active():
if self.within and self.image.has_key("enter"):
self.curImage = "enter"
@@ -896,16 +915,25 @@ class ImageToggleButton(gtk.ToggleButton):
self.curImage = "alt"
self.queue_draw()
- def on_btn_enter(self, widget, event):
+ def pressed( self, widget ):
+ self.clicked = True
+ self.curImage = "alt"
+ self.queue_draw()
+
+ def released( self, widget ):
+ self.clicked = False
+ self.toggleImage( self )
+
+ def on_btn_enter(self, widget, event ):
if event.mode == gtk.gdk.CROSSING_NORMAL:
self.within = True
- if not self.get_active():
+ if not self.get_active() and not self.clicked:
self.curImage = "enter"
else:
self.curImage = "alt"
self.queue_draw()
- def on_btn_leave(self, widget, event):
+ def on_btn_leave(self, widget, event ):
if event.mode == gtk.gdk.CROSSING_NORMAL:
self.within = False
if not self.get_active():
@@ -920,6 +948,7 @@ class ImageRadioButton(gtk.RadioButton):
gtk.RadioButton.__init__(self, group)
self.alloc = None
self.within = False
+ self.clicked = False
win = gtk.gdk.get_default_root_window()
self.gc = gtk.gdk.GC( win )
@@ -957,16 +986,26 @@ class ImageRadioButton(gtk.RadioButton):
if enterImg_path != None:
prepareImage( "enter", enterImg_path )
- self.connect('enter-notify-event',self.on_btn_enter)
- self.connect('leave-notify-event',self.on_btn_leave)
-
- self.connect("toggled", self.toggleImage, None )
+ else:
+ self.image["enter"] = self.image["main"]
+ self.itype["enter"] = self.itype["main"]
+ self.iwidth["enter"] = self.iwidth["main"]
+ self.iwidthDIV2["enter"] = self.iwidthDIV2["main"]
+ self.iheight["enter"] = self.iheight["main"]
+ self.iheightDIV2["enter"] = self.iheightDIV2["main"]
+
+ self.connect('enter-notify-event',self.on_btn_enter)
+ self.connect('leave-notify-event',self.on_btn_leave)
+
+ self.connect("toggled", self.toggleImage )
+ self.connect('pressed',self.pressed )
+ self.connect('released',self.released )
self.connect('expose-event', self.expose)
self.connect('size-allocate', self.size_allocate)
self.set_size_request(self.iwidth["main"],self.iheight["main"])
- self.toggleImage( self, None )
+ self.toggleImage( self )
def size_allocate(self, widget, allocation):
self.alloc = allocation
@@ -980,7 +1019,13 @@ class ImageRadioButton(gtk.RadioButton):
self.window.draw_drawable( self.gc, self.image[self.curImage], 0, 0, self.drawX - self.iwidthDIV2[self.curImage], self.drawY - self.iheightDIV2[self.curImage], self.iwidth[self.curImage], self.iheight[self.curImage] )
return True
- def toggleImage(self, widget, event):
+ def load_pixmap(self, name, pixmap):
+ if name == "main" and self.image["main"] == self.image["enter"]:
+ self.image["enter"] = pixmap
+ self.image[name] = pixmap
+ self.queue_draw()
+
+ def toggleImage( self, widget ):
if not self.get_active():
if self.within and self.image.has_key("enter"):
self.curImage = "enter"
@@ -990,10 +1035,19 @@ class ImageRadioButton(gtk.RadioButton):
self.curImage = "alt"
self.queue_draw()
+ def pressed( self, widget ):
+ self.clicked = True
+ self.curImage = "alt"
+ self.queue_draw()
+
+ def released( self, widget ):
+ self.clicked = False
+ self.toggleImage( self )
+
def on_btn_enter(self, widget, event):
if event.mode == gtk.gdk.CROSSING_NORMAL:
self.within = True
- if not self.get_active():
+ if not self.get_active() and not self.clicked:
self.curImage = "enter"
else:
self.curImage = "alt"
diff --git a/activity/activity.info b/activity/activity.info
index d378881..a2b3186 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -2,5 +2,5 @@
name = TamTam
service_name = org.laptop.TamTam
icon = activity-tamtam
-exec = sugar-activity-factory TamTam.TamTam
+class = TamTam.TamTam
activity_version = 15 \ No newline at end of file
diff --git a/miniTamTam/miniTamTamMain.py b/miniTamTam/miniTamTamMain.py
index dcb6fd1..dca6122 100644
--- a/miniTamTam/miniTamTamMain.py
+++ b/miniTamTam/miniTamTamMain.py
@@ -209,6 +209,9 @@ class miniTamTamMain(SubActivity):
self.playStopButton.connect('clicked' , self.handlePlayButton)
transportBox.pack_start(self.seqRecordButton)
transportBox.pack_start(self.playStopButton)
+ closeButton = ImageButton(Config.IMAGE_ROOT + 'close.png')
+ closeButton.connect('pressed',self.handleClose)
+ transportBox.pack_start(closeButton)
self.tooltips.set_tip(self.seqRecordButton,Tooltips.SEQ)
self.tooltips.set_tip(self.playStopButton,Tooltips.PLAY)
@@ -273,6 +276,9 @@ class miniTamTamMain(SubActivity):
i = i + 1
self.csnd.loopPlay(n)
self.csnd.loopSetNumTicks( self.beat * Config.TICKS_PER_BEAT)
+
+ def handleClose(self,widget):
+ self.set_mode('welcome')
def handleGenerationSlider(self, adj):
img = int(adj.value * 7)+1