##// END OF EJS Templates
use jslink, jsdlink for frontend link functions
Min RK -
Show More
@@ -11,7 +11,7 b' from .widget_selection import RadioButtons, ToggleButtons, Dropdown, Select'
11 from .widget_selectioncontainer import Tab, Accordion
11 from .widget_selectioncontainer import Tab, Accordion
12 from .widget_string import HTML, Latex, Text, Textarea
12 from .widget_string import HTML, Latex, Text, Textarea
13 from .interaction import interact, interactive, fixed, interact_manual
13 from .interaction import interact, interactive, fixed, interact_manual
14 from .widget_link import Link, link, DirectionalLink, directional_link, dlink
14 from .widget_link import jslink, jsdlink, Link, DirectionalLink
15
15
16 # Deprecated classes
16 # Deprecated classes
17 from .widget_bool import CheckboxWidget, ToggleButtonWidget
17 from .widget_bool import CheckboxWidget, ToggleButtonWidget
@@ -3,37 +3,37 b''
3
3
4 import nose.tools as nt
4 import nose.tools as nt
5
5
6 from .. import link, dlink, ToggleButton
6 from .. import jslink, jsdlink, ToggleButton
7 from .test_interaction import setup, teardown
7 from .test_interaction import setup, teardown
8
8
9 def test_link_args():
9 def test_jslink_args():
10 with nt.assert_raises(TypeError):
10 with nt.assert_raises(TypeError):
11 link()
11 jslink()
12 w1 = ToggleButton()
12 w1 = ToggleButton()
13 with nt.assert_raises(TypeError):
13 with nt.assert_raises(TypeError):
14 link((w1, 'value'))
14 jslink((w1, 'value'))
15
15
16 w2 = ToggleButton()
16 w2 = ToggleButton()
17 link((w1, 'value'), (w2, 'value'))
17 jslink((w1, 'value'), (w2, 'value'))
18
18
19 with nt.assert_raises(TypeError):
19 with nt.assert_raises(TypeError):
20 link((w1, 'value'), (w2, 'nosuchtrait'))
20 jslink((w1, 'value'), (w2, 'nosuchtrait'))
21
21
22 with nt.assert_raises(TypeError):
22 with nt.assert_raises(TypeError):
23 link((w1, 'value'), (w2, 'traits'))
23 jslink((w1, 'value'), (w2, 'traits'))
24
24
25 def test_dlink_args():
25 def test_jsdlink_args():
26 with nt.assert_raises(TypeError):
26 with nt.assert_raises(TypeError):
27 dlink()
27 jsdlink()
28 w1 = ToggleButton()
28 w1 = ToggleButton()
29 with nt.assert_raises(TypeError):
29 with nt.assert_raises(TypeError):
30 dlink((w1, 'value'))
30 jsdlink((w1, 'value'))
31
31
32 w2 = ToggleButton()
32 w2 = ToggleButton()
33 dlink((w1, 'value'), (w2, 'value'))
33 jsdlink((w1, 'value'), (w2, 'value'))
34
34
35 with nt.assert_raises(TypeError):
35 with nt.assert_raises(TypeError):
36 dlink((w1, 'value'), (w2, 'nosuchtrait'))
36 jsdlink((w1, 'value'), (w2, 'nosuchtrait'))
37
37
38 with nt.assert_raises(TypeError):
38 with nt.assert_raises(TypeError):
39 dlink((w1, 'value'), (w2, 'traits'))
39 jsdlink((w1, 'value'), (w2, 'traits'))
@@ -52,7 +52,7 b' class Link(Widget):'
52
52
53
53
54 @skip_doctest
54 @skip_doctest
55 def link(*args):
55 def jslink(*args):
56 """Link traits from different widgets together on the frontend so they remain in sync.
56 """Link traits from different widgets together on the frontend so they remain in sync.
57
57
58 Parameters
58 Parameters
@@ -93,7 +93,7 b' class DirectionalLink(Widget):'
93 self.close()
93 self.close()
94
94
95 @skip_doctest
95 @skip_doctest
96 def directional_link(source, *targets):
96 def jsdlink(source, *targets):
97 """Link the trait of a source widget with traits of target widgets in the frontend.
97 """Link the trait of a source widget with traits of target widgets in the frontend.
98
98
99 Parameters
99 Parameters
@@ -109,4 +109,3 b' def directional_link(source, *targets):'
109 """
109 """
110 return DirectionalLink(source=source, targets=targets)
110 return DirectionalLink(source=source, targets=targets)
111
111
112 dlink = directional_link
General Comments 0
You need to be logged in to leave comments. Login now