Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Document.py
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-01-30 23:32:43 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-01-30 23:32:43 (GMT)
commitf3f438af59c69b584d84b27f103f9392fc8185f8 (patch)
tree808556779f0d70312625b6d50277371bbf19b880 /Document.py
parent56cea3b5c6361c7958e1c27182fcf117470a1861 (diff)
...
Diffstat (limited to 'Document.py')
-rw-r--r--Document.py65
1 files changed, 61 insertions, 4 deletions
diff --git a/Document.py b/Document.py
index 51320e6..c1714b9 100644
--- a/Document.py
+++ b/Document.py
@@ -17,26 +17,83 @@ import gtk
import Theme
def load(filepath):
+ """
+ def loadfromzip(self, f):
+
+ zf = zipfile.ZipFile(filepath)
+ fnames = zf.namelist()
+ framenames = []
+ for fname in fnames:
+ if fname[-8:] == 'back.png':
+ backname = fname
+ else:
+ framenames.append(fname)
+ framenames.sort()
+ # set the background
+ tmpbgpath = os.path.join(TMPDIR,'back.png')
+ f = file(tmpbgpath,'w')
+
+
+ f.write(zf.read(backname))
+
+
+ f.close()
+ self.setback(tmpbgpath)
+ os.remove(tmpbgpath)
+ self.imgdir = TMPDIR
+ for filepath in framenames:
+ fname = os.path.split(filepath)[1]
+ tmpfilepath = os.path.join(TMPDIR,fname)
+ f = file(tmpfilepath,'w')
+ f.write(zf.read(filepath))
+ f.close()
+ zf.close()
+ self.loadimages()
+ # setup the filmstrip frames
+ pics = self.getpics(self.imgdir)
+ count = 0
+ for imgpath in pics:
+ pixbuf = gtk.gdk.pixbuf_new_from_file(imgpath)
+ fgpixbuf = pixbuf.scale_simple(BGWIDTH,BGHEIGHT,gtk.gdk.INTERP_BILINEAR)
+ self.fgpixbufs[count] = fgpixbuf
+ if count == 0:
+ self.fgpixbuf = fgpixbuf
+ self.drawmain()
+ scaled_buf = pixbuf.scale_simple(IMGWIDTH,IMGHEIGHT,gtk.gdk.INTERP_BILINEAR)
+ self.frameimgs[count].set_from_pixbuf(scaled_buf)
+ count += 1
+ entries = os.listdir(TMPDIR)
+ for entry in entries:
+ entrypath = os.path.join(TMPDIR,entry)
+ os.remove(entrypath)
+ """
pass
def save(filepath):
pass
-def orig(index):
+def tape_orig(index):
return gtk.gdk.pixbuf_new_from_file(
Theme.path('images/pics/Elephant/bigelephant0.gif'))
-def thumb(index):
+def tape_thumb(index):
return gtk.gdk.pixbuf_new_from_file_at_size(
Theme.path('images/pics/Elephant/bigelephant0.gif'),
Theme.THUMB_SIZE, Theme.THUMB_SIZE)
-def clean(index):
+def tape_clean(index):
pass
-def stamp(index, pixbuf):
+def tape_stamp(index, pixbuf):
pass
+def ground():
+ return ('foo', gtk.gdk.pixbuf_new_from_file(
+ Theme.path('images/pics/Elephant/bigelephant1.gif')))
+
+def sound():
+ return ('foo', 'sounds/jungle.wav')
+
"""
import zipfile
import StringIO