From bcc71453b08b501e4a8d1d4cae4d175d66ff3716 2014-01-16 10:56:00 From: Jonathan Frederic Date: 2014-01-16 10:56:00 Subject: [PATCH] Renamed widget python classes to avoid name stomping --- diff --git a/IPython/html/widgets/__init__.py b/IPython/html/widgets/__init__.py index 5ef0996..80fb856 100644 --- a/IPython/html/widgets/__init__.py +++ b/IPython/html/widgets/__init__.py @@ -1,10 +1,10 @@ -from base import Widget, init_widget_js +from widget import Widget, init_widget_js -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 +from widget_bool import BoolWidget +from widget_container import ContainerWidget +from widget_float import FloatWidget +from widget_float_range import FloatRangeWidget +from widget_int import IntWidget +from widget_int_range import IntRangeWidget +from widget_selection import SelectionWidget +from widget_string import StringWidget diff --git a/IPython/html/widgets/base.py b/IPython/html/widgets/widget.py similarity index 97% rename from IPython/html/widgets/base.py rename to IPython/html/widgets/widget.py index 763327d..2a36aa7 100644 --- a/IPython/html/widgets/base.py +++ b/IPython/html/widgets/widget.py @@ -16,8 +16,9 @@ def init_widget_js(): for filepath in glob(os.path.join(path, "*.py")): filename = os.path.split(filepath)[1] name = filename.rsplit('.', 1)[0] - if not (name == 'base' or name == '__init__'): - js_path = 'static/notebook/js/widgets/%s.js' % name + if not (name == 'widget' or name == '__init__') and name.startswith('widget_'): + # Remove 'widget_' from the start of the name before compiling the path. + js_path = 'static/notebook/js/widgets/%s.js' % name[7:] display(Javascript(data='$.getScript("%s");' % js_path)) diff --git a/IPython/html/widgets/bool.py b/IPython/html/widgets/widget_bool.py similarity index 100% rename from IPython/html/widgets/bool.py rename to IPython/html/widgets/widget_bool.py diff --git a/IPython/html/widgets/container.py b/IPython/html/widgets/widget_container.py similarity index 100% rename from IPython/html/widgets/container.py rename to IPython/html/widgets/widget_container.py diff --git a/IPython/html/widgets/float.py b/IPython/html/widgets/widget_float.py similarity index 100% rename from IPython/html/widgets/float.py rename to IPython/html/widgets/widget_float.py diff --git a/IPython/html/widgets/float_range.py b/IPython/html/widgets/widget_float_range.py similarity index 100% rename from IPython/html/widgets/float_range.py rename to IPython/html/widgets/widget_float_range.py diff --git a/IPython/html/widgets/int.py b/IPython/html/widgets/widget_int.py similarity index 100% rename from IPython/html/widgets/int.py rename to IPython/html/widgets/widget_int.py diff --git a/IPython/html/widgets/int_range.py b/IPython/html/widgets/widget_int_range.py similarity index 100% rename from IPython/html/widgets/int_range.py rename to IPython/html/widgets/widget_int_range.py diff --git a/IPython/html/widgets/selection.py b/IPython/html/widgets/widget_selection.py similarity index 100% rename from IPython/html/widgets/selection.py rename to IPython/html/widgets/widget_selection.py diff --git a/IPython/html/widgets/string.py b/IPython/html/widgets/widget_string.py similarity index 100% rename from IPython/html/widgets/string.py rename to IPython/html/widgets/widget_string.py