Commit Graph

313 Commits

Author SHA1 Message Date
Jonathan Frederic
1b29be13c6 Merge pull request #6332 from jasongrout/widget-property-lock
Widget property lock should compare json states, not python states
2014-08-25 10:12:04 -07:00
Gordon Ball
9383822d7a Clean up validation in __init__ 2014-08-24 12:26:56 +02:00
Gordon Ball
a096d01310 Test case for setting only lower or upper, no sensible default so should be an error 2014-08-24 12:26:02 +02:00
Gordon Ball
a12b1a50a9 Change range trait to _range 2014-08-24 11:48:19 +02:00
Gordon Ball
b8c0afbb55 Merge master 2014-08-22 10:19:03 +02:00
Brian E. Granger
94f717781d Merge pull request #6125 from jdfreder/flex
Embrace the flexible box model in the widgets
2014-08-20 14:15:22 -04:00
Jonathan Frederic
be3ba35736 Fix typo in deprecated class name. 2014-08-20 09:34:05 -07:00
Gordon Ball
8838762b30 Remove a rogue print statement 2014-08-20 16:49:52 +02:00
Gordon Ball
08895738f2 Merge master 2014-08-20 16:44:58 +02:00
Gordon Ball
05f07f1f71 Add a number of extra tests for the range widgets 2014-08-20 16:25:53 +02:00
Gordon Ball
2be045fe25 Support both value tuple and upper, lower traits for both int and float widgets 2014-08-20 16:25:33 +02:00
Jonathan Frederic
8877d32c4e Merge pull request #6194 from SylvainCorlay/immediate-widget-comm
Allow model id to be set externally on creation of the widget.
2014-08-19 14:33:03 -07:00
Jason Grout
0e5ceca059 Make the widget property_lock store the JSON state, not the original object
Comparison between arbitrary python objects can get crazy, whereas we really
only care about if the JSON state we are syncing is different.  So with this change,
we store and check against the JSON state.
2014-08-18 17:28:07 +00:00
Jonathan Frederic
690059f8f8 Merge pull request #6296 from jasongrout/sync-hold
Add a new context manager, Widget.hold_sync(), which holds any syncing until the manager exits
2014-08-14 12:45:19 -07:00
Jonathan Frederic
2db702fa57 Filenames s/container/box 2014-08-13 13:29:30 -07:00
Jonathan Frederic
d985ee86c6 s/Container/Box 2014-08-13 13:19:27 -07:00
Jason Grout
5cd46788f9 Before syncing a widget's state, check first for the property lock, then for the widget state lock 2014-08-12 18:23:57 +00:00
Jason Grout
af26d9cc24 Add a new context manager, Widget.hold_sync(), which holds any syncing until the manager exits
Sometimes for consistency or efficiency purposes, it makes sense to update
a group of properties all at once.  This context manager makes this possible.

We also fix a bug where send_state was not passing the key on to get_state.
2014-08-12 17:29:41 +00:00
Sylvain Corlay
f9fa4ada06 allowing widet id to be set externally 2014-08-11 18:36:59 +00:00
Jason Grout
8513f673e3 Make the widget comm attribute more straigtforward
Instead of automagically instantiating a comm when it is accessed, require a call to open().  This makes the comm attribute much less magical, and hopefully more understandable.
2014-08-11 18:36:59 +00:00
Jason Grout
16c366d1b5 Automatically open a comm on creation of widgets
This will immediately create a model on the javascript side when a widget is created.  This means that, for example, a widget that only interacts with its model can work without "displaying" it.
2014-08-11 18:30:26 +00:00
Jonathan Frederic
36721c73c6 Added some doc strings on the widgets.
Also address the comments Matthias left me.
2014-08-08 14:57:51 -07:00
Jonathan Frederic
dbb88f95cd Make HBox and VBox helper functions 2014-08-08 14:57:51 -07:00
Sylvain Corlay
c9ed512d54 adding hbox and vbox
Conflicts:
	IPython/html/static/widgets/js/widget_container.js
	IPython/html/widgets/widget_container.py
