mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-03 19:25:45 -04:00
read in pixbufs for each patch constituent (this code is still EEEEVIL)
This commit is contained in:
parent
0d21c1a3b6
commit
33f709d8e6
1 changed files with 24 additions and 5 deletions
|
@ -4,22 +4,41 @@ import sys
|
||||||
import gtk
|
import gtk
|
||||||
import gtk.glade
|
import gtk.glade
|
||||||
|
|
||||||
|
class Patch:
|
||||||
|
def __init__(self, n,w,h):
|
||||||
|
self.name = n
|
||||||
|
self.width = w
|
||||||
|
self.height =h
|
||||||
|
|
||||||
class HellowWorldGTK:
|
class HellowWorldGTK:
|
||||||
"""This is an Hello World GTK application"""
|
"""This is an Hello World GTK application"""
|
||||||
|
|
||||||
example_texture = """
|
example_texture = """COMPUTE2 256 56
|
||||||
COMPUTE2 256 56
|
|
||||||
* COMP02_1 0 0
|
* COMP02_1 0 0
|
||||||
* COMP02_2 64 0
|
* COMP02_2 64 0
|
||||||
* COMP02_3 128 0
|
* COMP02_3 128 0
|
||||||
* COMP02_7 192 0
|
* COMP02_7 192 0"""
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.gladefile = "cleanroom.glade"
|
self.gladefile = "cleanroom.glade"
|
||||||
self.wTree = gtk.glade.XML(self.gladefile,"window1")
|
self.wTree = gtk.glade.XML(self.gladefile,"window1")
|
||||||
|
|
||||||
self.image1 = self.wTree.get_widget("orig_texture")
|
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")
|
self.image1.set_from_file("comp02_1.gif")
|
||||||
pixbuf = self.image1.get_pixbuf()
|
pixbuf = self.image1.get_pixbuf()
|
||||||
if pixbuf:
|
if pixbuf:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue