Commit Graph

381 Commits

Author SHA1 Message Date
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
Thomas Kluyver
a96c228554 Get widgets from function annotations and default arguments.
Also, preserve the order of function parameters from the signature where
possible.

This uses a backport of the Python 3.3 signature machinery that @minrk
found and improved.
2014-02-06 17:06:05 -08:00
Brian E. Granger
5853bb8ff7 Adding .widget to function. 2014-02-06 17:06:04 -08:00
Brian E. Granger
93047f1d3c Updating interact to work with latest state of widgets. 2014-02-06 17:06:04 -08:00
Brian E. Granger
faebb43e01 Updating interact to new APIs. 2014-02-06 17:06:04 -08:00
Brian E. Granger
1d6cde4877 Adding interact.py. 2014-02-06 17:06:04 -08:00
MinRK
5823b875eb don't allow empty selection in selection widgets
raises KeyError on failed lookup (in both directions)
2014-02-04 10:38:26 -08:00
MinRK
ca0afa1d8b value_names is read-only 2014-02-03 17:15:06 -08:00
MinRK
3e1f2e22f8 Make SelectionWidget.values a dict
rename 'labels' and '_value' to 'value_names' and 'value_name'.

To specify a mapping of value names and values, use a dict.
If you specify `values=[list]`, then an OrderedDict will be used.