2014-08-08 14:57:51 -07:00
Jonathan Frederic
170b13102e Fix interact tests for rename 2014-08-08 14:56:11 -07:00
Jonathan Frederic
ba3033971e Renamed *Widget to *,
depracted old names.
2014-08-08 14:56:11 -07:00
Jonathan Frederic
37f00f73d7 Added baseline and stretch 2014-08-08 14:56:10 -07:00
Jonathan Frederic
6faf86ee77 Embrace flexible box model 2014-08-08 14:56:10 -07:00
Gordon Ball
8c5218b581 Default to 25-75% of min-max if no value is set instead of 0-1 2014-08-07 21:32:25 +02:00
Jason Grout
d64627380b Default view should be the base widget view class 2014-08-07 13:12:15 -04:00
Gordon Ball
ff3f952b18 Merge branch 'master' into interact-range-widgets
Conflicts:
	IPython/html/static/style/ipython.min.css
	IPython/html/static/style/style.min.css
	IPython/html/static/widgets/js/widget_int.js
2014-08-07 17:11:06 +02:00
Jonathan Frederic
ba0a805404 Merge pull request #6226 from jasongrout/css-top-default
Remove $el_to_style from the widget javascript code; '' now defaults to this.$el
2014-08-04 13:46:01 -07:00
MinRK
09c1354ea7 avoid unregistering widget model twice
widgets are registered when the comm is created;
closing unregisters them. Calling `close` a second time
should be a no-op.
2014-07-31 12:23:03 -07:00
Sylvain Corlay
1bbc915ac0 setting _comm to None 2014-07-30 23:16:24 -04:00
Sylvain Corlay
ea52ef8704 del Widget.widgets[seld.model_id] in close rather than in __del__ 2014-07-30 00:28:30 +00:00
Jason Grout
eccc20ce1a Remove $el_to_style from the widget javascript code; '' now defaults to this.$el
This seems to make it easiest to select the top-level element.  An alternative is to use special syntax for top-level elements, like in https://github.com/ipython/ipython/pull/6185

This will be followed up by other fixes that let the user set specific common properties of different elements.

