6
6
# Copyright (c) Jupyter Development Team.
7
7
# Distributed under the terms of the Modified BSD License.
8
8
9
+ from traitlets import (
10
+ Instance , Unicode , CFloat , Bool , CaselessStrEnum , Tuple , TraitError , validate , default
11
+ )
9
12
from .domwidget import LabeledWidget
13
+ from .trait_types import InstanceDict
10
14
from .valuewidget import ValueWidget
11
15
from .widget import register , widget_serialization
12
16
from .widget_core import CoreWidget
13
- from .trait_types import Color
14
- from .widget_int import ProgressStyle
15
- from traitlets import (
16
- Instance , Unicode , CFloat , Bool , Int , CaselessStrEnum , Tuple , TraitError , validate , default
17
- )
17
+ from .widget_int import ProgressStyle , SliderStyle
18
18
19
19
20
20
class _Float (LabeledWidget , ValueWidget , CoreWidget ):
@@ -75,8 +75,6 @@ class FloatText(_Float):
75
75
value displayed
76
76
description : str
77
77
description displayed next to the text box
78
- color : str Unicode color code (eg. '#C13535')
79
- color of the value displayed
80
78
"""
81
79
_view_name = Unicode ('FloatTextView' ).tag (sync = True )
82
80
_model_name = Unicode ('FloatTextModel' ).tag (sync = True )
@@ -98,8 +96,6 @@ class BoundedFloatText(_BoundedFloat):
98
96
maximal value of the range of possible values displayed
99
97
description : str
100
98
description displayed next to the textbox
101
- color : str Unicode color code (eg. '#C13535')
102
- color of the value displayed
103
99
"""
104
100
_view_name = Unicode ('FloatTextView' ).tag (sync = True )
105
101
_model_name = Unicode ('FloatTextModel' ).tag (sync = True )
@@ -129,10 +125,6 @@ class FloatSlider(_BoundedFloat):
129
125
default is '.2f', specifier for the format function used to represent
130
126
slider value for human consumption, modeled after Python 3's format
131
127
specification mini-language (PEP 3101).
132
- slider_color : str Unicode color code (eg. '#C13535')
133
- color of the slider
134
- color : str Unicode color code (eg. '#C13535')
135
- color of the value displayed (if readout == True)
136
128
"""
137
129
_view_name = Unicode ('FloatSliderView' ).tag (sync = True )
138
130
_model_name = Unicode ('FloatSliderModel' ).tag (sync = True )
@@ -141,9 +133,10 @@ class FloatSlider(_BoundedFloat):
141
133
_range = Bool (False , help = "Display a range selector" ).tag (sync = True )
142
134
readout = Bool (True , help = "Display the current value of the slider next to it." ).tag (sync = True )
143
135
readout_format = Unicode ('.2f' , help = "Format for the readout" ).tag (sync = True )
144
- slider_color = Color (None , allow_none = True ).tag (sync = True )
145
136
continuous_update = Bool (True , help = "Update the value of the widget as the user is holding the slider." ).tag (sync = True )
146
137
138
+ style = InstanceDict (SliderStyle ).tag (sync = True , ** widget_serialization )
139
+
147
140
148
141
@register
149
142
class FloatProgress (_BoundedFloat ):
@@ -177,11 +170,7 @@ class FloatProgress(_BoundedFloat):
177
170
default_value = '' , allow_none = True ,
178
171
help = "Use a predefined styling for the progess bar." ).tag (sync = True )
179
172
180
- style = Instance (ProgressStyle ).tag (sync = True , ** widget_serialization )
181
-
182
- @default ('style' )
183
- def _default_style (self ):
184
- return ProgressStyle ()
173
+ style = InstanceDict (ProgressStyle ).tag (sync = True , ** widget_serialization )
185
174
186
175
187
176
class _FloatRange (_Float ):
@@ -270,16 +259,14 @@ class FloatRangeSlider(_BoundedFloatRange):
270
259
default is '.2f', specifier for the format function used to represent
271
260
slider value for human consumption, modeled after Python 3's format
272
261
specification mini-language (PEP 3101).
273
- slider_color : str Unicode color code (eg. '#C13535')
274
- color of the slider
275
- color : str Unicode color code (eg. '#C13535')
276
- color of the value displayed (if readout == True)
277
262
"""
278
263
_view_name = Unicode ('FloatSliderView' ).tag (sync = True )
279
264
_model_name = Unicode ('FloatSliderModel' ).tag (sync = True )
280
265
orientation = CaselessStrEnum (values = ['horizontal' , 'vertical' ],
281
266
default_value = 'horizontal' , help = "Vertical or horizontal." ).tag (sync = True )
282
267
_range = Bool (True , help = "Display a range selector" ).tag (sync = True )
283
268
readout = Bool (True , help = "Display the current value of the slider next to it." ).tag (sync = True )
284
- slider_color = Color ( None , allow_none = True ).tag (sync = True )
269
+ readout_format = Unicode ( '.2f' , help = "Format for the readout" ).tag (sync = True )
285
270
continuous_update = Bool (True , help = "Update the value of the widget as the user is sliding the slider." ).tag (sync = True )
271
+
272
+ style = InstanceDict (SliderStyle ).tag (sync = True , ** widget_serialization )
0 commit comments