Changeset 2213
- Timestamp:
- 02/13/08 01:22:49 (8 months ago)
- Files:
-
- gaphas/trunk/gaphas/examples.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphas/trunk/gaphas/examples.py
r2153 r2213 215 215 def handle_disconnect(): 216 216 try: 217 view.canvas.solver.remove_constraint(handle. _connect_constraint)217 view.canvas.solver.remove_constraint(handle.connection_data) 218 218 except KeyError: 219 219 print 'constraint was already removed for', item, handle … … 221 221 else: 222 222 print 'constraint removed for', item, handle 223 handle. _connect_constraint= None223 handle.connection_data = None 224 224 handle.connected_to = None 225 225 # Remove disconnect handler: … … 230 230 if glue_item and glue_item is handle.connected_to: 231 231 try: 232 view.canvas.solver.remove_constraint(handle. _connect_constraint)232 view.canvas.solver.remove_constraint(handle.connection_data) 233 233 except KeyError: 234 234 pass # constraint was already removed 235 235 236 236 h1, h2 = side(handle, glue_item) 237 handle. _connect_constraint= LineConstraint(line=(CanvasProjection(h1.pos, glue_item),237 handle.connection_data = LineConstraint(line=(CanvasProjection(h1.pos, glue_item), 238 238 CanvasProjection(h2.pos, glue_item)), 239 239 point=CanvasProjection(handle.pos, item)) 240 view.canvas.solver.add_constraint(handle. _connect_constraint)240 view.canvas.solver.add_constraint(handle.connection_data) 241 241 242 242 handle.disconnect = handle_disconnect … … 252 252 253 253 # Make a constraint that keeps into account item coordinates. 254 handle. _connect_constraint= \254 handle.connection_data = \ 255 255 LineConstraint(line=(CanvasProjection(h1.pos, glue_item), 256 256 CanvasProjection(h2.pos, glue_item)), 257 257 point=CanvasProjection(handle.pos, item)) 258 view.canvas.solver.add_constraint(handle. _connect_constraint)258 view.canvas.solver.add_constraint(handle.connection_data) 259 259 260 260 handle.connected_to = glue_item … … 264 264 if handle.connected_to: 265 265 #print 'Handle.disconnect', view, item, handle 266 view.canvas.solver.remove_constraint(handle. _connect_constraint)266 view.canvas.solver.remove_constraint(handle.connection_data) 267 267 268 268