This change also adds the .addBack() call, which means that nonempty selectors now apply to this.$el and its descendants, rather than just the descendants of this.$el.
2014-07-28 19:11:20 +00:00
sylvain.corlay
a9c34b679b decoupling the comm lifetime from the widget lifetime 2014-07-26 12:36:21 -04:00
Brian E. Granger
372507e3f1 Merge pull request #6128 from jasongrout/widget-trait-serialization
Widget trait serialization
2014-07-23 14:13:24 -07:00
Jason Grout
8fb0ae4d36 Change serialize/deserialize to to_json/from_json 2014-07-23 20:22:50 +00:00
Jason Grout
97141c6bca Simplify the code for picking json serialization functions to expose the logic better 2014-07-22 15:21:28 +00:00
Jason Grout
3235f42d12 Container assumes the children attribute is not None
Thanks to @SylvainCorlay for pointing this out.
2014-07-18 16:59:41 +00:00
Jason Grout
06084e996c Change serialization terminology to serialize/deserialize 2014-07-17 20:57:10 +00:00
Jason Grout
eed0715a09 Prepend a sentinel value to model ids to distinguish them from normal UUIDs (from Sylvain Corlay). 2014-07-17 20:55:27 +00:00
Jason Grout
14f3897b56 Make Container widgets take children as the first positional argument
This makes creating containers less cumbersome: Container([list, of, children]), rather than Container(children=[list, of, children])
2014-07-17 20:07:37 +00:00
Jason Grout
0c72fddaba Update widget serializer/unserializer to allow custom serialization on a trait-by-trait basis.
Serializers/unserializers are given as the trait metadata keys `to_json` and `from_json`.
2014-07-12 23:32:34 -05:00
Jonathan Frederic
636362787b Fixed buggy behavior 2014-07-08 10:57:56 -05:00
Jonathan Frederic
14ff754cdf Allow a widget to be displayed more than once within a parent widget. 2014-07-08 10:57:56 -05:00
Gordon Ball
bfd029f5ab Remove tests for 4-5 tuples, add tests for validate logic 2014-07-03 12:08:53 +02:00
Gordon Ball
b7bb76f073 Fix validate logic if min/max are changed 2014-07-03 12:05:49 +02:00
Gordon Ball
1cb0cbf4b9 Remove 4-5 tuple forms from interact() 2014-07-03 12:01:56 +02:00
Gordon Ball
7e4cd6abc1 Add tests for the on_demand option 2014-06-26 21:31:07 +02:00
Gordon Ball
c85155b25d Add some tests for the 4-5 int/float form in interact() 2014-06-26 21:11:41 +02:00
Gordon Ball
59a461f928 Fix format problem when showing an error 2014-06-26 21:11:05 +02:00
Gordon Ball
5eea47203b Disable run button until the function finishes 2014-06-26 19:25:52 +02:00
Gordon Ball
5524077e87 Add an extended range abbreviation including a step value 2014-06-25 18:10:59 +02:00
Gordon Ball
945a840674 Add float implementation of range widget 2014-06-25 18:09:44 +02:00
Gordon Ball
3178a184c0 Add initial implementation of 2-handle range sliders for integers. 2014-06-25 17:51:55 +02:00
Gordon Ball
4752b83feb Add 'on_demand' option to interact() so that long-running functions can be started only when explicitly requested 2014-06-25 16:49:56 +02:00
Raffaele De Feo
694f33e2ba Validate initial value of "_BoundedFloatWidget". 2014-06-17 15:02:28 +02:00
Jonathan Frederic
74483d77da Change css dict to a list,
even though this introduces O(N) complexity, it fixes a bug
where path dependent css traits could be executed out of order,
making it impossible to actually set the traits from the back-end.
2014-06-02 15:00:33 -07:00
Jessica B. Hamrick
287e9a5cbd Add tests for default/custom description 2014-05-08 11:18:55 -07:00
Jessica B. Hamrick
31812159af Only set widget description in interact if it does not already exist 2014-05-08 11:12:02 -07:00
Maximilian Albert
fb11e70f53 Fix copy & paste error in docstring. 2014-04-20 01:06:44 +01:00
Jessica B. Hamrick
e436850582 Add placeholder attribute to text widgets 2014-04-17 10:56:30 -04:00
jdavidheiser
e0a40d54cb Update widget_selection.py 2014-04-03 18:45:25 -07:00
jdavidheiser
52e58dce6d Update widget_selection.py 2014-04-03 18:31:30 -07:00
jdavidheiser
9810033988 widget_selection update
Fix for the fact that dictionary randomization sometimes switches the order of the arguments passed to the class on initialization.  This means that, potentially, 'value' can be updated BEFORE 'values', and since the method to update 'value' checks to see whether it exists in 'values', this breaks things.
2014-04-03 16:26:43 -07:00
Thomas Kluyver
95dc697e3b Remove Widget.closed attribute
Closes gh-5282
2014-03-05 15:34:14 -08:00
Jonathan Frederic
673577cf6c Merge pull request #5207 from Zaharid/childfireevent
Children fire event
2014-02-28 13:47:21 -08:00
MinRK
d8b6a1a0ba don't validate ContainerWidget.children
just use a plain Tuple, so we don't have to define a new Trait
2014-02-25 19:08:43 -08:00
MinRK
cc1ba8b1f7 remove incorrect is instance check in children_changed 2014-02-25 15:00:48 -08:00
MinRK
c89ec19fca don't check shape of ContainerWidget.children 2014-02-25 14:37:12 -08:00
Jonathan Frederic
7855de2f13 s/CTuple/Tuple 2014-02-25 13:50:58 -08:00
Jonathan Frederic
dedbc3b0e1 Changed children list to CTuple.
Also removed some unused refences in the widget code
and added support for tuples in the pack/unpack code.
2014-02-25 09:46:27 -08:00
zah
439003d709 Children fire event
Now when a container widget is displayed, the _handle_displayed method
of each of its children is fired.
2014-02-23 20:31:39 +01:00
Brian E. Granger
708c30c912 Merge pull request #5136 from minrk/interact-default
set default value from signature defaults in interact
2014-02-21 16:28:52 -08:00
MinRK
62f318c777 undo failed changes
before raising

