comparison tools/rect_drawer.py @ 312:a0d66c0f5a89

Add toggle thing rects option
author Neil Muller <neil@dip.sun.ac.za>
date Sat, 28 Aug 2010 08:57:11 +0200
parents 776bcf563ea0
children c295b06b27f8
comparison
equal deleted inserted replaced
311:00eb7ea2b7ea 312:a0d66c0f5a89
89 self.offset = (0, 0) 89 self.offset = (0, 0)
90 else: 90 else:
91 self.offset = (-self.state.current_scene.OFFSET[0], - self.state.current_scene.OFFSET[1]) 91 self.offset = (-self.state.current_scene.OFFSET[0], - self.state.current_scene.OFFSET[1])
92 self.draw_rects = True 92 self.draw_rects = True
93 self.draw_things = True 93 self.draw_things = True
94 self.draw_thing_rects = True
94 self.draw_images = True 95 self.draw_images = True
95 self.draw_toolbar = True 96 self.draw_toolbar = True
96 97
97 def toggle_things(self): 98 def toggle_things(self):
98 self.draw_things = not self.draw_things 99 self.draw_things = not self.draw_things
100
101 def toggle_thing_rects(self):
102 self.draw_thing_rects = not self.draw_thing_rects
103 if self.state.current_detail:
104 scene = self.state.current_detail
105 else:
106 scene = self.state.current_scene
107 for thing in scene.things.itervalues():
108 if not self.draw_thing_rects:
109 if not hasattr(thing, 'old_colour'):
110 thing.old_colour = thing._interact_hilight_color
111 thing._interact_hilight_color = None
112 else:
113 thing._interact_hilight_color = thing.old_colour
99 114
100 def toggle_images(self): 115 def toggle_images(self):
101 self.draw_images = not self.draw_images 116 self.draw_images = not self.draw_images
102 117
103 def toggle_rects(self): 118 def toggle_rects(self):
301 app.add(palette) 316 app.add(palette)
302 print_rects = make_button("Print objects", image.print_objs, 300) 317 print_rects = make_button("Print objects", image.print_objs, 300)
303 app.add(print_rects) 318 app.add(print_rects)
304 toggle_things = make_button("Toggle Things", image.toggle_things, 335) 319 toggle_things = make_button("Toggle Things", image.toggle_things, 335)
305 app.add(toggle_things) 320 app.add(toggle_things)
306 toggle_images = make_button("Toggle Images", image.toggle_images, 370) 321 toggle_thing_rects = make_button("Toggle Thing Rects", image.toggle_thing_rects, 370)
322 app.add(toggle_thing_rects)
323 toggle_images = make_button("Toggle Images", image.toggle_images, 405)
307 app.add(toggle_images) 324 app.add(toggle_images)
308 toggle_rects = make_button("Toggle Rects", image.toggle_rects, 405) 325 toggle_rects = make_button("Toggle Rects", image.toggle_rects, 440)
309 app.add(toggle_rects) 326 app.add(toggle_rects)
310 toggle_toolbar = make_button("Toggle Toolbar", image.toggle_toolbar, 440) 327 toggle_toolbar = make_button("Toggle Toolbar", image.toggle_toolbar, 475)
311 app.add(toggle_toolbar) 328 app.add(toggle_toolbar)
312 quit_but = make_button("Quit", app.quit, 565) 329 quit_but = make_button("Quit", app.quit, 565)
313 app.add(quit_but) 330 app.add(quit_but)
314 app.run() 331 app.run()