Assignment after construction only supports a dict.
2014-02-03 17:15:06 -08:00
Brian E. Granger
2b7310f794 Merge pull request #4933 from jdfreder/widget-model-name
Small Widget inconsistency fixes
2014-02-03 12:38:03 -08:00
Brian E. Granger
cef93c8cfb Adding initial version of readout to sliders. 2014-01-31 20:56:12 -08:00
Thomas Kluyver
c633256fc9 Fix some formatting in widget docstrings 2014-01-29 14:55:12 -08:00
Jonathan Frederic
865c7330a9 s/model_name/_model_name 2014-01-29 12:37:30 -08:00
Jonathan Frederic
75b148d40b Renamed widgets...
TextWidget, TextareaWidget, CheckboxWidget, and SelectWidget
2014-01-28 12:51:24 -08:00
MinRK
36db60eacb review pass on Python-side of widgets
- remove variable signature complexity
- use a few more traitlets as appropriate
2014-01-26 15:46:06 -08:00
Jonathan Frederic
e793d022b5 Callback dispatcher return callback value.
Also import it with the widgets namespace so it can be used elsewhere.
2014-01-23 10:52:33 -08:00
Jonathan Frederic
00b39af9cf Fixed type in container
._children was not being set...  Instead the value was being returned (useless).
2014-01-23 09:12:05 -08:00
Jonathan Frederic
91e82218a8 Changed selection widget API to use labels list
for mapping custom str reprs to items in the selection list
2014-01-22 17:15:10 -08:00
Jonathan Frederic
288b8a0ced s/view_name/_view_name 2014-01-22 16:21:00 -08:00
Jonathan Frederic
2d13d05e9c Replace O(N^2) algorithm with a faster one. 2014-01-22 16:14:20 -08:00
Jonathan Frederic
9e643f5692 Support multiple types in selection widget. 2014-01-22 15:53:58 -08:00
Jonathan Frederic
629d65da89 Fixed context errors and a couple of typos to get the tests working again 2014-01-22 11:16:50 -08:00
Jonathan Frederic
d7b86104b8 Fixed typo - else -> elif 2014-01-21 17:14:34 -08:00
Jonathan Frederic
046280b51a s/ModalView/PopupView 2014-01-21 17:09:49 -08:00
Jonathan Frederic
e323f64e6d Create base widget classes 2014-01-21 16:44:57 -08:00
Jonathan Frederic
b432b4840f Use CUnicode for width and height in ImageWidget 2014-01-21 16:33:49 -08:00
Jonathan Frederic
e823d386ab Fixed name conflict with _property_lock 2014-01-21 15:18:49 -08:00
Jonathan Frederic
077bd5c6ca Added new CallbackDispatcher class 2014-01-21 15:14:27 -08:00
Jonathan Frederic
611614b6eb Document in widget packing that vaues must be JSON-able. 2014-01-21 14:25:08 -08:00
Jonathan Frederic
cf05ef015a ict comprehension and list comprehension in pack/unpack widgets 2014-01-21 14:23:44 -08:00
Jonathan Frederic
cb6094281c s/custom_content/content 2014-01-21 14:17:57 -08:00
Jonathan Frederic
5fe860ed26 Added doc strings to properties in widget.py 2014-01-21 14:16:24 -08:00
Jonathan Frederic
1689eed2f6 Reorganized attrs in widget.py 2014-01-21 14:13:33 -08:00
Jonathan Frederic
d317532a38 Halign dict colons 2014-01-16 17:17:00 +00:00
Jonathan Frederic
7387f886c6 containers and selectioncontainers now only allow one of any single child 2014-01-16 14:48:56 +00:00
Jonathan Frederic
bfdebf9632 More PEP8 changes 2014-01-16 14:20:04 +00:00
Jonathan Frederic
ff39989b8b s/Int/CInt s/Float/CFloat 2014-01-16 11:42:38 +00:00
Jonathan Frederic
74185a68e7 Got containers and mutlicontainers working! Yay 2014-01-16 10:57:19 +00:00
Jonathan Frederic
4017c7b27a Fixed *almost* all of the test-detected bugs 2014-01-16 10:57:19 +00:00
Jonathan Frederic
c085593e2a More fixes 2014-01-16 10:57:18 +00:00
Jonathan Frederic
d694666e66 A lot of bug fixes...
Related to 1-to-1 changes
2014-01-16 10:57:18 +00:00
Jonathan Frederic
047a90538f 1-to-1 widget / view mapping 2014-01-16 10:57:18 +00:00
Jonathan Frederic
c1c7bb7563 Everyone uses one model 2014-01-16 10:57:18 +00:00
Jonathan Frederic
b16171ac76 Added sync=True to all view name attrs 2014-01-16 10:57:18 +00:00
Jonathan Frederic
cfe8a07337 Added sync= attr to DOMWidget 2014-01-16 10:57:18 +00:00
Jonathan Frederic
b4a83b6044 sync=True isntead of a keys list 2014-01-16 10:57:18 +00:00
Jonathan Frederic
00650fd64a Dev meeting Jan 2014, widget review day 2 2014-01-16 10:57:18 +00:00
Jonathan Frederic
d3ffd25107 Dev meeting widget review day 1 2014-01-16 10:57:18 +00:00
Paul Ivanov
897d51a567 fix typos 2014-01-16 10:57:17 +00:00
Paul Ivanov
95e99c0c61 remove unused imports 2014-01-16 10:57:17 +00:00
Jonathan Frederic
d103c682c5 Many checks off the todo list, test fixes 2014-01-16 10:57:17 +00:00
Jonathan Frederic
0f715170b3 Add a comment that explains the notion of the default element
to be styled in set_css's' doc string.
2014-01-16 10:57:17 +00:00
Jonathan Frederic
be268dcf98 Implement a context manager as a property locking mechanism in Widget. 2014-01-16 10:57:17 +00:00
Jonathan Frederic
70c6a295d0 Finished renaming Multicontainer to SelectionContainer 2014-01-16 10:57:17 +00:00
Jonathan Frederic
a528610e07 renamed: ../static/notebook/js/widgets/widget_multicontainer.js -> ../static/notebook/js/widgets/widget_selectioncontainer.js
renamed:    widget_multicontainer.py -> widget_selectioncontainer.py
2014-01-16 10:57:17 +00:00
Jonathan Frederic
c62b496b0e s/image_format/format 2014-01-16 10:57:17 +00:00
Jonathan Frederic
261e92de74 re-order handle custom msg and handle recieve state 2014-01-16 10:57:15 +00:00
Jonathan Frederic
15dabce113 send_state only once for dict signature of set_css 2014-01-16 10:57:15 +00:00
Jonathan Frederic
6c11760a89 Fixed comments for optional kwargs so they are redundant. 2014-01-16 10:57:15 +00:00
Jonathan Frederic
670f4881ec remove 3rd callback type from on_displayed 2014-01-16 10:57:15 +00:00
Jonathan Frederic
7e6c8e4f1d Remove view_name from display 2014-01-16 10:57:15 +00:00
Jonathan Frederic
463bcf85ee Fixed _send so it can open a comm if needed.
It no longer returns anything.
2014-01-16 10:57:14 +00:00
Jonathan Frederic
85b5adff58 Remove first three lines of repr widgets 2014-01-16 10:57:14 +00:00
Jonathan Frederic
4e19dd7933 s/_handle_widget_constructed/_call_widget_constructed 2014-01-16 10:57:14 +00:00
Jonathan Frederic
39aaf7bf88 s/default_view_name/view_name 2014-01-16 10:57:14 +00:00
Jonathan Frederic
21a14e11a4 s/Widget/DOMWidget s/BaseWidget/Widget 2014-01-16 10:57:14 +00:00
Jonathan Frederic
696a6e4c28 add/remove_class now can accept a list of classes 2014-01-16 10:57:14 +00:00
Jonathan Frederic
2600913067 Removed ViewWidget 2014-01-16 10:57:14 +00:00
Jason Grout
a0b2cc40b8 Make widget keys have more explicit inheritance 2014-01-16 10:57:13 +00:00
Jason Grout
ce98452180 Get rid of keys magic; make the keys very explicit 2014-01-16 10:57:13 +00:00
Jason Grout
f0a4b9ea30 Make the widget keys property traverse the superclasses and accumulate the _keys attributes.
This caches the result, overwriting the property.
2014-01-16 10:57:13 +00:00
Jonathan Frederic
7c3b21d239 Fixed typo in model_id property 2014-01-16 10:57:13 +00:00
Jonathan Frederic
57f3057ca5 Moved view widget into widget.py 2014-01-16 10:57:12 +00:00
Jonathan Frederic
46e88dc205 Fixed indent of line 450
... caused Travis to get mad
2014-01-16 10:57:12 +00:00
Jonathan Frederic
a2235efbea Further indentation cleanup 2014-01-16 10:57:12 +00:00
Jonathan Frederic
35a536f3b8 Re-decoupled comm_id from widget models 2014-01-16 10:57:12 +00:00
Jonathan Frederic
1b4e2ad6fe Added ViewWidget 2014-01-16 10:57:12 +00:00
Jason Grout
b41f77e635 Fix the python side of the add/remove class functions to send custom messages 2014-01-16 10:57:11 +00:00
Jason Grout
747b219771 Move some Widget class references to BaseWidget 2014-01-16 10:57:11 +00:00
Jason Grout
07ffef8392 Make sure containers transmit the children; take care of case where children is possibly empty. 2014-01-16 10:57:11 +00:00
Jason Grout
18beaff887 Remove unused code and debugging statements 2014-01-16 10:57:10 +00:00
Jason Grout
72f7d2fe09 Remove the automatic _children_attr and _children_lists_attr.
When serializing, any Widget object is encoded as its comm_id.  The view should know how to deal with the attribute, and should know that the attribute is a comm_id.
2014-01-16 10:57:10 +00:00
Jason Grout
ad1e23bfc2 Intermediate changes to javascript side of backbone widgets 2014-01-16 10:57:10 +00:00
Jason Grout
518cb4c647 Separate the display from the models on the python side, creating a BaseWidget class.
Conflicts:
	IPython/html/widgets/widget.py
