Changeset 1249

Show
Ignore:
Timestamp:
04/24/07 23:21:21 (2 years ago)
Author:
arj..@yirdis.nl
Message:

Fixed docstring notation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphas/trunk/ChangeLog

    r1161 r1249  
     1 
     2[ for log entries, see svn log ] 
     3 
    142007-03-16  Arjan Molenaar  <arjan_at_yirdis_dot_nl> 
    25 
  • gaphas/trunk/gaphas/constraint.py

    r1133 r1249  
    2727 
    2828class Constraint(object): 
    29     """Constraint base class. 
     29    """ 
     30    Constraint base class. 
    3031    """ 
    3132    disabled = False 
    3233 
    3334    def variables(self): 
    34         """return an iterator which iterates over the variables that are 
     35        """ 
     36        Return an iterator which iterates over the variables that are 
    3537        held by this constraint. 
    3638        """ 
     
    3840 
    3941    def solve_for(self, var): 
    40         """Solve the constraint for a given variable. 
     42        """ 
     43        Solve the constraint for a given variable. 
    4144        The variable itself is updated. 
    4245        """ 
     
    4548 
    4649class EqualsConstraint(Constraint): 
    47     """Simple Constraint, takes two arguments: 'a' and 'b'. When solved the 
     50    """ 
     51    Simple Constraint, takes two arguments: 'a' and 'b'. When solved the 
    4852    attribute passed to solve_for() is set equal to the other. 
    4953 
     
    7882 
    7983class LessThanConstraint(Constraint): 
    80     """Ensure @smaller is less than @bigger. The variable that is passed 
     84    """ 
     85    Ensure @smaller is less than @bigger. The variable that is passed 
    8186    as to-be-solved is left alone (cause it is the variable that has not 
    8287    been moved lately). Instead the other variable is solved. 
     
    115120 
    116121class EquationConstraint(Constraint): 
    117     """Equation solver using attributes and introspection. 
     122    """ 
     123    Equation solver using attributes and introspection. 
    118124 
    119125    Takes a function, named arg value (opt.) and returns a Constraint object 
     
    152158 
    153159    def __getattr__(self, name): 
    154         """used to extract function argument values 
     160        """ 
     161        Used to extract function argument values. 
    155162        """ 
    156163        self._args[name] 
     
    158165 
    159166    def __setattr__(self, name, value): 
    160         """sets function argument values""" 
     167        """ 
     168        Sets function argument values. 
     169        """ 
    161170        # Note - once self._args is created, no new attributes can 
    162171        # be added to self.__dict__.  This is a good thing as it throws 
     
    172181 
    173182    def _set(self, **args): 
    174         """sets values of function arguments 
     183        """ 
     184        Sets values of function arguments. 
    175185        """ 
    176186        for arg in args: 
     
    182192 
    183193    def solve_for(self, var): 
    184         """Solve this constraint for the variable named 'arg' in the 
     194        """ 
     195        Solve this constraint for the variable named 'arg' in the 
    185196        constraint. 
    186197        """ 
     
    192203 
    193204    def _solve_for(self, arg, args): 
    194         """Newton's method solver""" 
     205        """ 
     206        Newton's method solver 
     207        """ 
    195208        #args = self._args 
    196209        close_runs = 10   # after getting close, do more passes 
     
    240253 
    241254class LineConstraint(Constraint): 
    242     """Ensure a point is kept on a line, taking into account item 
     255    """ 
     256    Ensure a point is kept on a line, taking into account item 
    243257    specific coordinates. 
    244258 
     
    316330 
    317331    def _solve(self): 
    318         """Solve the equation for the connected_handle. 
     332        """ 
     333        Solve the equation for the connected_handle. 
    319334        >>> from item import Handle, Item 
    320335        >>> from canvas import Canvas 
  • gaphas/trunk/gaphas/decorators.py

    r1133 r1249  
    1616 
    1717class async(object): 
    18     """Instead of calling the function, schedule an idle handler at a given 
     18    """ 
     19    Instead of calling the function, schedule an idle handler at a given 
    1920    priority. This requires the async'ed method to be called from within 
    2021    the GTK main loop. Otherwise the method is executed directly. 
     
    124125    """ 
    125126    def wrapper(*args, **kwargs): 
    126         """Decorate function with a mutex that prohibits recursice execution. 
     127        """ 
     128        Decorate function with a mutex that prohibits recursice execution. 
    127129        """ 
    128130        try: 
  • gaphas/trunk/gaphas/examples.py

    r1196 r1249  
    1 """Simple example items. 
     1""" 
     2Simple example items. 
    23These items are used in various tests. 
    34""" 
     
    3839 
    3940    def glue(self, item, handle, x, y): 
    40         """Special glue method used by the ConnectingHandleTool to find 
     41        """ 
     42        Special glue method used by the ConnectingHandleTool to find 
    4143        a connection point. 
    4244        """ 
     
    7981 
    8082class ConnectingHandleTool(tool.HandleTool): 
    81     """This is a HandleTool which supports a simple connection algerithm, 
     83    """ 
     84    This is a HandleTool which supports a simple connection algerithm, 
    8285    Using LineConstraint. 
    8386    """ 
    8487 
    8588    def glue(self, view, item, handle, wx, wy): 
    86         """It allows the tool to glue to a Box or (other) Line item. 
     89        """ 
     90        It allows the tool to glue to a Box or (other) Line item. 
    8791        The distance from the item to the handle is determined in canvas 
    8892        coordinates, using a 10 pixel glue distance. 
     
    116120 
    117121    def connect(self, view, item, handle, wx, wy): 
    118         """Connect a handle to another item. 
     122        """ 
     123        Connect a handle to another item. 
    119124 
    120125        In this "method" the following assumptios are made: 
     
    181186 
    182187def DefaultExampleTool(): 
    183     """The default tool chain build from HoverTool, ItemTool and HandleTool. 
     188    """ 
     189    The default tool chain build from HoverTool, ItemTool and HandleTool. 
    184190    """ 
    185191    chain = tool.ToolChain() 
  • gaphas/trunk/gaphas/geometry.py

    r1230 r1249  
    1616 
    1717class Rectangle(object): 
    18     """Python Rectangle implementation. Rectangles can be added (union), 
     18    """ 
     19    Python Rectangle implementation. Rectangles can be added (union), 
    1920    substituted (intersection) and points and rectangles can be tested to 
    2021    be in the rectangle. 
     
    114115 
    115116    def __add__(self, obj): 
    116         """Create a new Rectangle is the union of the current rectangle 
     117        """ 
     118        Create a new Rectangle is the union of the current rectangle 
    117119        with another Rectangle, tuple (x,y) or tuple (x0, y0, x1, y1). 
    118120 
     
    156158 
    157159    def __sub__(self, obj): 
    158         """Create a new Rectangle is the union of the current rectangle 
     160        """ 
     161        Create a new Rectangle is the union of the current rectangle 
    159162        with another Rectangle or tuple (x0, y0, x1, y1). 
    160163 
     
    274277 
    275278def point_on_rectangle(rect, point, border=False): 
    276     """Return the point on which @point can be projecten on the rectangle. 
     279    """ 
     280    Return the point on which @point can be projecten on the rectangle. 
    277281    border = True will make sure the point is bound to the border of 
    278282    the reactangle. Otherwise, if the point is in the rectangle, it's okay. 
  • gaphas/trunk/gaphas/solver.py

    r1174 r1249  
    281281 
    282282    def mark_dirty(self, *variables): 
    283         """Mark a variable as "dirty". This means it it solved the next time 
     283        """ 
     284        Mark a variable as "dirty". This means it it solved the next time 
    284285        the constraints are resolved. 
    285286 
     
    322323    @observed 
    323324    def add_constraint(self, constraint): 
    324         """Add a constraint. 
     325        """ 
     326        Add a constraint. 
    325327        The actual constraint is returned, so the constraint can be removed 
    326328        later on. 
     
    378380 
    379381    def constraints_with_variable(self, variable): 
    380         """Return an iterator of constraints that work with variable. 
     382        """ 
     383        Return an iterator of constraints that work with variable. 
    381384        The variable in question should be exposed by the constraints 
    382385        variables() method. 
     
    402405 
    403406    def weakest_variable(self, variables): 
    404         """Returns the name(!) of the weakest variable. 
     407        """ 
     408        Returns the name(!) of the weakest variable. 
    405409 
    406410        Example: 
     
    474478 
    475479class solvable(object): 
    476     """Easy-to-use drop Variable descriptor. 
     480    """ 
     481    Easy-to-use drop Variable descriptor. 
    477482 
    478483    >>> class A(object): 
  • gaphas/trunk/gaphas/tree.py

    r1158 r1249  
    1111 
    1212class Tree(object): 
    13     """A Tree structure. 
     13    """ 
     14    A Tree structure. 
    1415    None is the root node. 
    1516 
     
    2829 
    2930    def get_parent(self, node): 
    30         """Return the parent item of @node. 
     31        """ 
     32        Return the parent item of @node. 
    3133        """ 
    3234        for item, children in self._children.items(): 
     
    3537 
    3638    def get_children(self, node): 
    37         """Return all child objects of @node. 
     39        """ 
     40        Return all child objects of @node. 
    3841        """ 
    3942        return self._children[node] 
    4043 
    4144    def get_siblings(self, node): 
    42         """Get all siblings of @node, including @node. 
     45        """ 
     46        Get all siblings of @node, including @node. 
    4347        """ 
    4448        parent = self.get_parent(node) 
     
    4650 
    4751    def get_next_sibling(self, node): 
    48         """Return the node on the same level after @node. 
     52        """ 
     53        Return the node on the same level after @node. 
    4954        """ 
    5055        parent = self.get_parent(node) 
     
    5358 
    5459    def get_previous_sibling(self, node): 
    55         """Return the node on the same level before @node. 
     60        """ 
     61        Return the node on the same level before @node. 
    5662        """ 
    5763        parent = self.get_parent(node) 
     
    6066 
    6167    def get_all_children(self, node): 
    62         """Iterate all children (and children of children and so forth) 
     68        """ 
     69        Iterate all children (and children of children and so forth) 
    6370        """ 
    6471        children = self.get_children(node) 
     
    6976 
    7077    def get_ancestors(self, node): 
    71         """Iterate all parents and parents of parents, etc. 
     78        """ 
     79        Iterate all parents and parents of parents, etc. 
    7280        """ 
    7381        parent = self.get_parent(node) 
     
    7785 
    7886    def _add_to_nodes(self, node, parent): 
    79         """Called only from add() 
     87        """ 
     88        Called only from add() 
    8089        """ 
    8190        nodes = self._nodes 
     
    95104    @observed 
    96105    def add(self, node, parent=None): 
    97         """Add @node to the tree. @parent is the parent node, which may 
     106        """ 
     107        Add @node to the tree. @parent is the parent node, which may 
    98108        be None if the item should be added to the root item. 
    99109        """ 
     
    107117    @observed 
    108118    def remove(self, node): 
    109         """Remove @node from the tree. 
     119        """ 
     120        Remove @node from the tree. 
    110121        """ 
    111122        # First remove children: 
     
    127138 
    128139def test_add(): 
    129     """Test creating node trees. 
     140    """ 
     141    Test creating node trees. 
    130142    """ 
    131143    print 'test_add' 
     
    182194 
    183195def test_remove(): 
    184     """Test removal of nodes. 
     196    """ 
     197    Test removal of nodes. 
    185198    """ 
    186199    print 'test_remove' 
  • gaphas/trunk/gaphas/util.py

    r1196 r1249  
    8181 
    8282def text_set_font(cr, font): 
    83     """Set the font from a string. E.g. 'sans 10' or 'sans italic bold 12' 
     83    """ 
     84    Set the font from a string. E.g. 'sans 10' or 'sans italic bold 12' 
    8485    only restriction is that the font name should be the first option and 
    8586    the font size as last argument 
     
    9596 
    9697def path_ellipse (cr, x, y, width, height, angle=0): 
    97     """Draw an ellipse. 
     98    """ 
     99    Draw an ellipse. 
    98100    x      - center x 
    99101    y      - center y