Changeset 1794
- Timestamp:
- 07/31/07 01:10:06 (1 year ago)
- Files:
-
- gaphas/trunk/epydoc.conf (modified) (2 diffs)
- gaphas/trunk/gaphas/canvas.py (modified) (20 diffs)
- gaphas/trunk/gaphas/constraint.py (modified) (7 diffs)
- gaphas/trunk/gaphas/decorators.py (modified) (2 diffs)
- gaphas/trunk/gaphas/geometry.py (modified) (1 diff)
- gaphas/trunk/gaphas/solver.py (modified) (10 diffs)
- gaphas/trunk/gaphas/state.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphas/trunk/epydoc.conf
r1296 r1794 10 10 parse: yes 11 11 introspect: yes 12 #exclude: .*\.tests.*12 exclude: .*\.tests.* 13 13 inheritance: listed 14 14 private: no … … 22 22 top: gaphas 23 23 frames: no 24 sourcecode: no24 sourcecode: yes 25 25 gaphas/trunk/gaphas/canvas.py
r1789 r1794 20 20 Context used for updating and drawing items in a drawing canvas. 21 21 22 >>> c=Context(one=1,two='two')23 >>> c.one24 125 >>> c.two26 'two'27 >>> try: c.one = 228 ... except: 'got exc'29 'got exc'22 >>> c=Context(one=1,two='two') 23 >>> c.one 24 1 25 >>> c.two 26 'two' 27 >>> try: c.one = 2 28 ... except: 'got exc' 29 'got exc' 30 30 """ 31 31 def __init__(self, **kwargs): … … 39 39 """ 40 40 Container class for items. 41 42 Attributes:43 - projector: canvas constraint projector between item and canvas44 coordinates45 - sorter: items sorter in order used to add items to canvas46 41 """ 47 42 … … 63 58 def add(self, item, parent=None): 64 59 """ 65 Add an item to the canvas 66 67 >>> c = Canvas()68 >>> from gaphas import item69 >>> i = item.Item()70 >>> c.add(i)71 >>> len(c._tree.nodes)72 173 >>> i._canvas is c74 True60 Add an item to the canvas. 61 62 >>> c = Canvas() 63 >>> from gaphas import item 64 >>> i = item.Item() 65 >>> c.add(i) 66 >>> len(c._tree.nodes) 67 1 68 >>> i._canvas is c 69 True 75 70 """ 76 71 assert item not in self._tree.nodes, 'Adding already added node %s' % item … … 100 95 def remove(self, item): 101 96 """ 102 Remove item from the canvas 103 104 >>> c = Canvas() 105 >>> from gaphas import item 106 >>> i = item.Item() 107 >>> c.add(i) 108 >>> c.remove(i) 109 >>> c._tree.nodes 110 [] 111 >>> i._canvas 112 97 Remove item from the canvas. 98 99 >>> c = Canvas() 100 >>> from gaphas import item 101 >>> i = item.Item() 102 >>> c.add(i) 103 >>> c.remove(i) 104 >>> c._tree.nodes 105 [] 106 >>> i._canvas 113 107 """ 114 108 for child in reversed(self.get_children(item)): … … 139 133 def get_all_items(self): 140 134 """ 141 Get a list of all items 142 >>> c = Canvas() 143 >>> c.get_all_items()144 []145 >>> from gaphas import item146 >>> i = item.Item()147 >>> c.add(i)148 >>> c.get_all_items() # doctest: +ELLIPSIS149 [<gaphas.item.Item ...>]150 135 Get a list of all items. 136 137 >>> c = Canvas() 138 >>> c.get_all_items() 139 [] 140 >>> from gaphas import item 141 >>> i = item.Item() 142 >>> c.add(i) 143 >>> c.get_all_items() # doctest: +ELLIPSIS 144 [<gaphas.item.Item ...>] 151 145 """ 152 146 return self._tree.nodes … … 156 150 Return the root items of the canvas. 157 151 158 >>> c = Canvas()159 >>> c.get_all_items()160 []161 >>> from gaphas import item162 >>> i = item.Item()163 >>> c.add(i)164 >>> ii = item.Item()165 >>> c.add(ii, i)166 >>> c.get_root_items() # doctest: +ELLIPSIS167 [<gaphas.item.Item ...>]152 >>> c = Canvas() 153 >>> c.get_all_items() 154 [] 155 >>> from gaphas import item 156 >>> i = item.Item() 157 >>> c.add(i) 158 >>> ii = item.Item() 159 >>> c.add(ii, i) 160 >>> c.get_root_items() # doctest: +ELLIPSIS 161 [<gaphas.item.Item ...>] 168 162 """ 169 163 return self._tree.get_children(None) … … 178 172 def get_parent(self, item): 179 173 """ 180 See tree.Tree.get_parent() 181 >>> c = Canvas() 182 >>> from gaphas import item 183 >>> i = item.Item() 184 >>> c.add(i) 185 >>> ii = item.Item() 186 >>> c.add(ii, i) 187 >>> c.get_parent(i) 188 >>> c.get_parent(ii) # doctest: +ELLIPSIS 189 <gaphas.item.Item ...> 174 See `tree.Tree.get_parent()`. 175 176 >>> c = Canvas() 177 >>> from gaphas import item 178 >>> i = item.Item() 179 >>> c.add(i) 180 >>> ii = item.Item() 181 >>> c.add(ii, i) 182 >>> c.get_parent(i) 183 >>> c.get_parent(ii) # doctest: +ELLIPSIS 184 <gaphas.item.Item ...> 190 185 """ 191 186 return self._tree.get_parent(item) … … 193 188 def get_ancestors(self, item): 194 189 """ 195 See tree.Tree.get_ancestors() 196 >>> c = Canvas() 197 >>> from gaphas import item 198 >>> i = item.Item() 199 >>> c.add(i) 200 >>> ii = item.Item() 201 >>> c.add(ii, i) 202 >>> iii = item.Item() 203 >>> c.add(iii, ii) 204 >>> list(c.get_ancestors(i)) 205 [] 206 >>> list(c.get_ancestors(ii)) # doctest: +ELLIPSIS 207 [<gaphas.item.Item ...>] 208 >>> list(c.get_ancestors(iii)) # doctest: +ELLIPSIS 209 [<gaphas.item.Item ...>, <gaphas.item.Item ...>] 190 See `tree.Tree.get_ancestors()`. 191 192 >>> c = Canvas() 193 >>> from gaphas import item 194 >>> i = item.Item() 195 >>> c.add(i) 196 >>> ii = item.Item() 197 >>> c.add(ii, i) 198 >>> iii = item.Item() 199 >>> c.add(iii, ii) 200 >>> list(c.get_ancestors(i)) 201 [] 202 >>> list(c.get_ancestors(ii)) # doctest: +ELLIPSIS 203 [<gaphas.item.Item ...>] 204 >>> list(c.get_ancestors(iii)) # doctest: +ELLIPSIS 205 [<gaphas.item.Item ...>, <gaphas.item.Item ...>] 210 206 """ 211 207 return self._tree.get_ancestors(item) … … 213 209 def get_children(self, item): 214 210 """ 215 See tree.Tree.get_children() 216 >>> c = Canvas() 217 >>> from gaphas import item 218 >>> i = item.Item() 219 >>> c.add(i) 220 >>> ii = item.Item() 221 >>> c.add(ii, i) 222 >>> iii = item.Item() 223 >>> c.add(iii, ii) 224 >>> list(c.get_children(iii)) 225 [] 226 >>> list(c.get_children(ii)) # doctest: +ELLIPSIS 227 [<gaphas.item.Item ...>] 228 >>> list(c.get_children(i)) # doctest: +ELLIPSIS 229 [<gaphas.item.Item ...>] 211 See `tree.Tree.get_children()`. 212 213 >>> c = Canvas() 214 >>> from gaphas import item 215 >>> i = item.Item() 216 >>> c.add(i) 217 >>> ii = item.Item() 218 >>> c.add(ii, i) 219 >>> iii = item.Item() 220 >>> c.add(iii, ii) 221 >>> list(c.get_children(iii)) 222 [] 223 >>> list(c.get_children(ii)) # doctest: +ELLIPSIS 224 [<gaphas.item.Item ...>] 225 >>> list(c.get_children(i)) # doctest: +ELLIPSIS 226 [<gaphas.item.Item ...>] 230 227 """ 231 228 return self._tree.get_children(item) … … 233 230 def get_all_children(self, item): 234 231 """ 235 See tree.Tree.get_all_children() 236 >>> c = Canvas() 237 >>> from gaphas import item 238 >>> i = item.Item() 239 >>> c.add(i) 240 >>> ii = item.Item() 241 >>> c.add(ii, i) 242 >>> iii = item.Item() 243 >>> c.add(iii, ii) 244 >>> list(c.get_all_children(iii)) 245 [] 246 >>> list(c.get_all_children(ii)) # doctest: +ELLIPSIS 247 [<gaphas.item.Item ...>] 248 >>> list(c.get_all_children(i)) # doctest: +ELLIPSIS 249 [<gaphas.item.Item ...>, <gaphas.item.Item ...>] 232 See `tree.Tree.get_all_children()`. 233 234 >>> c = Canvas() 235 >>> from gaphas import item 236 >>> i = item.Item() 237 >>> c.add(i) 238 >>> ii = item.Item() 239 >>> c.add(ii, i) 240 >>> iii = item.Item() 241 >>> c.add(iii, ii) 242 >>> list(c.get_all_children(iii)) 243 [] 244 >>> list(c.get_all_children(ii)) # doctest: +ELLIPSIS 245 [<gaphas.item.Item ...>] 246 >>> list(c.get_all_children(i)) # doctest: +ELLIPSIS 247 [<gaphas.item.Item ...>, <gaphas.item.Item ...>] 250 248 """ 251 249 return self._tree.get_all_children(item) … … 253 251 def get_connected_items(self, item): 254 252 """ 255 Return a set of items that are connected to @item.253 Return a set of items that are connected to ``item``. 256 254 The list contains tuples (item, handle). As a result an item may be 257 255 in the list more than once (depending on the number of handles that 258 are connected). If @itemis connected to itself it will also appear256 are connected). If ``item`` is connected to itself it will also appear 259 257 in the list. 260 258 261 >>> c = Canvas()262 >>> from gaphas import item263 >>> i = item.Line()264 >>> c.add(i)265 >>> ii = item.Line()266 >>> c.add(ii)267 >>> iii = item.Line()268 >>> c.add (iii)269 >>> i.handles()[0].connected_to = ii270 >>> list(c.get_connected_items(i))271 []272 >>> ii.handles()[0].connected_to = iii273 >>> list(c.get_connected_items(ii)) # doctest: +ELLIPSIS274 [(<gaphas.item.Line ...>, <Handle object on (0, 0)>)]275 >>> list(c.get_connected_items(iii)) # doctest: +ELLIPSIS276 [(<gaphas.item.Line ...>, <Handle object on (0, 0)>)]259 >>> c = Canvas() 260 >>> from gaphas import item 261 >>> i = item.Line() 262 >>> c.add(i) 263 >>> ii = item.Line() 264 >>> c.add(ii) 265 >>> iii = item.Line() 266 >>> c.add (iii) 267 >>> i.handles()[0].connected_to = ii 268 >>> list(c.get_connected_items(i)) 269 [] 270 >>> ii.handles()[0].connected_to = iii 271 >>> list(c.get_connected_items(ii)) # doctest: +ELLIPSIS 272 [(<gaphas.item.Line ...>, <Handle object on (0, 0)>)] 273 >>> list(c.get_connected_items(iii)) # doctest: +ELLIPSIS 274 [(<gaphas.item.Line ...>, <Handle object on (0, 0)>)] 277 275 """ 278 276 connected_items = set() … … 285 283 def get_matrix_i2c(self, item, calculate=False): 286 284 """ 287 Get the Item to Canvas matrix for @item. 288 289 item: The item who's item-to-canvas transformation matrix should be 290 found 291 calculate: True will allow this function to actually calculate it, 292 in stead of raising an AttributeError when no matrix is present 293 yet. Note that out-of-date matrices are not recalculated. 285 Get the Item to Canvas matrix for ``item``. 286 287 item: 288 The item who's item-to-canvas transformation matrix should be 289 found 290 calculate: 291 True will allow this function to actually calculate it, 292 in stead of raising an AttributeError when no matrix is present 293 yet. Note that out-of-date matrices are not recalculated. 294 294 """ 295 295 if item._matrix_i2c is None or calculate: … … 300 300 def get_matrix_c2i(self, item, calculate=False): 301 301 """ 302 Get the Canvas to Item matrix for @item.303 See get_matrix_i2c().302 Get the Canvas to Item matrix for ``item``. 303 See `get_matrix_i2c()`. 304 304 """ 305 305 if item._matrix_c2i is None or calculate: … … 313 313 Set an update request for the item. 314 314 315 >>> c = Canvas()316 >>> from gaphas import item317 >>> i = item.Item()318 >>> ii = item.Item()319 >>> c.add(i)320 >>> c.add(ii, i)321 >>> len(c._dirty_items)322 0323 >>> c.update_now()324 >>> len(c._dirty_items)325 0315 >>> c = Canvas() 316 >>> from gaphas import item 317 >>> i = item.Item() 318 >>> ii = item.Item() 319 >>> c.add(i) 320 >>> c.add(ii, i) 321 >>> len(c._dirty_items) 322 0 323 >>> c.update_now() 324 >>> len(c._dirty_items) 325 0 326 326 """ 327 327 if update: … … 342 342 def require_update(self): 343 343 """ 344 Returns True or Falsedepending on if an update is needed.345 346 >>> c=Canvas()347 >>> c.require_update()348 False349 >>> from gaphas import item350 >>> i = item.Item()351 >>> c.add(i)352 >>> c.require_update()353 False344 Returns ``True`` or ``False`` depending on if an update is needed. 345 346 >>> c=Canvas() 347 >>> c.require_update() 348 False 349 >>> from gaphas import item 350 >>> i = item.Item() 351 >>> c.add(i) 352 >>> c.require_update() 353 False 354 354 355 355 Since we're not in a GTK+ mainloop, the update is not scheduled 356 asynchronous. Therefor require_update() returns False.356 asynchronous. Therefore ``require_update()`` returns ``False``. 357 357 """ 358 358 return bool(self._dirty_items) … … 530 530 531 531 For example having an item 532 532 533 >>> from item import Element 533 534 >>> c = Canvas() … … 540 541 541 542 and moving its first handle a bit 543 542 544 >>> e.handles()[0].x += 1 543 545 >>> map(float, e.handles()[0].pos) … … 545 547 546 548 After normalization 549 547 550 >>> c._normalize([e]) # doctest: +ELLIPSIS 548 551 set([<gaphas.item.Element object at ...>]) … … 602 605 that is used to create a context. 603 606 604 >>> c = Canvas()605 >>> c.update_now()607 >>> c = Canvas() 608 >>> c.update_now() 606 609 """ 607 610 for view in self._registered_views: … … 617 620 class VariableProjection(solver.Projection): 618 621 """ 619 Project a single gaphas.solver.Variableto another space/coordinate system.622 Project a single `solver.Variable` to another space/coordinate system. 620 623 621 624 The value has been set in the "other" coordinate system. A callback is gaphas/trunk/gaphas/constraint.py
r1793 r1794 1 1 """ 2 Module ``gaphas.constraint`` contains several flavors of constraint solver 3 classes (constraints for short), for example 4 - equality constraint - two variables should have the same value 5 - less than constraint - keep one variables smaller than other 6 7 Variables should be of type ` `gaphas.solver.Variable``.2 This module contains several flavors of constraint classes. 3 Each has a method `Constraint.solve_for(name)` and a method 4 `Constraint.mark_dirty(v)`. These methods are used by the constraint solver 5 (`solver.Solver`) to set the variables. 6 7 Variables should be of type `solver.Variable`. 8 8 9 9 See classes' documentation below for constraints description and for 10 10 examples of their usage. 11 11 12 EqualsConstraint 13 Make 'a' and 'b' equal. 14 LessThanConstraint 15 Ensure one variable stays smaller than the other. 16 CenterConstraint 17 Ensures a Variable is kept between two other variables. 18 EquationConstraint 19 Solve a linear equation. 20 BalanceConstraint 21 Keeps three variables in line, maintaining a specific ratio. 22 LineConstraint 23 Solves the equation where a line is connected to a line or side at a 24 specific point. 25 12 26 New constraint class should derive from Constraint class abstract class and 13 implement Constraint.solve_for(Variable)method to update a variable with27 implement `Constraint.solve_for(Variable)` method to update a variable with 14 28 appropriate value. 15 29 """ … … 179 193 class LessThanConstraint(Constraint): 180 194 """ 181 Ensure @smaller is less than @bigger. The variable that is passed195 Ensure ``smaller`` is less than ``bigger``. The variable that is passed 182 196 as to-be-solved is left alone (cause it is the variable that has not 183 197 been moved lately). Instead the other variable is solved. … … 195 209 196 210 Also minimal delta between two values can be set 211 197 212 >>> a, b = Variable(10.0), Variable(8.0) 198 213 >>> lt = LessThanConstraint(smaller=a, bigger=b, delta=5) … … 225 240 Takes a function, named arg value (opt.) and returns a Constraint object 226 241 Calling EquationConstraint.solve_for will solve the equation for 227 variable @arg, so that the outcome is 0.242 variable ``arg``, so that the outcome is 0. 228 243 229 244 >>> from solver import Variable … … 359 374 class BalanceConstraint(Constraint): 360 375 """ 361 Ensure that a variable @v is between values specified by @band362 and in distance proportional from @band[0].376 Ensure that a variable ``v`` is between values specified by ``band`` 377 and in distance proportional from ``band[0]``. 363 378 364 379 Consider 380 365 381 >>> from solver import Variable, WEAK 366 382 >>> a, b, c = Variable(2.0), Variable(3.0), Variable(2.3, WEAK) … … 373 389 (Variable(2, 20), Variable(3, 20), Variable(2.3, 10)) 374 390 375 Band does not have to be band[0] < band[1] 391 Band does not have to be ``band[0] < band[1]`` 392 376 393 >>> a, b, c = Variable(3.0), Variable(2.0), Variable(2.45, WEAK) 377 394 >>> bc = BalanceConstraint(band=(a,b), v=c) … … 463 480 """ 464 481 Solve the equation for the connected_handle. 482 465 483 >>> from gaphas.solver import Variable 466 484 >>> line = (Variable(0), Variable(0)), (Variable(30), Variable(20)) gaphas/trunk/gaphas/decorators.py
r1670 r1794 18 18 the GTK main loop. Otherwise the method is executed directly. 19 19 20 Note: the current implementation of async single mode only works for 21 methods, not functions. 20 Note: 21 the current implementation of async single mode only works for 22 methods, not functions. 22 23 23 24 Calling the async function from outside the gtk main loop will yield 24 25 imediate execution: 25 26 26 async just works on functions (as long as single=False):27 async just works on functions (as long as ``single=False``): 27 28 28 >>> a = async()(lambda: 'Hi')29 >>> a()30 'Hi'29 >>> a = async()(lambda: 'Hi') 30 >>> a() 31 'Hi' 31 32 32 33 Simple method: 33 34 34 >>> class A(object):35 ... @async(single=False, priority=gobject.PRIORITY_HIGH)36 ... def a(self):37 ... print 'idle-a', gobject.main_depth()35 >>> class A(object): 36 ... @async(single=False, priority=gobject.PRIORITY_HIGH) 37 ... def a(self): 38 ... print 'idle-a', gobject.main_depth() 38 39 39 40 Methods can also set sinle mode to True (the method is only scheduled one). 40 41 41 >>> class B(object):42 ... @async(single=True)43 ... def b(self):44 ... print 'idle-b', gobject.main_depth()42 >>> class B(object): 43 ... @async(single=True) 44 ... def b(self): 45 ... print 'idle-b', gobject.main_depth() 45 46 46 47 This is a helper function used to test classes A and B from within the GTK+ 47 48 main loop: 48 49 49 >>> def delayed():50 ... print 'before'51 ... a = A()52 ... b = B()53 ... a.a()54 ... b.b()55 ... a.a()56 ... b.b()57 ... a.a()58 ... b.b()59 ... print 'after'60 ... gobject.timeout_add(100, gtk.main_quit)61 >>> gobject.timeout_add(1, delayed) > 0 # timeout id may vary62 True63 >>> import gtk64 >>> gtk.main()65 before66 after67 idle-a 168 idle-a 169 idle-a 170 idle-b 150 >>> def delayed(): 51 ... print 'before' 52 ... a = A() 53 ... b = B() 54 ... a.a() 55 ... b.b() 56 ... a.a() 57 ... b.b() 58 ... a.a() 59 ... b.b() 60 ... print 'after' 61 ... gobject.timeout_add(100, gtk.main_quit) 62 >>> gobject.timeout_add(1, delayed) > 0 # timeout id may vary 63 True 64 >>> import gtk 65 >>> gtk.main() 66 before 67 after 68 idle-a 1 69 idle-a 1 70 idle-a 1 71 idle-b 1 71 72 72 As you can see, although b.b()has been called three times, it's only73 As you can see, although ``b.b()`` has been called three times, it's only 73 74 executed once. 74 75 """ … … 111 112 Enforce a function or method is not executed recursively: 112 113 113 >>> class A(object):114 ... @nonrecursive115 ... def a(self, x=1):116 ... print x117 ... self.a(x+1)118 >>> A().a()119 1120 >>> A().a()121 1114 >>> class A(object): 115 ... @nonrecursive 116 ... def a(self, x=1): 117 ... print x 118 ... self.a(x+1) 119 >>> A().a() 120 1 121 >>> A().a() 122 1 122 123 """ 123 124 def wrapper(*args, **kwargs): gaphas/trunk/gaphas/geometry.py
r1710 r1794 475 475 def rectangle_clip(recta, rectb): 476 476 """ 477 Return the clipped rectangle of recta and rectb. If they do not intersect, 478 None is returned. 477 Return the clipped rectangle of ``recta`` and ``rectb``. If they do not 478 intersect, ``None`` is returned. 479 479 480 >>> rectangle_clip((0, 0, 20, 20), (10, 10, 20, 20)) 480 481 (10, 10, 10, 10) gaphas/trunk/gaphas/solver.py
r1753 r1794 9 9 10 10 Gaphas' solver allows to define constraints between Variable instances. 11 Constraint classes are defined in gaphas.constraintmodule.11 Constraint classes are defined in `gaphas.constraint` module. 12 12 13 13 How It Works 14 ============ 14 ------------ 15 15 Every constraint contains list of variables and has to be registered in 16 solver object. Variables change ( Variables.dirty, Solver.request_resolve16 solver object. Variables change (`Variable.dirty()`, `Solver.request_resolve()` 17 17 methods) and their constraints are marked by solver as dirty. To solve 18 18 constraints, solver loops through dirty constraints and asks constraint for … … 27 27 (weakest variable invariants defined above) 28 28 29 Having weakest variable ( Constraint.weakest method) every constraint is30 being asked to solve itself (Constraint.solv_for method) changing 31 appropriate variables to make the constraint valid again.29 Having weakest variable (`constraint.Constraint.weakest()` method) every 30 constraint is being asked to solve itself (`constraint.Constraint.solve_for()` 31 method) changing appropriate variables to make the constraint valid again. 32 32 """ 33 33 … … 232 232 def __truediv__(self, other): 233 233 """ 234 #>>> from __future__ import division235 234 >>> Variable(5.) / 4 236 235 1.25 … … 302 301 def __rtruediv__(self, other): 303 302 """ 304 #>>> from __future__ import division305 303 >>> 5. / Variable(4) 306 304 1.25 … … 355 353 If projections_only is set to True, only constraints using the 356 354 variable through a Projection instance (e.i. variable itself is not 357 in Constraint.variables()) are marked.355 in `constraint.Constraint.variables()`) are marked. 358 356 359 357 Example: 358 360 359 >>> from constraint import EquationConstraint 361 360 >>> a, b, c = Variable(1.0), Variable(2.0), Variable(3.0) … … 401 400 402 401 Example: 402 403 403 >>> from constraint import EquationConstraint 404 404 >>> s = Solver() … … 429 429 @observed 430 430 def remove_constraint(self, constraint): 431 """ Remove a constraint from the solver 431 """ 432 Remove a constraint from the solver 433 432 434 >>> from constraint import EquationConstraint 433 435 >>> s = Solver() … … 443 445 444 446 Removing a constraint twice has no effect: 447 445 448 >>> s.remove_constraint(c) 446 447 449 """ 448 450 for v in constraint.variables(): … … 460 462 Return an iterator of constraints that work with variable. 461 463 The variable in question should be exposed by the constraints 462 variables()method.464 `constraint.Constraint.variables()` method. 463 465 464 466 >>> from constraint import EquationConstraint … … 486 488 """ 487 489 Example: 490 488 491 >>> from constraint import EquationConstraint 489 492 >>> a, b, c = Variable(1.0), Variable(2.0), Variable(3.0) gaphas/trunk/gaphas/state.py
r1791 r1794 26 26 27 27 # This string is added to each docstring in order to denote is's observed 28 OBSERVED_DOCSTRING = \29 '\n\nThis method is @observed. See gaphas.state for extra info.\n'28 #OBSERVED_DOCSTRING = \ 29 # '\n\n This method is @observed. See gaphas.state for extra info.\n' 30 30 31 31 # Tell @observed to dispatch invokation messages by default … … 63 63 dec = decorator(wrapper, func) 64 64 65 dec.__doc__ = (dec.__doc__ or '') + OBSERVED_DOCSTRING65 #dec.__doc__ = (dec.__doc__ or '') + OBSERVED_DOCSTRING 66 66 func.__observer__ = dec 67 67 if DISPATCH_BY_DEFAULT:
