Changeset 2301

Show
Ignore:
Timestamp:
05/18/08 23:32:50 (7 months ago)
Author:
arj..@yirdis.nl
Message:

updated docstrings on HandleTool? connection hooks.

Files:

Legend:

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

    r2266 r2301  
    3232 
    3333    def test_orthogonal_horizontal_undo(self): 
     34        """ 
     35        Orthogonal line constraints bug (#107) 
     36        """ 
    3437        canvas = Canvas() 
    3538        line = Line() 
  • gaphas/trunk/gaphas/tool.py

    r2234 r2301  
    449449        """ 
    450450        Move the handle to position ``(x,y)``. ``x`` and ``y`` are in 
    451         item coordnates. 
     451        item coordnates. ``item`` is the item whose ``handle`` is moved. 
    452452        """ 
    453453        handle.x = x 
     
    457457    def glue(self, view, item, handle, vx, vy): 
    458458        """ 
    459         Find an item near ``handle` that ``item`` can connect to. 
     459        Find an item that ``handle`` can connect to. ``item`` is the ``Item`` 
     460        owing the handle. 
    460461        ``vx`` and ``vy`` are the pointer (view) coordinates. 
     462 
     463        The ``glue()`` code should take care of moving ``handle`` to the 
     464        correct position, creating a glue effect. 
    461465        """ 
    462466 
    463467    def connect(self, view, item, handle, vx, vy): 
    464468        """ 
    465         Find an item near ``handle`` that ``item`` can connect to and connect. 
     469        Find an item that ``handle`` can connect to and create a connection. 
     470        ``item`` is the ``Item`` owning the handle. 
    466471        ``vx`` and ``vy`` are the pointer (view) coordinates. 
     472         
     473        A typical connect action may involve the following: 
     474         
     475        - Find an item near ``handle`` that can be connected to. 
     476        - Move ``handle`` to the right position. 
     477        - Set ``handle.connected_to`` to point to the new item. 
     478        - Add constraints to the constraint solver (``view.canvas.solver``). 
     479        - Set ``handle.disconnect`` to point to a method that can be called when 
     480          the handle is disconnected (no arguments). 
     481         
     482        NOTE: ``connect()`` can not expect ``glue()`` has been called, 
     483        therefore it should ensure the handle is moved to the correct location 
     484        before. 
    467485        """ 
    468486 
     
    470488        """ 
    471489        Disconnect the handle. This mostly comes down to removing  
    472         constraints. 
     490        constraints. ``item`` is the Item owning the handle. 
     491 
     492        A typical disconnect operation may look like this: 
     493         
     494        - Call ``handle.disconnect()`` (assigned in ``connect()``). 
     495        - Disconnect existing constraints. 
     496        - Set ``handle.connected_to`` to ``None``. 
    473497        """ 
    474498