comparison pyntnclick/tools/rect_drawer.py @ 780:0548894408a8 pyntnclick

'Fix' rect_drawer
author Neil Muller <neil@dip.sun.ac.za>
date Sat, 26 Jan 2013 18:49:07 +0200
parents 763ff5a9ee42
children 6b89fa491b70
comparison
equal deleted inserted replaced
779:087d3ff0aa08 780:0548894408a8
156 """Parse the things in the scene for overlaps""" 156 """Parse the things in the scene for overlaps"""
157 scene = self._scene 157 scene = self._scene
158 # Pylint hates this function 158 # Pylint hates this function
159 for thing in scene.things.itervalues(): 159 for thing in scene.things.itervalues():
160 for interact_name in thing.interacts: 160 for interact_name in thing.interacts:
161 thing.set_interact(interact_name) 161 thing._set_interact(interact_name)
162 if hasattr(thing.rect, 'collidepoint'): 162 if hasattr(thing.rect, 'collidepoint'):
163 thing_rects = [thing.rect] 163 thing_rects = [thing.rect]
164 else: 164 else:
165 thing_rects = thing.rect 165 thing_rects = thing.rect
166 for thing2 in scene.things.itervalues(): 166 for thing2 in scene.things.itervalues():
167 if thing is thing2: 167 if thing is thing2:
168 continue 168 continue
169 for interact2_name in thing2.interacts: 169 for interact2_name in thing2.interacts:
170 thing2.set_interact(interact2_name) 170 thing2._set_interact(interact2_name)
171 if hasattr(thing2.rect, 'collidepoint'): 171 if hasattr(thing2.rect, 'collidepoint'):
172 thing2_rects = [thing2.rect] 172 thing2_rects = [thing2.rect]
173 else: 173 else:
174 thing2_rects = thing2.rect 174 thing2_rects = thing2.rect
175 for my_rect in thing_rects: 175 for my_rect in thing_rects:
189 scene = self._scene 189 scene = self._scene
190 for (num, col) in enumerate(d): 190 for (num, col) in enumerate(d):
191 rect_list = d[col] 191 rect_list = d[col]
192 for thing in scene.things.itervalues(): 192 for thing in scene.things.itervalues():
193 for interact_name in thing.interacts: 193 for interact_name in thing.interacts:
194 thing.set_interact(interact_name) 194 thing._set_interact(interact_name)
195 if hasattr(thing.rect, 'collidepoint'): 195 if hasattr(thing.rect, 'collidepoint'):
196 thing_rects = [thing.rect] 196 thing_rects = [thing.rect]
197 else: 197 else:
198 thing_rects = thing.rect 198 thing_rects = thing.rect
199 for other_rect in thing_rects: 199 for other_rect in thing_rects:
203 print " Object %s" % num 203 print " Object %s" % num
204 print (" Thing %s Interact %s" 204 print (" Thing %s Interact %s"
205 % (thing.name, interact_name)) 205 % (thing.name, interact_name))
206 print " Rects", my_rect, other_rect 206 print " Rects", my_rect, other_rect
207 if thing.INITIAL: 207 if thing.INITIAL:
208 thing.set_interact(thing.INITIAL) 208 thing._set_interact(thing.INITIAL)
209 print 209 print
210 for (num2, col2) in enumerate(d): 210 for (num2, col2) in enumerate(d):
211 if num2 == num: 211 if num2 == num:
212 continue 212 continue
213 other_list = d[col2] 213 other_list = d[col2]
494 if j + 1 < len(cand.interacts): 494 if j + 1 < len(cand.interacts):
495 next_name = cand.interacts.keys()[j + 1] 495 next_name = cand.interacts.keys()[j + 1]
496 else: 496 else:
497 next_name = cand.interacts.keys()[0] 497 next_name = cand.interacts.keys()[0]
498 if cand.interacts[next_name] != cur_interact: 498 if cand.interacts[next_name] != cur_interact:
499 cand.set_interact(next_name) 499 cand._set_interact(next_name)
500 elif self.mode == 'draw': 500 elif self.mode == 'draw':
501 self.start_pos = pos 501 self.start_pos = pos
502 self.end_pos = pos 502 self.end_pos = pos
503 elif self.mode == 'image': 503 elif self.mode == 'image':
504 if self.current_image: 504 if self.current_image: