Ignore:
Timestamp:
03/25/13 14:39:50 (13 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixes to canvas package documentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/canvas/items/linkitem.py

    r11369 r11442  
    11""" 
     2========= 
    23Link Item 
     4========= 
    35 
    46""" 
     
    1618 
    1719class LinkCurveItem(QGraphicsPathItem): 
    18     """Link curve item. The main component of `LinkItem`. 
     20    """ 
     21    Link curve item. The main component of a :class:`LinkItem`. 
    1922    """ 
    2023    def __init__(self, parent): 
    2124        QGraphicsPathItem.__init__(self, parent) 
    22         assert(isinstance(parent, LinkItem)) 
     25        if not isinstance(parent, LinkItem): 
     26            raise TypeError("'LinkItem' expected") 
     27 
    2328        self.setAcceptedMouseButtons(Qt.NoButton) 
    2429        self.__canvasLink = parent 
     
    3944 
    4045    def linkItem(self): 
    41         """Return the :class:`LinkItem` instance this curve belongs to. 
    42  
     46        """ 
     47        Return the :class:`LinkItem` instance this curve belongs to. 
    4348        """ 
    4449        return self.__canvasLink 
     
    8388 
    8489class LinkAnchorIndicator(QGraphicsEllipseItem): 
    85     """A visual indicator of the link anchor point at both ends 
    86     of the `LinkItem`. 
     90    """ 
     91    A visual indicator of the link anchor point at both ends 
     92    of the :class:`LinkItem`. 
    8793 
    8894    """ 
     
    108114class LinkItem(QGraphicsObject): 
    109115    """ 
    110     A Link in the canvas. 
    111     """ 
    112  
     116    A Link item in the canvas that connects two :class:`.NodeItem`\s in the 
     117    canvas. 
     118 
     119    The link curve connects two `Anchor` items (see :func:`setSourceItem` 
     120    and :func:`setSinkItem`). Once the anchors are set the curve 
     121    automatically adjusts its end points whenever the anchors move. 
     122 
     123    An optional source/sink text item can be displayed above the curve's 
     124    central point (:func:`setSourceName`, :func:`setSinkName`) 
     125 
     126    """ 
     127 
     128    #: Z value of the item 
    113129    Z_VALUE = 0 
    114     """Z value of the item""" 
    115130 
    116131    def __init__(self, *args): 
     
    146161    def setSourceItem(self, item, anchor=None): 
    147162        """ 
    148         Set the source `item` (:class:`NodeItem`). Use `anchor` 
    149         (:class:`AnchorPoint`) as the curve start point (if ``None`` a new 
    150         output anchor will be created). 
     163        Set the source `item` (:class:`.NodeItem`). Use `anchor` 
     164        (:class:`.AnchorPoint`) as the curve start point (if ``None`` a new 
     165        output anchor will be created using ``item.newOutputAnchor()``). 
    151166 
    152167        Setting item to ``None`` and a valid anchor is a valid operation 
     
    196211    def setSinkItem(self, item, anchor=None): 
    197212        """ 
    198         Set the sink `item` (:class:`NodeItem`). Use `anchor` 
    199         (:class:`AnchorPoint`) as the curve end point (if ``None`` a new 
    200         input anchor will be created). 
     213        Set the sink `item` (:class:`.NodeItem`). Use `anchor` 
     214        (:class:`.AnchorPoint`) as the curve end point (if ``None`` a new 
     215        input anchor will be created using ``item.newInputAnchor()``). 
    201216 
    202217        Setting item to ``None`` and a valid anchor is a valid operation 
     
    246261    def setFont(self, font): 
    247262        """ 
    248         Set the font for the channel names text. 
     263        Set the font for the channel names text item. 
    249264        """ 
    250265        if font != self.font(): 
     
    398413    def setEnabled(self, enabled): 
    399414        """ 
     415        Reimplemented from :class:`QGraphicsObject` 
     416 
    400417        Set link enabled state. When disabled the link is rendered with a 
    401418        dashed line. 
     
    425442    def setDynamic(self, dynamic): 
    426443        """ 
    427         Mark the link as dynamic (e.i. it responds to the 
    428         ``setDynamicEnabled``). 
     444        Mark the link as dynamic (i.e. it responds to 
     445        :func:`setDynamicEnabled`). 
    429446 
    430447        """ 
Note: See TracChangeset for help on using the changeset viewer.