Show More
@@ -1,10 +1,9 b'' | |||
|
1 | 1 | """Link and DirectionalLink classes. |
|
2 | 2 | |
|
3 | Represents a button in the frontend using a widget. Allows user to listen for | |
|
4 | click events on the button and trigger backend code when the clicks are fired. | |
|
3 | Propagate changes between widgets on the javascript side | |
|
5 | 4 | """ |
|
6 | 5 | #----------------------------------------------------------------------------- |
|
7 |
# Copyright (c) 201 |
|
|
6 | # Copyright (c) 2014, the IPython Development Team. | |
|
8 | 7 | # |
|
9 | 8 | # Distributed under the terms of the Modified BSD License. |
|
10 | 9 | # |
@@ -31,6 +30,10 b' class Link(Widget):' | |||
|
31 | 30 | kwargs['widgets'] = widgets |
|
32 | 31 | super(Link, self).__init__(**kwargs) |
|
33 | 32 | |
|
33 | # for compatibility with traitlet links | |
|
34 | def unlink(self): | |
|
35 | self.close() | |
|
36 | ||
|
34 | 37 | |
|
35 | 38 | def link(*args): |
|
36 | 39 | return Link(widgets=args) |
@@ -49,6 +52,10 b' class DirectionalLink(Widget):' | |||
|
49 | 52 | kwargs['targets'] = targets |
|
50 | 53 | super(DirectionalLink, self).__init__(**kwargs) |
|
51 | 54 | |
|
55 | # for compatibility with traitlet links | |
|
56 | def unlink(self): | |
|
57 | self.close() | |
|
58 | ||
|
52 | 59 | |
|
53 | 60 | def dlink(source, *targets): |
|
54 | 61 | return DirectionalLink(source, targets) |
@@ -331,7 +331,7 b'' | |||
|
331 | 331 | "cell_type": "markdown", |
|
332 | 332 | "metadata": {}, |
|
333 | 333 | "source": [ |
|
334 |
"Function `widgets.link` returns a `Link` widget. The link can be broken by calling the ` |
|
|
334 | "Function `widgets.link` returns a `Link` widget. The link can be broken by calling the `unlink` method." | |
|
335 | 335 | ] |
|
336 | 336 | }, |
|
337 | 337 | { |
@@ -342,7 +342,7 b'' | |||
|
342 | 342 | }, |
|
343 | 343 | "outputs": [], |
|
344 | 344 | "source": [ |
|
345 |
"# l. |
|
|
345 | "# l.unlink()" | |
|
346 | 346 | ] |
|
347 | 347 | }, |
|
348 | 348 | { |
@@ -361,15 +361,22 b'' | |||
|
361 | 361 | ] |
|
362 | 362 | ], |
|
363 | 363 | "kernelspec": { |
|
364 | "codemirror_mode": { | |
|
365 | "name": "python", | |
|
366 | "version": 2 | |
|
367 | }, | |
|
368 | 364 | "display_name": "Python 2", |
|
369 | "language": "python", | |
|
370 | 365 | "name": "python2" |
|
371 | 366 | }, |
|
372 | "signature": "sha256:05a3e92089b37f68e3134587ffef6ef73830e5f8b3c515ba24640d7c803820c3" | |
|
367 | "language_info": { | |
|
368 | "codemirror_mode": { | |
|
369 | "name": "ipython", | |
|
370 | "version": 2 | |
|
371 | }, | |
|
372 | "file_extension": ".py", | |
|
373 | "mimetype": "text/x-python", | |
|
374 | "name": "python", | |
|
375 | "nbconvert_exporter": "python", | |
|
376 | "pygments_lexer": "ipython2", | |
|
377 | "version": "2.7.8" | |
|
378 | }, | |
|
379 | "signature": "sha256:b6eadc174d0d9c1907518d9f37760eb3dca3aec0ef1f3746e6f0537a36e99919" | |
|
373 | 380 | }, |
|
374 | 381 | "nbformat": 4, |
|
375 | 382 | "nbformat_minor": 0 |
General Comments 0
You need to be logged in to leave comments.
Login now