Changeset 2301
- Timestamp:
- 05/18/08 23:32:50 (7 months ago)
- Files:
-
- gaphas/trunk/gaphas/tests/test_line.py (modified) (1 diff)
- gaphas/trunk/gaphas/tool.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphas/trunk/gaphas/tests/test_line.py
r2266 r2301 32 32 33 33 def test_orthogonal_horizontal_undo(self): 34 """ 35 Orthogonal line constraints bug (#107) 36 """ 34 37 canvas = Canvas() 35 38 line = Line() gaphas/trunk/gaphas/tool.py
r2234 r2301 449 449 """ 450 450 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. 452 452 """ 453 453 handle.x = x … … 457 457 def glue(self, view, item, handle, vx, vy): 458 458 """ 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. 460 461 ``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. 461 465 """ 462 466 463 467 def connect(self, view, item, handle, vx, vy): 464 468 """ 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. 466 471 ``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. 467 485 """ 468 486 … … 470 488 """ 471 489 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``. 473 497 """ 474 498
