From 91eabf504db2048ff53c8f2d2dda95298edaad76 Mon Sep 17 00:00:00 2001 From: Jon Dowland Date: Wed, 20 Feb 2008 19:11:46 +0000 Subject: [PATCH] update progress bar on load --- tools/cleanroom/jons_attempt.txt | 12 ++++++++++++ tools/cleanroom/tmp_cleanui.py | 27 +++++++++++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/tools/cleanroom/jons_attempt.txt b/tools/cleanroom/jons_attempt.txt index c6722f5a..018a9a7e 100644 --- a/tools/cleanroom/jons_attempt.txt +++ b/tools/cleanroom/jons_attempt.txt @@ -42,6 +42,9 @@ BRICKLIT 64 128 SW1GRAY1 64 128 SP_DUDE4 64 128 GRAYTALL 128 128 +* WALL00_1 0 0 +* WALL00_1 64 0 +* WALL00_3 80 0 SW1BRN2 64 128 PLANET1 256 128 SW2HOT 64 128 @@ -653,6 +656,10 @@ BROWNHUG 64 128 * WALL04_7 32 64 * WALL04_3 48 64 GSTONE2 256 128 +* WALL59_3 0 0 +* WALL59_2 64 0 +* WALL59_3 128 0 +* WALL59_4 192 0 WOOD7 64 128 SW1STARG 128 128 LITESTON 64 128 @@ -674,6 +681,9 @@ BRWINDOW 64 128 ZELDOOR 128 128 WOODGARG 64 128 GRAYDANG 64 128 +* W33_7 0 0 +* W33_7 0 64 +* PS15A0 14 72 GLASS1B 64 96 SW2CMT 64 128 STARTAN1 64 128 @@ -723,6 +733,8 @@ EXITSIGN 64 16 STEP3 32 16 SP_FACE2 64 128 GRAYPOIS 64 72 +* WALL00_1 0 0 +* PS18A0 1 18 SKY2 256 128 SP_DUDE2 128 128 BIGDOOR5 128 128 diff --git a/tools/cleanroom/tmp_cleanui.py b/tools/cleanroom/tmp_cleanui.py index fa8f90ab..9219ef38 100644 --- a/tools/cleanroom/tmp_cleanui.py +++ b/tools/cleanroom/tmp_cleanui.py @@ -26,6 +26,12 @@ class HellowWorldGTK: current = Texture(line[0],line[1],line[2]) self.wip_textures[line[0]] = Texture(line[0],line[1],line[2]) textures[line[0]] = current + # now weed out the 1-patch ones + keys = self.textures.keys() + for key in keys: + if 1 == len(self.textures[key].patches): + del self.textures[key] + del self.wip_textures[key] def lhs_callback(self, treeview): offs,col = treeview.get_cursor() @@ -198,6 +204,10 @@ class HellowWorldGTK: model.set_value(iter, column, new_text) + def patch_list_reordered(self,treemodel,path,iter,new_order): + print "ZOMG" + + def __init__(self): self.gladefile = "cleanroom.glade" self.wTree = gtk.glade.XML(self.gladefile,"window1") @@ -253,6 +263,8 @@ class HellowWorldGTK: column.add_attribute(cell, "text", 2) patch_list.connect("key-press-event", self.patch_list_key) + patch_list.set_reorderable(True) + treestore.connect("rows-reordered", self.patch_list_reordered) # populate the RHS list with patch names # yes, I learnt perl once. @@ -280,12 +292,7 @@ class HellowWorldGTK: 80)], 0) # 80 = target type text image.connect("drag_data_get", self.rhs_drag_data_get) - # set the progress bar up - # by default we've "done" all the 1-patch textures - bar = self.wTree.get_widget("progressbar1") - done = len(filter(lambda x: len(x.patches) > 1, self.textures.values())) - bar.set_fraction(float(done) / len(self.textures)) - bar.set_text("%d/%d" % (done, len(self.textures))) + self.set_up_progressbar() self.wTree.get_widget("window1").connect("destroy", gtk.main_quit) self.wTree.get_widget("quit_menu_item").connect("activate", gtk.main_quit) @@ -296,6 +303,13 @@ class HellowWorldGTK: # select the top-most texture lhs.set_cursor( (0,) , None, False) + def set_up_progressbar(self): + """We've "done" any textures in wip set with >0 patches""" + bar = self.wTree.get_widget("progressbar1") + done = len(filter(lambda x: len(x.patches) > 0, self.wip_textures.values())) + bar.set_fraction(float(done) / len(self.textures)) + bar.set_text("%d/%d" % (done, len(self.textures))) + def saveas_activated(self, arg): filesel = gtk.FileChooserDialog(action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, @@ -337,6 +351,7 @@ class HellowWorldGTK: line = line.split() current = Texture(line[0],line[1],line[2]) self.wip_textures[line[0]] = current + self.set_up_progressbar() if __name__ == "__main__": hwg = HellowWorldGTK()