This is a patch file for "ghost-diagrams". It makes the following changes: a. Zoom in slightly (change scale from 10.0 to 11.0) b. Add a "Quit" button c. Use "random" mode by default d. Make compatible with newer Pythons --- ghost-diagrams.py.old +++ ghost-diagrams.py @@ -606,7 +606,7 @@ scale.set_digits(1) scale.set_increments(1.0,1.0) scale.set_range(3.0, 50.0) - scale.set_value(10.0) + scale.set_value(11.0) scale.connect('value-changed', self.on_set_scale) random_button = gtk.Button(' Random ') @@ -618,9 +618,13 @@ save = gtk.Button(' Save image... ') save.connect('clicked', self.on_save) + quitButton = gtk.Button(' Quit ') + quitButton.connect('clicked', gtk.main_quit) + hbox = gtk.HBox(False,5) hbox.set_border_width(3) hbox.pack_start(knot_box, False, False, 0) + hbox.pack_end(quitButton, False,False,0) hbox.pack_end(save, False,False,0) hbox.pack_end(reset, False,False,0) hbox.pack_end(random_button, False,False,0) @@ -725,6 +729,7 @@ def run(self): self.window.show_all() + self.random() gtk.main() @@ -1044,15 +1044,17 @@ random.shuffle(item) item = normalize(string.join(item,'')) - if item in result: raise "repeat" + if item in result: + raise Exception ("repeat") result.append(item) all = string.join(result,'') for a, b in compatabilities.items(): - if a in all and b not in all: raise "repeat" + if a in all and b not in all: + raise Exception ("repeat") break - except "repeat": + except: pass self.combo.entry.set_text(repr(result)[1:-1])