diff options
author | Nat <natcl@hotmail.com> | 2007-07-05 19:10:26 (GMT) |
---|---|---|
committer | Nat <natcl@hotmail.com> | 2007-07-05 19:10:26 (GMT) |
commit | 06839311223289f02e1a128efeb1745fcf49ca34 (patch) | |
tree | 7353184e42d9f1f883a899d5b0c3a17a2661fd39 | |
parent | 273444d0cc21603f83b0aebe9643c32839decb02 (diff) |
Save stuff
-rw-r--r-- | Edit/MainWindow.py | 60 | ||||
-rwxr-xr-x | TamTam.py | 2 | ||||
-rw-r--r-- | Util/KeyboardWindow.py | 6 |
3 files changed, 35 insertions, 33 deletions
diff --git a/Edit/MainWindow.py b/Edit/MainWindow.py index b1650b2..e69a9b5 100644 --- a/Edit/MainWindow.py +++ b/Edit/MainWindow.py @@ -1479,38 +1479,38 @@ class MainWindow( SubActivity ): chooser.destroy() self.delay = gobject.timeout_add(1000, self.waitToSet) - def handleJournalLoad(self,file_path): - self.noteDB.deletePages( self.noteDB.pages.keys() ) - - ifile = open(file_path, 'r') - ttt = ControlStream.TamTamTable ( self.noteDB ) - ttt.parseFile(ifile) - self.trackInstrument = self.trackInstrumentDefault[:] # these will get set correctly in displayPage - self._data['track_volume'] = ttt.tracks_volume - self._data['volume'] = float(ttt.masterVolume) - self._data['tempo'] = float(ttt.tempo) - self.GUI["2volumeAdjustment"].set_value(self._data['volume']) - self.GUI["2tempoAdjustment"].set_value(self._data['tempo']) - for i in range(Config.NUMBER_OF_TRACKS): - if i == 4: - string = '2drumvolumeAdjustment' - else: - string = '2instrument' + str(i+1) + 'volumeAdjustment' - self.GUI[string].set_value(self._data['track_volume'][i]) - for tid in range(Config.NUMBER_OF_TRACKS): - self.last_clicked_instTrackID = tid - if tid == 4: - self.donePickDrum(self.trackInstrument[tid].name) - else: - self.donePickInstrument(self.trackInstrument[tid].name) - ifile.close() + def handleJournalLoad(self,file_path): + self.noteDB.deletePages( self.noteDB.pages.keys() ) + + ifile = open(file_path, 'r') + ttt = ControlStream.TamTamTable ( self.noteDB ) + ttt.parseFile(ifile) + self.trackInstrument = self.trackInstrumentDefault[:] # these will get set correctly in displayPage + self._data['track_volume'] = ttt.tracks_volume + self._data['volume'] = float(ttt.masterVolume) + self._data['tempo'] = float(ttt.tempo) + self.GUI["2volumeAdjustment"].set_value(self._data['volume']) + self.GUI["2tempoAdjustment"].set_value(self._data['tempo']) + for i in range(Config.NUMBER_OF_TRACKS): + if i == 4: + string = '2drumvolumeAdjustment' + else: + string = '2instrument' + str(i+1) + 'volumeAdjustment' + self.GUI[string].set_value(self._data['track_volume'][i]) + for tid in range(Config.NUMBER_OF_TRACKS): + self.last_clicked_instTrackID = tid + if tid == 4: + self.donePickDrum(self.trackInstrument[tid].name) + else: + self.donePickInstrument(self.trackInstrument[tid].name) + ifile.close() - self.tuneInterface.selectPages( self.noteDB.tune ) - #self.displayPage(1) + self.tuneInterface.selectPages( self.noteDB.tune ) + #self.displayPage(1) - # TODO: if deletePages() worked the first time, we wouldn't need - # this - self.noteDB.deletePages( self.noteDB.tune[0:1] ) + # TODO: if deletePages() worked the first time, we wouldn't need + # this + self.noteDB.deletePages( self.noteDB.tune[0:1] ) #----------------------------------- # Record functions @@ -226,7 +226,7 @@ class TamTam(Activity): subactivity_name = self.metadata['tamtam_subactivity'] if subactivity_name: self.set_mode(subactivity_name) - self.modeList['subactivity_name'].handleJournalLoad(file_path) + self.modeList[subactivity_name].handleJournalLoad(file_path) def write_file(self,file_path): if self.mode == 'edit': diff --git a/Util/KeyboardWindow.py b/Util/KeyboardWindow.py index 2438170..1463825 100644 --- a/Util/KeyboardWindow.py +++ b/Util/KeyboardWindow.py @@ -129,13 +129,15 @@ class KeyboardWindow(gtk.Window): elif event.hardware_keycode == 133: # Send a fake mouse event self.btn_dic["right_mouse"].set_fillcolor(random.random(),random.random(),random.random()) else: - self.btn_dic[event.hardware_keycode].set_fillcolor(random.random(),random.random(),random.random()) + if self.btn_dic.has_key(event.hardware_keycode): + self.btn_dic[event.hardware_keycode].set_fillcolor(random.random(),random.random(),random.random()) def handle_keyrelease(self,widget,event): if KEY_MAP_PIANO.has_key(event.hardware_keycode): self.btn_dic[event.hardware_keycode].set_fillcolor(1,1,1) else: - self.btn_dic[event.hardware_keycode].set_fillcolor(0,0,0) + if self.btn_dic.has_key(event.hardware_keycode): + self.btn_dic[event.hardware_keycode].set_fillcolor(0,0,0) if event.hardware_keycode == 216 or event.hardware_keycode == 133: self.btn_dic["left_mouse"].set_fillcolor(0,0,0) self.btn_dic["right_mouse"].set_fillcolor(0,0,0) |