Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Util/NoteDB.py
diff options
context:
space:
mode:
authoramartin <olpc@xo-05-28-21.localdomain>2007-08-28 11:58:27 (GMT)
committer amartin <olpc@xo-05-28-21.localdomain>2007-08-28 11:58:27 (GMT)
commit82bce73030735492a017113f0486ebe8aae5fae6 (patch)
tree4e606e9e8b1183b43f90fbb572a78f3be9ee2ac7 /Util/NoteDB.py
parent66de29ff7807cbc2d0849ece71146fc9e72e1fe4 (diff)
Jam save/load
Diffstat (limited to 'Util/NoteDB.py')
-rw-r--r--Util/NoteDB.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Util/NoteDB.py b/Util/NoteDB.py
index 0b6c6b9..cd8d1ca 100644
--- a/Util/NoteDB.py
+++ b/Util/NoteDB.py
@@ -34,7 +34,7 @@ class Note:
self.cs = self.csStack.pop()
class Page:
- def __init__( self, beats, color = 0, instruments = False ): # , tempo, insruments, color = 0 ):
+ def __init__( self, beats, color = 0, instruments = False, local = True ): # , tempo, insruments, color = 0 ):
self.beats = beats
self.ticks = beats*Config.TICKS_PER_BEAT
@@ -45,6 +45,8 @@ class Page:
else:
self.instruments = instruments[:]
+ self.local = local # page local/global?
+
self.nextNoteId = 0 # first note will be 1
def genId( self ):
@@ -106,14 +108,12 @@ class NoteDB:
self.clipboard = [] # stores copied cs notes
self.clipboardArea = [] # stores the limits and tracks for each page in the clipboard
- def dumpToStream(self, ostream):
+ def dumpToStream( self, ostream, localOnly = False ):
for pid in self.tune:
- ostream.page_add(pid, self.pages[pid])
- for pid in self.noteD:
- for tid in xrange( len( self.noteD[pid])):
- for nid in self.noteD[pid][tid]:
- ostream.note_add(self.noteD[pid][tid][nid])
- ostream.tune_set(self.tune)
+ if not localOnly or self.pages[pid].local:
+ ostream.page_add(pid, self.pages[pid])
+ for note in self.getNotesByPage( pid ):
+ ostream.note_add( note )
#-- private --------------------------------------------
def _genId( self ):