2014-01-16 10:57:10 +00:00
Jonathan Frederic
2df05bc5b8 Display handler now supports full kwargs 2014-01-16 10:57:10 +00:00
Jonathan Frederic
996d133710 Remove redundent _handle_close method 2014-01-16 10:57:09 +00:00
Jonathan Frederic
857ae831fb Decoupled Python Widget from Comm
Fixed conflicts:
	IPython/html/widgets/widget.py
2014-01-16 10:57:09 +00:00
Jonathan Frederic
f2fefe20ff Added event for widget construction 2014-01-16 10:57:09 +00:00
Jonathan Frederic
ea27ae599b Added parent parameter to on_display callback 2014-01-16 10:57:09 +00:00
Jonathan Frederic
1b02e8f607 Add ImageWidget 2014-01-16 10:57:07 +00:00
Jonathan Frederic
8e1c52382c Added method property to messages from the front-end 2014-01-16 10:57:06 +00:00
Jonathan Frederic
0f34affc35 Dont send add and remove class calls if no comm exists 2014-01-16 10:57:05 +00:00
Jonathan Frederic
4e1e091648 Added ModalView 2014-01-16 10:57:04 +00:00
Jonathan Frederic
4333c84907 Fix scroll_to_bottom 2014-01-16 10:57:04 +00:00
Jonathan Frederic
6aac36ee13 Remove on_click, doesn't apply 2014-01-16 10:57:04 +00:00
Jonathan Frederic
4f663d896d Made scroll to bottom use msgs
allow multiple msg handlers
added send to view to automatically hookup callbacks
changed send signature to optionally accept a cell to connect callbacks
2014-01-16 10:57:04 +00:00
Jonathan Frederic
cc96589afc Changed on_submit to use custom messages instead of stateful communcation 2014-01-16 10:57:03 +00:00
Jonathan Frederic
10002f5a81 Changed button to use custom messages instead of state to communicate events. 2014-01-16 10:57:03 +00:00
Jonathan Frederic
c299022cc7 Changed add_class and remove_class to use messages instead of stateful communication 2014-01-16 10:57:03 +00:00
Jonathan Frederic
d795654251 Add scroll_to_bottom method for TextAreaView (StringWidget). 2014-01-16 10:57:03 +00:00
Jonathan Frederic
9019b639d1 Fixed a bug that didn't allow callbacks to set a property
on the widget that triggered the callback.
2014-01-16 10:57:03 +00:00
Jonathan Frederic
0d7428a903 Added TextBox submit event 2014-01-16 10:57:03 +00:00
Jonathan Frederic
c0ff518107 Added support for custom widget msgs 2014-01-16 10:57:02 +00:00
Jonathan Frederic
742ad511f6 Added check on widget close to make sure comm isn't already none. 2014-01-16 10:57:00 +00:00
Jonathan Frederic
1f39592bb1 Added missing types import 2014-01-16 10:56:59 +00:00
Jonathan Frederic
8502b2c182 Remove init_widget_js, use require.js for everything
Updated examples
Fixed bug with message throttling
2014-01-16 10:56:59 +00:00
Jonathan Frederic
08b1d08fb6 Fix: added inspect import to widget.py 2014-01-16 10:56:59 +00:00
Jonathan Frederic
3390f64dc2 Added flex properties to container.
Also replaced underscores in flex align properties with dashes.
2014-01-16 10:56:58 +00:00
Jonathan Frederic
2ba2d42e84 Added flexible box model align properties. 2014-01-16 10:56:58 +00:00
Jonathan Frederic
a67f2ec472 Fixed doc string comments, removed extra space 2014-01-16 10:56:58 +00:00
Jonathan Frederic
8279db0eb0 Fixed widget button onclick register so it only will ever register a callback once. 2014-01-16 10:56:58 +00:00
Jonathan Frederic
35fc3af84f Added on_display callback 2014-01-16 10:56:58 +00:00
Jonathan Frederic
12b02b3e49 Use baseProjectUrl for widget import path 2014-01-16 10:56:04 +00:00
Jonathan Frederic
6834224332 Updated set_css so it can handle a dictionary of keys and values. 2014-01-16 10:56:04 +00:00
Jonathan Frederic
20c97e0f87 Use relative paths for widget js jquery imports 2014-01-16 10:56:04 +00:00
Jonathan Frederic
6110e1c307 Updated ButtonWidget onclick description 2014-01-16 10:56:04 +00:00
Jonathan Frederic
e84e1d2df6 Fixed button on_click handler so it's initiated on instanciation 2014-01-16 10:56:03 +00:00
Jonathan Frederic
8fba5d2f07 Added add_class and remove_class methods. 2014-01-16 10:56:03 +00:00
Jonathan Frederic
048ba656d4 Remove text repr of js includes. 2014-01-16 10:56:03 +00:00
Jonathan Frederic
810ea87e5b Added visible property to all widgets 2014-01-16 10:56:03 +00:00
Jonathan Frederic
82dd891483 Allow parent to be set after construction...
But still must be set before display call
2014-01-16 10:56:03 +00:00
Jonathan Frederic
e9fe606ba6 More relative imports, Travis w/ Py3.3 2014-01-16 10:56:03 +00:00
Jonathan Frederic
2c3d80c275 Added selected_index property to TabView 2014-01-16 10:56:03 +00:00
Jonathan Frederic
8687ad881a Fixed widget imports for Python3 2014-01-16 10:56:02 +00:00
Jonathan Frederic
f2d77f3b78 Added labels to basic widgets 2014-01-16 10:56:02 +00:00
Jonathan Frederic
9b891d4018 s/TextareaView/TextAreaView & s/TextboxView/TextBoxView 2014-01-16 10:56:02 +00:00
Jonathan Frederic
dfd4e3269e Added TabView to multicontainer 2014-01-16 10:56:02 +00:00
Jonathan Frederic
6dd1bce589 Added ability to title multicontainer pages before multicontainer display() 2014-01-16 10:56:01 +00:00
Jonathan Frederic
510c97679d Added ability to set container page titles for widget multicontainer 2014-01-16 10:56:01 +00:00
Jonathan Frederic
a2294581ea Actual absolute paths... 2014-01-16 10:56:01 +00:00
Jonathan Frederic
5871471c1f Absolute paths 2014-01-16 10:56:01 +00:00
Jonathan Frederic
692c8f29a6 Added multicontainer widget 2014-01-16 10:56:01 +00:00
Jonathan Frederic
f422bb9be2 Cleaned up Python widget code. 2014-01-16 10:56:01 +00:00
Jonathan Frederic
837ef44256 LOTS OF WIDGET CHANGES
Moved model-like code out of manager.
Added parent/child API.
Throttling now occurs on a model by model level.
View/cell association is fixed for the most part, but there is still
     one assumption being made in handle_com_msg.
