first attempt at sticking the texture names in the LHS

This commit is contained in:
Jon Dowland 2008-01-29 21:46:17 +00:00
parent 3f2adfa7ed
commit 45bffa36a7
3 changed files with 1885 additions and 3 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.1 on Tue Jan 29 21:29:46 2008 -->
<!--Generated with glade3 3.4.1 on Tue Jan 29 21:45:29 2008 -->
<glade-interface>
<widget class="GtkWindow" id="window1">
<property name="visible">True</property>
@ -163,6 +163,7 @@
<property name="text" translatable="yes"></property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
@ -170,12 +171,23 @@
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class="GtkTreeView" id="texture_list">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="headers_clickable">True</property>
</widget>
</child>
<child>
<widget class="GtkImage" id="orig_texture">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="stock">gtk-missing-image</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkImage" id="wip_texture">
@ -184,7 +196,7 @@
<property name="stock">gtk-missing-image</property>
</widget>
<packing>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -204,7 +216,7 @@
</child>
</widget>
<packing>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
</widget>
@ -220,9 +232,13 @@
<property name="headers_clickable">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>

1828
tools/cleanroom/combined.txt Normal file

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,13 @@ class Patch:
self.yoff = x
self.xoff =y
class Texture:
def __init__(self,name,width,height):
self.name = name
self.width = width
self.height = height
self.patches = []
class HellowWorldGTK:
"""This is an Hello World GTK application"""
@ -18,12 +25,43 @@ class HellowWorldGTK:
* COMP02_2 64 0
* COMP02_3 128 0
* COMP02_7 192 0"""
def parse_texture_file(self,fname):
texture1 = file(fname, "r").read()
self.textures = []
textures = self.textures
current = None
for line in texture1.split("\n"):
if len(line) == 0 or line[0] == ";" or line[0] == "#":
continue
elif line[0] == "*" and current:
current.patches.append(line)
else:
line = line.split()
if len(line) != 3:
print "OH CRAP"
print line
current = Texture(line[0],line[1],line[2])
textures.append(current)
def __init__(self):
self.gladefile = "cleanroom.glade"
self.wTree = gtk.glade.XML(self.gladefile,"window1")
self.image1 = self.wTree.get_widget("orig_texture")
# read in the IWAD texture1 lump and populate our LHS list
self.parse_texture_file("combined.txt")
lhs = self.wTree.get_widget("texture_list")
treestore = gtk.TreeStore(str)
for texture in self.textures:
treestore.append(None, [ texture.name ])
column = gtk.TreeViewColumn('Texture name ')
lhs.set_model(treestore)
lhs.append_column(column)
cell = gtk.CellRendererText()
column.pack_start(cell, False)
column.add_attribute(cell, "text", 0)
# parse the example texture, fetch the width,height;
# create Patch objects and stuff them into a list
patches = []