From 14e44399a9ed97cbf2d7d42ad2ea352535b1d097 Mon Sep 17 00:00:00 2001 From: Jon Dowland Date: Thu, 24 Jan 2008 23:18:17 +0000 Subject: [PATCH] initial import of cleanroom tool --- tools/cleanroom/cleanroom.glade | 67 ++++++++++++++++++++++++++++++++ tools/cleanroom/cleanroom.py | 57 +++++++++++++++++++++++++++ tools/cleanroom/sw2_1.gif | Bin 0 -> 892 bytes tools/cleanroom/tmp_cleanui.py | 20 ++++++++++ 4 files changed, 144 insertions(+) create mode 100644 tools/cleanroom/cleanroom.glade create mode 100644 tools/cleanroom/cleanroom.py create mode 100644 tools/cleanroom/sw2_1.gif create mode 100644 tools/cleanroom/tmp_cleanui.py diff --git a/tools/cleanroom/cleanroom.glade b/tools/cleanroom/cleanroom.glade new file mode 100644 index 00000000..89f101e2 --- /dev/null +++ b/tools/cleanroom/cleanroom.glade @@ -0,0 +1,67 @@ + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-missing-image + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-missing-image + + + 1 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + + + + + 2 + + + + + 1 + + + + + + + + + diff --git a/tools/cleanroom/cleanroom.py b/tools/cleanroom/cleanroom.py new file mode 100644 index 00000000..ce765cb6 --- /dev/null +++ b/tools/cleanroom/cleanroom.py @@ -0,0 +1,57 @@ +#!/usr/bin/python + +# cleanroom.py: a clean-room IWAD texture1 lump constructor + +from sys import argv, exit +from os import rmdir, mkdir, system, chdir, getcwd +from tempfile import mkdtemp + +if len(argv) != 2: + print "usage: cleanroom.py IWAD" + exit(1) + +if system("which deutex >/dev/null"): + print "you need to install deutex in the PATH" + exit(1) + +iwad = argv[1] +origdir = getcwd() + +if iwad[0] != "/": + iwad = origdir + "/" + iwad + +tmpdir = mkdtemp() +chdir(tmpdir) + +system("deutex -textures -extract " +iwad + " >/dev/null 2>&1") +system("deutex -patches -extract " +iwad + " >/dev/null 2>&1") + +# parse the textures data + +texture1 = file(tmpdir + "/textures/texture1.txt", "r").read() + +class Texture: + def __init__(self,name,width,height): + self.name = name + self.width = width + self.height = height + self.patches = [] + +textures = [] +current = None +for line in texture1.split("\n"): + if len(line) == 0 or line[0] == ";": + continue + elif line[0] == "*" and current: + current.patches.append(line) + else: + line = line.split() + current = Texture(line[0],line[1],line[2]) + textures.append(current) + +# we are not interested in 1-patch textures +textures = filter(lambda x: len(x.patches) > 1, textures) +print len(textures) + +chdir(origdir) +rmdir(tmpdir) diff --git a/tools/cleanroom/sw2_1.gif b/tools/cleanroom/sw2_1.gif new file mode 100644 index 0000000000000000000000000000000000000000..53182d40932ae1f5d0a3383a37ab9348a69dd589 GIT binary patch literal 892 zcmZ?wbh9u|6l0KLIL5%h@c(~7UTjE!M}UumjfIYrqeX95S#x7vLqkqYO-@HkNl8gc zPEJfrjE{$ljfI7Yfq{mDy}7-eX-`MVgb6h>rqnE1(6MArM@vINK~79cN{EVvf{cuW zw6x@$84YXJOjxm`XU&QU6M8B%G!ztMBt%36x;l!tteLW7%ZvkimTXutWzC8yQzkS- zgm^gEm`KQoY}qhp!HgCk9|xf76-zoofZ`4&Dk?IPlHz$eu_unKxo~DnO+}81ib7pg zrjCZf7LYkBIyy=kYI0UAnUIqaQB{_jogV4pU}9ro5*OnyARxfQ!^6SBA|k*eA|e9x zv4n_#jD$o$fQyTZg^!1gmX=~eZFXvMSWZ^7goH?HYDi;kc0)tSf4Tr2po17dalyd; zuYsYdxrvd9nT3V5rKg#Vor9B$n}?T|k6%DgsFy)lL{v;nTvS4mM{0(&jBF2^n4G+V zqL`=>x1`i`WffJ`W;F$M4NWa=1sypFZeCp`z18~qO>&AyGz}CL6bvU%HDVDkmbuIz zXL9|zf~d}EDO0mY<|-DJ;s%;Ot*oup4RwSo78E%?IMyqtQWNoGfvNkVzoP@!Q)Aj7}VFirgkgq%S5P;boC)c*5P3G@nmN*d^dXz!65qX*#_f z4vmkFm?b&rX&eYx!f4DP5cSRCQ=+|4Dkz{FvX z@kc1-MVJAFcda*x;<*RFLS%wZY_p6SI*{n}VWv3j+&>Fpoh4bCIuw hhX8NE)PoGXbIKRAGw3{E;4$3s!9iR=L4t$98UW1^Z+HLz literal 0 HcmV?d00001 diff --git a/tools/cleanroom/tmp_cleanui.py b/tools/cleanroom/tmp_cleanui.py new file mode 100644 index 00000000..880328c0 --- /dev/null +++ b/tools/cleanroom/tmp_cleanui.py @@ -0,0 +1,20 @@ +#!/usr/bin/python + +import sys +import gtk +import gtk.glade + +class HellowWorldGTK: + """This is an Hello World GTK application""" + def __init__(self): + self.gladefile = "cleanroom.glade" + self.wTree = gtk.glade.XML(self.gladefile,"window1") + + self.image1 = self.wTree.get_widget("orig_texture") + self.image1.set_from_file("sw2_1.gif") + + self.wTree.get_widget("window1").connect("destroy", gtk.main_quit) + +if __name__ == "__main__": + hwg = HellowWorldGTK() + gtk.main()