Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Util
diff options
context:
space:
mode:
authorJames <james@mackie.local>2007-06-29 18:52:20 (GMT)
committer James <james@mackie.local>2007-06-29 18:52:20 (GMT)
commit4137cf1dab0edeb1a69db121add6ae14e7d8eb87 (patch)
tree989359ed11de1afc2e787dad2c516268a7e63acd /Util
parent9eed1058cbe83d0e1e00b647c4496c722424b22a (diff)
parent9adc6884b3eeed8c2a321025fbc86436542e12d1 (diff)
Merge branch 'master' of git+ssh://jaberg@dev.laptop.org/git/projects/tamtam
Diffstat (limited to 'Util')
-rw-r--r--Util/InstrumentPanel.py78
-rw-r--r--Util/NoteDB.py24
2 files changed, 43 insertions, 59 deletions
diff --git a/Util/InstrumentPanel.py b/Util/InstrumentPanel.py
index 3d012cc..072edcd 100644
--- a/Util/InstrumentPanel.py
+++ b/Util/InstrumentPanel.py
@@ -197,70 +197,32 @@ class InstrumentPanel( gtk.EventBox ):
for i in range( loadStage[1]-1, self.loadData["len"] ):
instrument = self.instrumentList["all"][i]
- if instrument[0:3] == 'mic':
+ if loadStage[2] == 0:
+ self.loadData["instBox"] = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS)
+ self.loadData["instBox"].set_border_width(Config.PANEL_SPACING)
+ loadStage[2] = 1
+ if timeout >= 0 and time.time() > timeout: return False
- if loadStage[2] == 0:
- self.loadData["vbox"] = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS)
- self.loadData["vbox"].set_border_width(Config.PANEL_SPACING)
- loadStage[2] = 1
- if timeout >= 0 and time.time() > timeout: return False
-
- if loadStage[2] == 1:
- self.loadData["Btn"] = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + instrument + '.png' , Config.IMAGE_ROOT + instrument + 'sel.png', Config.IMAGE_ROOT + instrument + 'sel.png')
- if self.firstInstButton == None:
- self.firstInstButton = self.loadData["Btn"]
- loadStage[2] = 2
- if timeout >= 0 and time.time() > timeout: return False
-
- if loadStage[2] == 2:
- self.loadData["RecBtn"] = ImageButton(Config.IMAGE_ROOT + 'record.png' , Config.IMAGE_ROOT + 'recordsel.png', Config.IMAGE_ROOT + 'recordhi.png')
- loadStage[2] = 3
- if timeout >= 0 and time.time() > timeout: return False
-
- if loadStage[2] == 3:
- self.tooltips.set_tip(self.loadData["RecBtn"],Tooltips.RECMIC)
-
- self.loadData["Btn"].clickedHandler = self.loadData["Btn"].connect('clicked', self.handleInstrumentButtonClick, instrument)
- self.loadData["RecBtn"].connect('clicked', self.handleMicRecButtonClick, instrument)
- loadStage[2] = 4
- if timeout >= 0 and time.time() > timeout: return False
-
- self.loadData["RecBtn"].connect('pressed', self.handleRecButtonPress, self.loadData["Btn"])
- self.loadData["vbox"].pack_start(self.loadData["RecBtn"],False,False,1)
- self.loadData["vbox"].pack_start(self.loadData["Btn"],False,False,2)
- instDic[instrument] = self.loadData["vbox"]
- loadStage[2] = 0
+ if loadStage[2] == 1:
+ self.loadData["instButton"] = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + instrument + '.png' , Config.IMAGE_ROOT + instrument + 'sel.png', Config.IMAGE_ROOT + instrument + 'sel.png')
+ loadStage[2] = 2
if timeout >= 0 and time.time() > timeout: return False
- else:
- if loadStage[2] == 0:
- self.loadData["instBox"] = RoundVBox(fillcolor = Config.INST_BCK_COLOR, bordercolor = Config.PANEL_COLOR, radius = Config.PANEL_RADIUS)
- self.loadData["instBox"].set_border_width(Config.PANEL_SPACING)
- loadStage[2] = 1
- if timeout >= 0 and time.time() > timeout: return False
-
- if loadStage[2] == 1:
- self.loadData["instButton"] = ImageRadioButton(self.firstInstButton, Config.IMAGE_ROOT + instrument + '.png' , Config.IMAGE_ROOT + instrument + 'sel.png', Config.IMAGE_ROOT + instrument + 'sel.png')
- loadStage[2] = 2
- if timeout >= 0 and time.time() > timeout: return False
-
- if loadStage[2] == 2:
- self.loadData["instButton"].clickedHandler = self.loadData["instButton"].connect('clicked',self.handleInstrumentButtonClick, instrument)
- self.loadData["instButton"].connect('enter',self.handleInstrumentButtonEnter, instrument)
- loadStage[2] = 3
- if timeout >= 0 and time.time() > timeout: return False
-
- self.loadData["instBox"].pack_start(self.loadData["instButton"],False,False)
- instDic[instrument] = self.loadData["instBox"]
- if self.firstInstButton == None:
- self.firstInstButton = self.loadData["instButton"]
- loadStage[2] = 0
+
+ if loadStage[2] == 2:
+ self.loadData["instButton"].clickedHandler = self.loadData["instButton"].connect('clicked',self.handleInstrumentButtonClick, instrument)
+ self.loadData["instButton"].connect('enter',self.handleInstrumentButtonEnter, instrument)
+ loadStage[2] = 3
if timeout >= 0 and time.time() > timeout: return False
+ self.loadData["instBox"].pack_start(self.loadData["instButton"],False,False)
+ instDic[instrument] = self.loadData["instBox"]
+ if self.firstInstButton == None:
+ self.firstInstButton = self.loadData["instButton"]
+ loadStage[2] = 0
+ if timeout >= 0 and time.time() > timeout: return False
+
loadStage[1] += 1
- self.loadData.pop("vbox")
- self.loadData.pop("Btn")
- self.loadData.pop("RecBtn")
self.loadData.pop("instBox")
self.loadData.pop("instButton")
self.loadData.pop("len")
diff --git a/Util/NoteDB.py b/Util/NoteDB.py
index 7f3266d..014ec5e 100644
--- a/Util/NoteDB.py
+++ b/Util/NoteDB.py
@@ -214,8 +214,30 @@ class NoteDB:
def updatePage( self, page, parameter, value ):
if parameter == PARAMETER.PAGE_BEATS:
+ ticks = value*Config.TICKS_PER_BEAT
+ if self.pages[page].beats > value: # crop some notes
+ dstream = []
+ ustream = []
+ for track in range(Config.NUMBER_OF_TRACKS):
+ dsub = []
+ usub = []
+ for note in self.getNotesByTrack(page, track):
+ if ticks <= note.cs.onset:
+ dsub.append( note.id )
+ elif ticks < note.cs.onset + note.cs.duration:
+ usub.append( note.id )
+ usub.append( ticks - note.cs.onset )
+ if len(dsub):
+ dstream += [ page, track, len(dsub) ] + dsub
+ if len(usub):
+ ustream += [ page, track, PARAMETER.DURATION, len(usub)//2 ] + usub
+ if len(dstream):
+ self.deleteNotes( dstream + [-1] )
+ if len(ustream):
+ self.updateNotes( ustream + [-1] )
+
self.pages[page].beats = value
- self.pages[page].ticks = value*Config.TICKS_PER_BEAT
+ self.pages[page].ticks = ticks
#self._updateBeatsBefore(self.tune.index(page))
elif parameter == PARAMETER.PAGE_COLOR:
self.pages[page].color = value