Show More
@@ -228,7 +228,7 b' class link(object):' | |||||
228 | obj.on_trait_change(callback, attr, remove=True) |
|
228 | obj.on_trait_change(callback, attr, remove=True) | |
229 |
|
229 | |||
230 | @skip_doctest |
|
230 | @skip_doctest | |
231 |
class |
|
231 | class directional_link(object): | |
232 | """Link the trait of a source object with traits of target objects. |
|
232 | """Link the trait of a source object with traits of target objects. | |
233 |
|
233 | |||
234 | Parameters |
|
234 | Parameters | |
@@ -239,7 +239,7 b' class unilink(object):' | |||||
239 | Examples |
|
239 | Examples | |
240 | -------- |
|
240 | -------- | |
241 |
|
241 | |||
242 |
>>> c = |
|
242 | >>> c = directional_link((src, 'value'), (tgt1, 'value'), (tgt2, 'value')) | |
243 | >>> src.value = 5 # updates target objects |
|
243 | >>> src.value = 5 # updates target objects | |
244 | >>> tgt1.value = 6 # does not update other objects |
|
244 | >>> tgt1.value = 6 # does not update other objects | |
245 | """ |
|
245 | """ | |
@@ -278,6 +278,10 b' class unilink(object):' | |||||
278 | self.source = None |
|
278 | self.source = None | |
279 | self.targets = [] |
|
279 | self.targets = [] | |
280 |
|
280 | |||
|
281 | def dlink(source, *targets): | |||
|
282 | """Shorter helper function returning a directional_link object""" | |||
|
283 | return directional_link(source, *targets) | |||
|
284 | ||||
281 | #----------------------------------------------------------------------------- |
|
285 | #----------------------------------------------------------------------------- | |
282 | # Base TraitType for all traits |
|
286 | # Base TraitType for all traits | |
283 | #----------------------------------------------------------------------------- |
|
287 | #----------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now