From d9c019c42bf72e722756f89b5dfc6a9e2a1fe3b0 Mon Sep 17 00:00:00 2001 From: amartin Date: Sat, 18 Aug 2007 03:17:21 +0000 Subject: generation preview --- (limited to 'Jam/Picker.py') diff --git a/Jam/Picker.py b/Jam/Picker.py index 975919c..eb3103b 100644 --- a/Jam/Picker.py +++ b/Jam/Picker.py @@ -4,9 +4,12 @@ pygtk.require( '2.0' ) import gtk import random #TEMP +import sets import Config +import Util.ControlStream + import Jam.Block as Block class Picker( gtk.HBox ): @@ -142,6 +145,33 @@ class Loop( Picker ): self.addBlock( {}, "Loop" ) + def _loadFile( self, path ): + try: + oldPages = sets.Set( self.owner.noteDB.getTune() ) + + ifile = open( path, 'r' ) + ttt = ControlStream.TamTamTable ( self.owner.noteDB ) + ttt.parseFile( ifile ) + ifile.close() + + curPages = sets.Set( self.owner.noteDB.getTune() ) + newPages = curPages.difference( oldPages ) + + if len(newPages) != 1: + print "ERROR: bad loop file, contains more than one page (or none)" + return -1 + + return newPages.pop() # new pageId + + except OSError,e: + print 'ERROR: failed to open file %s for reading\n' % ofilename + + + + + def _scanDirectory( self, path ): + pass + def button_press( self, widget, event ): walloc = widget.get_allocation() salloc = self.scrolledWindow.get_allocation() -- cgit v0.9.1