From f3a3e7c9cb80b290ba449e3451bca004eda74a98 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Fri, 18 Oct 2013 20:38:26 +0000 Subject: [PATCH] Added int widget --- IPython/html/static/notebook/js/widgets/int.js | 4 ++++ IPython/html/widgets/__init__.py | 1 + IPython/html/widgets/int.py | 10 ++++++++++ 3 files changed, 15 insertions(+) create mode 100644 IPython/html/static/notebook/js/widgets/int.js create mode 100644 IPython/html/widgets/int.py diff --git a/IPython/html/static/notebook/js/widgets/int.js b/IPython/html/static/notebook/js/widgets/int.js new file mode 100644 index 000000000..459586264 --- /dev/null +++ b/IPython/html/static/notebook/js/widgets/int.js @@ -0,0 +1,4 @@ +require(["notebook/js/widget"], function(){ + var IntWidgetModel = IPython.WidgetModel.extend({}); + IPython.notebook.widget_manager.register_widget_model('IntWidgetModel', IntWidgetModel); +}); \ No newline at end of file diff --git a/IPython/html/widgets/__init__.py b/IPython/html/widgets/__init__.py index 101a43a9e..5ef099635 100644 --- a/IPython/html/widgets/__init__.py +++ b/IPython/html/widgets/__init__.py @@ -4,6 +4,7 @@ from bool import BoolWidget from container import ContainerWidget from float import FloatWidget from float_range import FloatRangeWidget +from int import IntWidget from int_range import IntRangeWidget from selection import SelectionWidget from string import StringWidget diff --git a/IPython/html/widgets/int.py b/IPython/html/widgets/int.py new file mode 100644 index 000000000..742aea30f --- /dev/null +++ b/IPython/html/widgets/int.py @@ -0,0 +1,10 @@ +from base import Widget +from IPython.utils.traitlets import Unicode, Int, Bool, List + +class IntWidget(Widget): + target_name = Unicode('IntWidgetModel') + default_view_name = Unicode('IntTextView') + _keys = ['value', 'disabled'] + + value = Int(0) + disabled = Bool(False) # Enable or disable user changes