From 8398a7c2ad0a751a809b66a058bdab37403e8401 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Wed, 21 Jan 2009 02:53:52 +0000 Subject: ... --- diff --git a/Char.py b/Char.py index 6450cd5..f69d54b 100644 --- a/Char.py +++ b/Char.py @@ -24,7 +24,10 @@ class Char: self.dir = dir self.custom = custom - def thumb(self): + def thumb(self, index = None): + return self.pixbuf + + def orig(self, index): return self.pixbuf THEMES = ( diff --git a/Document.py b/Document.py index 4626171..f435dc1 100644 --- a/Document.py +++ b/Document.py @@ -34,6 +34,9 @@ def thumb(index): def clean(index): pass +def stamp(index, pixbuf): + pass + """ import zipfile import StringIO diff --git a/Main.py b/Main.py index 4d86db4..ae7f744 100644 --- a/Main.py +++ b/Main.py @@ -137,22 +137,18 @@ class CartoonBuilder: self.screen.bgpixbuf = choice.orig() self.screen.draw() - def _sound_cb(self, widget, combo): widget.props.value.change() - def _char_cb(self, widget): - return - - if self.imgdirindex == 0: - self.imgdirindex = (len(self.imgdirs)-1) - else: - self.imgdirindex -= 1 + def _char_cb(self, widget, combo): + self.char = widget.props.value + for i in range(len(self.frames)): + self.frames[i].set_from_pixbuf(self.char.thumb(i)) - self.imgstartindex = 0 - self.imgdir = self.imgdirs[self.imgdirindex] - self.loadimages() - self.drawmain() + def _frame_cb(self, widget, event, frame): + Document.stamp(frame, self.char.orig(frame)) + self.tape[self.tape_selected].child.set_from_pixbuf( + self.char.thumb(frame)) def _screen_size_cb(self, widget, aloc): size = min(aloc.width, aloc.height) @@ -325,13 +321,8 @@ class CartoonBuilder: - self.framebuttons = [] - self.frameimgs = [] - self.fgpixbufs = [] - self.fgpixbufpaths = [] self.tape = [] - - + self.frames = [] # frames table @@ -346,13 +337,14 @@ class CartoonBuilder: for y in range(rows): for x in range(Theme.FRAME_COLS): image = gtk.Image() - image.set_from_pixbuf(Document.thumb(0)) image.show() + self.frames.append(image) image_box = gtk.EventBox() image_box.show() image_box.set_events(gtk.gdk.BUTTON_PRESS_MASK) - #image_box.connect('button_press_event', self._tape_cb, i) + image_box.connect('button_press_event', self._frame_cb, + y * Theme.FRAME_COLS + x) image_box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BLACK)) image_box.modify_bg(gtk.STATE_PRELIGHT, gtk.gdk.color_parse(BLACK)) image_box.props.border_width = 2 diff --git a/Tape.py b/Tape.py deleted file mode 100644 index bc97838..0000000 --- a/Tape.py +++ /dev/null @@ -1,15 +0,0 @@ -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -COUNT = 3 -- cgit v0.9.1