Changeset 2213

Show
Ignore:
Timestamp:
02/13/08 01:22:49 (8 months ago)
Author:
arj..@yirdis.nl
Message:

use connection_data in handle tool.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphas/trunk/gaphas/examples.py

    r2153 r2213  
    215215        def handle_disconnect(): 
    216216            try: 
    217                 view.canvas.solver.remove_constraint(handle._connect_constraint
     217                view.canvas.solver.remove_constraint(handle.connection_data
    218218            except KeyError: 
    219219                print 'constraint was already removed for', item, handle 
     
    221221            else: 
    222222                print 'constraint removed for', item, handle 
    223             handle._connect_constraint = None 
     223            handle.connection_data = None 
    224224            handle.connected_to = None 
    225225            # Remove disconnect handler: 
     
    230230        if glue_item and glue_item is handle.connected_to: 
    231231            try: 
    232                 view.canvas.solver.remove_constraint(handle._connect_constraint
     232                view.canvas.solver.remove_constraint(handle.connection_data
    233233            except KeyError: 
    234234                pass # constraint was already removed 
    235235 
    236236            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), 
    238238                                      CanvasProjection(h2.pos, glue_item)), 
    239239                                point=CanvasProjection(handle.pos, item)) 
    240             view.canvas.solver.add_constraint(handle._connect_constraint
     240            view.canvas.solver.add_constraint(handle.connection_data
    241241 
    242242            handle.disconnect = handle_disconnect 
     
    252252 
    253253                # Make a constraint that keeps into account item coordinates. 
    254                 handle._connect_constraint = \ 
     254                handle.connection_data = \ 
    255255                        LineConstraint(line=(CanvasProjection(h1.pos, glue_item), 
    256256                            CanvasProjection(h2.pos, glue_item)), 
    257257                            point=CanvasProjection(handle.pos, item)) 
    258                 view.canvas.solver.add_constraint(handle._connect_constraint
     258                view.canvas.solver.add_constraint(handle.connection_data
    259259 
    260260                handle.connected_to = glue_item 
     
    264264        if handle.connected_to: 
    265265            #print 'Handle.disconnect', view, item, handle 
    266             view.canvas.solver.remove_constraint(handle._connect_constraint
     266            view.canvas.solver.remove_constraint(handle.connection_data
    267267 
    268268