From b41a9c958677e6f9c9b168f472a44f8cd1a0e892 Mon Sep 17 00:00:00 2001 From: Silvia Date: Sat, 29 Nov 2014 16:54:44 +0000 Subject: [PATCH 1/3] Add docstring documentation for widget_float --- IPython/html/widgets/widget_float.py | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/IPython/html/widgets/widget_float.py b/IPython/html/widgets/widget_float.py index 01395ec4c..6190bb43b 100644 --- a/IPython/html/widgets/widget_float.py +++ b/IPython/html/widgets/widget_float.py @@ -55,6 +55,26 @@ class BoundedFloatText(_BoundedFloat): @register('IPython.FloatSlider') class FloatSlider(_BoundedFloat): + """ Slider/trackbar of floating values with the specified range. + + Parameters + ---------- + value : float + initial position of the slider + min : float + minimal position of the slider + max : float + maximal position of the slider + step : float + step of the trackbar + description : str + name of the slider + orientation : {'vertical', 'horizontal}, optional + default is horizontal + readout : {True, False}, optional + default is True, display the current value of the slider next to it + + """ _view_name = Unicode('FloatSliderView', sync=True) orientation = CaselessStrEnum(values=['horizontal', 'vertical'], default_value='horizontal', @@ -66,6 +86,22 @@ class FloatSlider(_BoundedFloat): @register('IPython.FloatProgress') class FloatProgress(_BoundedFloat): + """ Progress bar. + + Parameters + ----------- + value : float + current position within the range of the progress bar + min : float + minimal position of the slider + max : float + maximal position of the slider + step : float + step of the progress bar + description : str + name of the progress bar + +""" _view_name = Unicode('ProgressView', sync=True) bar_style = CaselessStrEnum( From 6b7399c8e60276061e12a51cb194ef4452297c5f Mon Sep 17 00:00:00 2001 From: silviav12 Date: Sun, 30 Nov 2014 18:27:47 +0000 Subject: [PATCH 2/3] Added changes to dosctring documentation in widget_float.py (previous docstring written by me). Added docstring documentation in widget_bool.py. --- IPython/html/widgets/widget_bool.py | 20 ++++++++- IPython/html/widgets/widget_float.py | 66 ++++++++++++++++++++++++++-- 2 files changed, 80 insertions(+), 6 deletions(-) diff --git a/IPython/html/widgets/widget_bool.py b/IPython/html/widgets/widget_bool.py index 87f1efd53..e21ad3d99 100644 --- a/IPython/html/widgets/widget_bool.py +++ b/IPython/html/widgets/widget_bool.py @@ -29,13 +29,29 @@ class _Bool(DOMWidget): @register('IPython.Checkbox') class Checkbox(_Bool): - """Displays a boolean `value`.""" + """Displays a boolean `value` in the form of a checkbox. + + Parameters + ---------- + value : {True,False} + value of the checkbox: True-checked, False-unchecked + description : str + description displayed next to the checkbox +""" _view_name = Unicode('CheckboxView', sync=True) @register('IPython.ToggleButton') class ToggleButton(_Bool): - """Displays a boolean `value`.""" + """Displays a boolean `value` in the form of a toggle button. + + Parameters + ---------- + value : {True,False} + value of the toggle button: True-pressed, False-unpressed + description : str + description displayed next to the button +""" _view_name = Unicode('ToggleButtonView', sync=True) tooltip = Unicode(help="Tooltip caption of the toggle button.", sync=True) diff --git a/IPython/html/widgets/widget_float.py b/IPython/html/widgets/widget_float.py index 6190bb43b..d60c8f4ab 100644 --- a/IPython/html/widgets/widget_float.py +++ b/IPython/html/widgets/widget_float.py @@ -45,11 +45,39 @@ class _BoundedFloat(_Float): @register('IPython.FloatText') class FloatText(_Float): + """ Displays a float value within a textbox. For a textbox in + which the value must be within a specific range, use BoundedFloatText. + + Parameters + ---------- + value : float + value displayed + description : str + description displayed next to the textbox + color : str Unicode color code (eg. '#C13535'), optional + color of the value displayed + """ _view_name = Unicode('FloatTextView', sync=True) @register('IPython.BoundedFloatText') class BoundedFloatText(_BoundedFloat): + """ Displays a float value within a textbox. Value must be within the range specified. + For a textbox in which the value doesn't need to be within a specific range, use FloatText. + + Parameters + ---------- + value : float + value displayed + min : float + minimal value of the range of possible values displayed + max : float + maximal value of the range of possible values displayed + description : str + description displayed next to the textbox + color : str Unicode color code (eg. '#C13535'), optional + color of the value displayed + """ _view_name = Unicode('FloatTextView', sync=True) @@ -60,7 +88,7 @@ class FloatSlider(_BoundedFloat): Parameters ---------- value : float - initial position of the slider + position of the slider min : float minimal position of the slider max : float @@ -73,6 +101,10 @@ class FloatSlider(_BoundedFloat): default is horizontal readout : {True, False}, optional default is True, display the current value of the slider next to it + slider_color : str Unicode color code (eg. '#C13535'), optional + color of the slider + color : str Unicode color code (eg. '#C13535'), optional + color of the value displayed (if readout == True) """ _view_name = Unicode('FloatSliderView', sync=True) @@ -86,12 +118,12 @@ class FloatSlider(_BoundedFloat): @register('IPython.FloatProgress') class FloatProgress(_BoundedFloat): - """ Progress bar. + """ Displays a progress bar. Parameters ----------- value : float - current position within the range of the progress bar + position within the range of the progress bar min : float minimal position of the slider max : float @@ -100,7 +132,9 @@ class FloatProgress(_BoundedFloat): step of the progress bar description : str name of the progress bar - + bar_style: {'success', 'info', 'warning', 'danger', ''}, optional + color of the progress bar, default is '' (blue) + colors are: 'success'-green, 'info'-light blue, 'warning'-orange, 'danger'-red """ _view_name = Unicode('ProgressView', sync=True) @@ -205,6 +239,30 @@ class _BoundedFloatRange(_FloatRange): @register('IPython.FloatRangeSlider') class FloatRangeSlider(_BoundedFloatRange): + """ Slider/trackbar for displaying a floating value range (within the specified range of values). + + Parameters + ---------- + value : float tuple + range of the slider displayed + min : float + minimal position of the slider + max : float + maximal position of the slider + step : float + step of the trackbar + description : str + name of the slider + orientation : {'vertical', 'horizontal}, optional + default is horizontal + readout : {True, False}, optional + default is True, display the current value of the slider next to it + slider_color : str Unicode color code (eg. '#C13535'), optional + color of the slider + color : str Unicode color code (eg. '#C13535'), optional + color of the value displayed (if readout == True) + + """ _view_name = Unicode('FloatSliderView', sync=True) orientation = CaselessStrEnum(values=['horizontal', 'vertical'], default_value='horizontal', allow_none=False, From a803717c5daa11f42bc9118022f2589e0d6a804d Mon Sep 17 00:00:00 2001 From: silviav12 Date: Mon, 1 Dec 2014 20:45:16 +0000 Subject: [PATCH 3/3] Removed the two empty lines of dosctring in widget_float.py. --- IPython/html/widgets/widget_float.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/IPython/html/widgets/widget_float.py b/IPython/html/widgets/widget_float.py index d60c8f4ab..eab4f6663 100644 --- a/IPython/html/widgets/widget_float.py +++ b/IPython/html/widgets/widget_float.py @@ -105,7 +105,6 @@ class FloatSlider(_BoundedFloat): color of the slider color : str Unicode color code (eg. '#C13535'), optional color of the value displayed (if readout == True) - """ _view_name = Unicode('FloatSliderView', sync=True) orientation = CaselessStrEnum(values=['horizontal', 'vertical'], @@ -261,7 +260,6 @@ class FloatRangeSlider(_BoundedFloatRange): color of the slider color : str Unicode color code (eg. '#C13535'), optional color of the value displayed (if readout == True) - """ _view_name = Unicode('FloatSliderView', sync=True) orientation = CaselessStrEnum(values=['horizontal', 'vertical'],