read in pixbufs for each patch constituent (this code is still EEEEVIL)

This commit is contained in:
Jon Dowland 2008-01-29 18:37:28 +00:00
parent 0d21c1a3b6
commit 33f709d8e6

View file

@ -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: