From 33f709d8e6fe9b72a0cdb51870e7101b6192b19e Mon Sep 17 00:00:00 2001 From: Jon Dowland Date: Tue, 29 Jan 2008 18:37:28 +0000 Subject: [PATCH] read in pixbufs for each patch constituent (this code is still EEEEVIL) --- tools/cleanroom/tmp_cleanui.py | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/tools/cleanroom/tmp_cleanui.py b/tools/cleanroom/tmp_cleanui.py index 0a9cb92d..d8e1578f 100644 --- a/tools/cleanroom/tmp_cleanui.py +++ b/tools/cleanroom/tmp_cleanui.py @@ -4,22 +4,41 @@ import sys import gtk import gtk.glade +class Patch: + def __init__(self, n,w,h): + self.name = n + self.width = w + self.height =h + class HellowWorldGTK: """This is an Hello World GTK application""" - example_texture = """ -COMPUTE2 256 56 + example_texture = """COMPUTE2 256 56 * COMP02_1 0 0 * COMP02_2 64 0 * COMP02_3 128 0 -* COMP02_7 192 0 - """ +* COMP02_7 192 0""" def __init__(self): self.gladefile = "cleanroom.glade" self.wTree = gtk.glade.XML(self.gladefile,"window1") - self.image1 = self.wTree.get_widget("orig_texture") + + # parse the example texture + patches = [] + width,height = 0,0 + for line in self.example_texture.split("\n"): + if len(line) > 0: + if line[0] != '*': + name,width,height = line.split() + else: + junk,name,width,height = line.split() + patches.append(Patch(name,width,height)) + + for patch in patches: + self.image1.set_from_file(patch.name.lower() + ".gif") + patch.pixbuf = self.image1.get_pixbuf() + self.image1.set_from_file("comp02_1.gif") pixbuf = self.image1.get_pixbuf() if pixbuf: