diff options
author | amartin <olpc@xo-05-28-21.localdomain> | 2007-09-19 09:25:33 (GMT) |
---|---|---|
committer | amartin <olpc@xo-05-28-21.localdomain> | 2007-09-19 09:25:33 (GMT) |
commit | ae3ecf931b84a285ed308e7c92cd79890005c430 (patch) | |
tree | 836975317322b343b57e07fc4332c9592fa074a6 /TamTamEdit.activity | |
parent | f0f8faf28d8a40c6ba2fa78e04424792f9385f70 (diff) | |
parent | 7166d2a7e53465811cfa50120a02a44591fa20e2 (diff) |
merge
Diffstat (limited to 'TamTamEdit.activity')
-rw-r--r-- | TamTamEdit.activity/Edit/EditToolbars.py | 12 | ||||
-rw-r--r-- | TamTamEdit.activity/Edit/MainWindow.py | 39 | ||||
-rw-r--r-- | TamTamEdit.activity/Edit/TuneInterface.py | 3 | ||||
-rw-r--r-- | TamTamEdit.activity/MANIFEST | 1 | ||||
-rw-r--r-- | TamTamEdit.activity/TamTamEdit.py | 30 |
5 files changed, 32 insertions, 53 deletions
diff --git a/TamTamEdit.activity/Edit/EditToolbars.py b/TamTamEdit.activity/Edit/EditToolbars.py index 7854b7d..ae0c334 100644 --- a/TamTamEdit.activity/Edit/EditToolbars.py +++ b/TamTamEdit.activity/Edit/EditToolbars.py @@ -89,8 +89,6 @@ class mainToolbar(gtk.Toolbar): self.pointerButton = RadioToolButton('edit-pointer', group = None) self.pointerButton.set_palette(self._pointerPalette) self.pointerButton.connect('toggled', self.edit.handleToolClick, 'default') - self.pointerButton.get_child().connect('enter-notify-event', self.edit.blockFocus) - self.pointerButton.get_child().connect('leave-notify-event', self.edit.unblockFocus) self.insert(self.pointerButton, -1) self.pointerButton.show() @@ -99,8 +97,6 @@ class mainToolbar(gtk.Toolbar): self.drawButton = RadioToolButton('edit-pencil', group = self.pointerButton) self.drawButton.set_palette(self._drawPalette) self.drawButton.connect('toggled', self.edit.handleToolClick, 'draw') - self.drawButton.get_child().connect('enter-notify-event', self.edit.blockFocus) - self.drawButton.get_child().connect('leave-notify-event', self.edit.unblockFocus) self.insert(self.drawButton, -1) self.drawButton.show() @@ -109,8 +105,6 @@ class mainToolbar(gtk.Toolbar): self.paintButton = RadioToolButton('edit-brush', group = self.pointerButton) self.paintButton.set_palette(self._paintPalette) self.paintButton.connect('toggled', self.edit.handleToolClick, 'paint') - self.paintButton.get_child().connect('enter-notify-event', self.edit.blockFocus) - self.paintButton.get_child().connect('leave-notify-event', self.edit.unblockFocus) self.insert(self.paintButton, -1) self.paintButton.show() @@ -127,8 +121,6 @@ class mainToolbar(gtk.Toolbar): self._volumeTempoPalette = volumeTempoPalette(_('Volume / Tempo'), self.edit) self.volumeTempoButton = ToggleToolButton('voltemp') self.volumeTempoButton.set_palette(self._volumeTempoPalette) - self.volumeTempoButton.get_child().connect('enter-notify-event', self.edit.blockFocus) - self.volumeTempoButton.get_child().connect('leave-notify-event', self.edit.unblockFocus) self.insert(self.volumeTempoButton, -1) self.volumeTempoButton.show() @@ -219,8 +211,6 @@ class generateToolbar(gtk.Toolbar): self.generationButton = ToggleToolButton('dice') #self.generationButton.connect(None) self.generationButton.set_palette(self._generationPalette) - self.generationButton.get_child().connect('enter-notify-event', self.edit.blockFocus) - self.generationButton.get_child().connect('leave-notify-event', self.edit.unblockFocus) self.insert(self.generationButton, -1) self.generationButton.show() @@ -228,8 +218,6 @@ class generateToolbar(gtk.Toolbar): self._propertiesPalette = propertiesPalette(_('Properties'), self.edit) self.propsButton = ToggleToolButton('props') self.propsButton.set_palette(self._propertiesPalette) - self.propsButton.get_child().connect('enter-notify-event', self.edit.blockFocus) - self.propsButton.get_child().connect('leave-notify-event', self.edit.unblockFocus) self.insert(self.propsButton, -1) self.propsButton.show() diff --git a/TamTamEdit.activity/Edit/MainWindow.py b/TamTamEdit.activity/Edit/MainWindow.py index d23f5eb..c4c697a 100644 --- a/TamTamEdit.activity/Edit/MainWindow.py +++ b/TamTamEdit.activity/Edit/MainWindow.py @@ -247,9 +247,7 @@ class MainWindow( gtk.EventBox ): self.GUI["2drumButton"] = ImageToggleButton(Config.IMAGE_ROOT + self.trackInstrument[4].name + '.png', Config.IMAGE_ROOT + self.trackInstrument[4].name + '.png') self.GUI["2drumPalette"] = instrumentPalette(_('Track 5 Volume'), 4, self) self.GUI["2drumButton"].set_palette(self.GUI["2drumPalette"]) - self.GUI["2drumButton"].connect("toggled", self.pickDrum) - self.GUI["2drumButton"].connect('enter-notify-event', self.blockFocus) - self.GUI["2drumButton"].connect('leave-notify-event', self.unblockFocus) + self.GUI["2drumButton"].connect("toggled", self.pickDrum) self.GUI["2drumBox"].pack_start( self.GUI["2drumButton"] ) self.GUI["2instrumentPanel"].pack_start( self.GUI["2drumBox"] ) self.GUI["2page"].pack_start( self.GUI["2instrumentPanel"], False ) @@ -963,14 +961,6 @@ class MainWindow( gtk.EventBox ): #self.GUI["2instrument" + str(i+1) + "muteButton"].set_active(False) self.GUI["2instrument" + str(i+1) + "Palette"].muteButton.set_active(False) self.updatePagesPlaying() - - def blockFocus(self, widget = None, data = None): - self.activity.handler_block(self.activity.focusOutHandler) - self.activity.handler_block(self.activity.focusInHandler) - - def unblockFocus(self, widget = None, data = None): - self.activity.handler_unblock(self.activity.focusOutHandler) - self.activity.handler_unblock(self.activity.focusInHandler) #----------------------------------- # generation functions @@ -1906,7 +1896,6 @@ class InstrumentButton( gtk.DrawingArea ): self.connect( "button-press-event", self.button_press ) self.connect( "button-release-event", self.button_release ) self.connect( "motion-notify-event", self.motion_notify ) - self.connect( "enter-notify-event", self.enter_notify ) self.connect( "leave-notify-event", self.leave_notify ) self.connect( "expose-event", self.expose ) @@ -1996,13 +1985,6 @@ class InstrumentButton( gtk.DrawingArea ): if self.clicked == None: self.queue_draw() - self.owner.activity.handler_unblock(self.owner.activity.focusOutHandler) - self.owner.activity.handler_unblock(self.owner.activity.focusInHandler) - - def enter_notify(self, widget, event): - # Block the Focus Out event so that the sound does'nt stop when a Palette is invoked. - self.owner.activity.handler_block(self.owner.activity.focusOutHandler) - self.owner.activity.handler_block(self.owner.activity.focusInHandler) def setPrimary( self, img ): self.primary = img @@ -2092,10 +2074,29 @@ class instrumentPalette(Palette): self.volumeSlider.set_size_request(250, -1) self.volumeSlider.set_inverted(False) self.volumeSlider.set_draw_value(False) + + self.instrumentBox = BigComboBox() + rawinstruments = Config.INSTRUMENTS.keys() + instruments = [instrument for instrument in rawinstruments if not instrument.startswith('drum') and not instrument.startswith('gui')] + instruments.sort() + + for instrument in instruments: + image = Config.IMAGE_ROOT + instrument + '.png' + if not os.path.isfile(image): + image = Config.IMAGE_ROOT + 'generic.png' + self.instrumentBox.append_item(instrument, instrument, image) + self.instrumentBox.set_active(0) + self.instrumentBox.connect('changed', self.handleInstrumentChange) self.volumeBox.pack_start(self.muteButton, padding = 5) self.volumeBox.pack_start(self.volumeSlider, padding = 5) + self.volumeBox.pack_start(self.instrumentBox, padding = 5) self.volumeBox.show_all() self.set_content(self.volumeBox) + def handleInstrumentChange(self, widget): + instrument = widget.props.value + self.edit.playInstrumentNote(instrument) + self.edit.donePickInstrument(instrument) + diff --git a/TamTamEdit.activity/Edit/TuneInterface.py b/TamTamEdit.activity/Edit/TuneInterface.py index d29597b..f8bc4e7 100644 --- a/TamTamEdit.activity/Edit/TuneInterface.py +++ b/TamTamEdit.activity/Edit/TuneInterface.py @@ -617,7 +617,8 @@ class TuneInterface( gtk.EventBox ): self.dirtyRectToAdd.y = y self.dirtyRectToAdd.width = width self.dirtyRectToAdd.height = height - self.drawingArea.window.invalidate_rect( self.dirtyRectToAdd, True ) + if self.drawingArea.window: + self.drawingArea.window.invalidate_rect( self.dirtyRectToAdd, True ) self.drawingAreaDirty = True def invalidate_thumbnail( self, id, x, y, width, height ): diff --git a/TamTamEdit.activity/MANIFEST b/TamTamEdit.activity/MANIFEST index 2d94334..af569b0 100644 --- a/TamTamEdit.activity/MANIFEST +++ b/TamTamEdit.activity/MANIFEST @@ -43,7 +43,6 @@ icons/volume2.svg icons/volume3.svg Edit/EditToolbars.py Edit/HitInterface.py -Edit/KeyboardInput.py Edit/MainWindow.py Edit/NoteInterface.py Edit/Properties.py diff --git a/TamTamEdit.activity/TamTamEdit.py b/TamTamEdit.activity/TamTamEdit.py index 854ff16..9d9a029 100644 --- a/TamTamEdit.activity/TamTamEdit.py +++ b/TamTamEdit.activity/TamTamEdit.py @@ -27,15 +27,12 @@ class TamTamEdit(activity.Activity): color = gtk.gdk.color_parse(Config.WS_BCK_COLOR) self.modify_bg(gtk.STATE_NORMAL, color) - self.set_title('TamTam Mini') self.set_resizable(False) self.trackpad = Trackpad( self ) self.preloadTimeout = None - self.focusInHandler = self.connect('focus_in_event',self.onFocusIn) - self.focusOutHandler = self.connect('focus_out_event',self.onFocusOut) self.connect('notify::active', self.onActive) self.connect('destroy', self.onDestroy) @@ -80,20 +77,14 @@ class TamTamEdit(activity.Activity): if Config.DEBUG > 4: print "TamTam::preload returned after", time.time() - t return True - - def onFocusIn(self, event, data=None): - if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py' - csnd = new_csound_client() - csnd.connect(True) - #csnd.load_instruments() - - def onFocusOut(self, event, data=None): - if Config.DEBUG > 3: print 'DEBUG: TamTam::onFocusOut in TamTam.py' - csnd = new_csound_client() - csnd.connect(False) def onActive(self, widget = None, event = None): - pass + if widget.props.active == False: + csnd = new_csound_client() + csnd.connect(False) + else: + csnd = new_csound_client() + csnd.connect(True) def onKeyPress(self, widget, event): pass @@ -105,7 +96,7 @@ class TamTamEdit(activity.Activity): if Config.DEBUG: print 'DEBUG: TamTam::onDestroy()' os.system('rm -f ' + Config.PREF_DIR + '/synthTemp*') - self.mini.onDestroy() + self.edit.onDestroy() csnd = new_csound_client() csnd.connect(False) @@ -136,8 +127,7 @@ class TamTamEdit(activity.Activity): os.system('chmod 0777 ' + Config.SNDS_DIR + '/' + snd + ' &') def read_file(self,file_path): - self.metadata['tamtam_subactivity'] = 'mini' - + self.edit.handleJournalLoad(file_path) + def write_file(self,file_path): - f = open(file_path,'w') - f.close() + self.edit.handleJournalSave(file_path) |