otherwise, invalid values were still accepted
2014-02-20 22:57:01 -08:00
MinRK
b51cc50357 further tests for default values in interact
both valid and invalid
2014-02-20 22:37:04 -08:00
MinRK
acfc2d5308 set default value from dict 2014-02-20 22:36:42 -08:00
Jonathan Frederic
0eebd9e05b Added msg_throttle sync=True widget traitlet 2014-02-20 08:41:05 -08:00
MinRK
e91ef370dd remove no-op adding abbreviations from always-empty dict 2014-02-16 15:17:23 -08:00
MinRK
8a2d92010a set default value from signature defaults in interact
If available, use the default value from the signature for the initial condition,
when using range/choice abbreviations.

Not affected:

- single-value abbreviations (`@interact(a=5)` sets `a=5`)
- explicit Widgets
2014-02-16 15:11:39 -08:00
MinRK
d772b4c3da catch errors at a lower level in interact
for cleaner tracebacks in the interact callback than the fallback case
2014-02-07 16:51:10 -08:00
MinRK
ddc22152ea show traceback in widget handlers
rather than logging

closes #5064
2014-02-07 16:43:49 -08:00
MinRK
813e32dfea set readout=True as default on SliderWidgets 2014-02-07 11:16:46 -08:00
MinRK
7861bee65f test widget interaction (Python) 2014-02-06 17:06:08 -08:00
MinRK
6d555b7aee return f with @interact, not just @interact(**kwargs) 2014-02-06 17:06:08 -08:00
MinRK
031b69895c fix ValueError format message 2014-02-06 17:06:07 -08:00
MinRK
48a56d3156 simplify float/int slider abbreviation logic
fixes unhanded case where only one entry is a float
2014-02-06 17:06:07 -08:00
MinRK
7911c6c237 finish removing *args support 2014-02-06 17:06:07 -08:00
MinRK
ad6109692d ensure range widgets get value that is on a step 2014-02-06 17:06:07 -08:00
MinRK
a58ca8a0a0 s/const/fixed/ 2014-02-06 17:06:07 -08:00
MinRK
2d2c5beb0e move @annotate to py3compat 2014-02-06 17:06:07 -08:00
MinRK
3053a855a9 remove positional arg support from interact 2014-02-06 17:06:06 -08:00
MinRK
feab63754d update interact now that SelectionWidget.values is a dict 2014-02-06 17:06:06 -08:00
Brian E. Granger
88fb17b182 Adding const pseudo-widget for fixing arguments to interact. 2014-02-06 17:06:06 -08:00
Brian E. Granger
6e8c63ea19 Adding decorator forms of interact. Yeah! 2014-02-06 17:06:05 -08:00
Brian E. Granger
dd9a6efaed Utter interact insanity.
This involves a bunch of really complicated logic to handle the
different ways that function parameters can be processed in Python.
Most importantly, this includes support for *args in interact.
2014-02-06 17:06:05 -08:00
Brian E. Granger
55cddce784 Fixing interact imports. 2014-02-06 17:06:05 -08:00
Brian E. Granger
2ef393aaa3 Renaming interact.py->interaction.py to improve imports. 2014-02-06 17:06:05 -08:00