2014-01-16 10:56:01 +00:00
Jonathan Frederic
c692d2aaa8 Made registered model name look like other model names 2014-01-16 10:56:00 +00:00
Jonathan Frederic
76a7a25c12 Fixed stale reference to base.py -> widget.py 2014-01-16 10:56:00 +00:00
Jonathan Frederic
0d25759d53 Add state packet delta compression. 2014-01-16 10:56:00 +00:00
Jonathan Frederic
d72262e071 Fixed button widget click event handler/ 2014-01-16 10:56:00 +00:00
Jonathan Frederic
c20859a5c9 Add button widget 2014-01-16 10:56:00 +00:00
Jonathan Frederic
e619bdf313 Flex box system improvements
Now to set a container to vbox or hbox you call .vbox() or .hbox()
2014-01-16 10:56:00 +00:00
Jonathan Frederic
2ad57f6f9d Attempt 1, HBox and VBox implementation. 2014-01-16 10:56:00 +00:00
Jonathan Frederic
65a6000919 Renamed widget python classes to avoid name stomping 2014-01-16 10:56:00 +00:00
Jonathan Frederic
f3a3e7c9cb Added int widget 2014-01-16 10:56:00 +00:00
Jonathan Frederic
26f31184e7 Added float widget 2014-01-16 10:56:00 +00:00
Jonathan Frederic
55a6e00788 Added missing import reference for bool widget 2014-01-16 10:56:00 +00:00
Jonathan Frederic
03a832753e Changed js loading,
Use require.js in js files
Assume 1 on 1 mapping of py file names to js file names
2014-01-16 10:55:59 +00:00
Jonathan Frederic
f037f2bd42 Cleaned up python widget classes 2014-01-16 10:55:59 +00:00
Jonathan Frederic
7490cab0c1 Added boolean widget 2014-01-16 10:55:59 +00:00
Jonathan Frederic
990303f3eb Removed require.js scheme since it forces async event driven model,
this model does not work with the comm/widget communication model.
We need to be able to load the dependencies before we send the
show() message to the widget manager.  Otherwise a race condition
will exist where the widget manager may recieve the show message
before the dependencies have been loaded (happened almost every time).
2014-01-16 10:55:59 +00:00
Jonathan Frederic
4b55ef61b0 Added system that allows js to be required by widgets. 2014-01-16 10:55:59 +00:00
Jonathan Frederic
bc0363039e Removed funky javascript loading mechanism
NOTE: UNTIL THE NEW JS LOADING MECHANISM IS IN PLACE, THIS BREAKS THE SYSTEM
2014-01-16 10:55:59 +00:00
Jonathan Frederic
f939713d14 Updated imports to reflect class move 2014-01-16 10:55:59 +00:00
Jonathan Frederic
fffaba9a7b Moved widget js into static 2014-01-16 10:55:58 +00:00
Jonathan Frederic
cb7eb8354f Fixed bug where properties couldn't be set on model till model was shown 2014-01-16 10:55:58 +00:00
Jonathan Frederic
dde9018ab3 Register init_widget_js
and remove cls parameter
2014-01-16 10:55:58 +00:00
Jonathan Frederic
119104f2e8 Register new widgets in IPython.html.widgets namespace 2014-01-16 10:55:58 +00:00
Jonathan Frederic
a0d03e30f0 Add string widget 2014-01-16 10:55:58 +00:00
Jonathan Frederic
1b6062beee Add selection widget 2014-01-16 10:55:58 +00:00
Jonathan Frederic
c9a44b86cb Add container widget 2014-01-16 10:55:58 +00:00
Jonathan Frederic
4dc1155c7e Handle widget hide/show logic
also only create a widget manager once
2014-01-16 10:55:58 +00:00
Jonathan Frederic
3a16f603b9 Updates to widget.py
Added global init js function
Moved init comm logic to show function
2014-01-16 10:55:57 +00:00
Jonathan Frederic
f32f450d0f Moved widget.js into widget code directory 2014-01-16 10:55:57 +00:00
Jonathan Frederic
22dcf3aa68 Basic display logic
s/show/_repr_...
Added code to display Javascript in frontend.
2014-01-16 10:55:57 +00:00
Jonathan Frederic
918d57050a Added widget.py 2014-01-16 10:55:57 +00:00