Commit 6a226ce3 authored by Sumit Sahrawat's avatar Sumit Sahrawat

Sync-ing with ipywidgets changes

parent f61ab434
...@@ -38,7 +38,9 @@ mkFloatProgress = do ...@@ -38,7 +38,9 @@ mkFloatProgress = do
uuid <- U.random uuid <- U.random
let boundedFloatAttrs = defaultBoundedFloatWidget "ProgressView" let boundedFloatAttrs = defaultBoundedFloatWidget "ProgressView"
progressAttrs = (BarStyle =:: DefaultBar) :& RNil progressAttrs = (Orientation =:: HorizontalOrientation)
:& (BarStyle =:: DefaultBar)
:& RNil
widgetState = WidgetState $ boundedFloatAttrs <+> progressAttrs widgetState = WidgetState $ boundedFloatAttrs <+> progressAttrs
stateIO <- newIORef widgetState stateIO <- newIORef widgetState
......
...@@ -38,6 +38,8 @@ mkImageWidget = do ...@@ -38,6 +38,8 @@ mkImageWidget = do
let dom = defaultDOMWidget "ImageView" let dom = defaultDOMWidget "ImageView"
img = (ImageFormat =:: PNG) img = (ImageFormat =:: PNG)
:& (Width =:+ 0)
:& (Height =:+ 0)
:& (B64Value =:: mempty) :& (B64Value =:: mempty)
:& RNil :& RNil
widgetState = WidgetState (dom <+> img) widgetState = WidgetState (dom <+> img)
......
...@@ -38,7 +38,9 @@ mkIntProgress = do ...@@ -38,7 +38,9 @@ mkIntProgress = do
uuid <- U.random uuid <- U.random
let boundedIntAttrs = defaultBoundedIntWidget "ProgressView" let boundedIntAttrs = defaultBoundedIntWidget "ProgressView"
progressAttrs = (BarStyle =:: DefaultBar) :& RNil progressAttrs = (Orientation =:: HorizontalOrientation)
:& (BarStyle =:: DefaultBar)
:& RNil
widgetState = WidgetState $ boundedIntAttrs <+> progressAttrs widgetState = WidgetState $ boundedIntAttrs <+> progressAttrs
stateIO <- newIORef widgetState stateIO <- newIORef widgetState
......
...@@ -239,6 +239,7 @@ data WidgetType = ButtonType ...@@ -239,6 +239,7 @@ data WidgetType = ButtonType
| TextAreaType | TextAreaType
| CheckBoxType | CheckBoxType
| ToggleButtonType | ToggleButtonType
-- TODO: Add 'Valid' widget
| DropdownType | DropdownType
| RadioButtonsType | RadioButtonsType
| SelectType | SelectType
...@@ -254,6 +255,7 @@ data WidgetType = ButtonType ...@@ -254,6 +255,7 @@ data WidgetType = ButtonType
| FloatSliderType | FloatSliderType
| FloatProgressType | FloatProgressType
| FloatRangeSliderType | FloatRangeSliderType
-- TODO: Add Proxy and PlaceProxy
| BoxType | BoxType
| FlexBoxType | FlexBoxType
| AccordionType | AccordionType
...@@ -267,7 +269,7 @@ type family WidgetFields (w :: WidgetType) :: [Field] where ...@@ -267,7 +269,7 @@ type family WidgetFields (w :: WidgetType) :: [Field] where
'[S.Description, S.Tooltip, S.Disabled, S.Icon, S.ButtonStyle, '[S.Description, S.Tooltip, S.Disabled, S.Icon, S.ButtonStyle,
S.ClickHandler] S.ClickHandler]
WidgetFields ImageType = WidgetFields ImageType =
DOMWidgetClass :++ '[S.ImageFormat, S.B64Value] DOMWidgetClass :++ '[S.ImageFormat, S.Width, S.Height, S.B64Value]
WidgetFields OutputType = DOMWidgetClass WidgetFields OutputType = DOMWidgetClass
WidgetFields HTMLType = StringClass WidgetFields HTMLType = StringClass
WidgetFields LatexType = StringClass WidgetFields LatexType = StringClass
...@@ -288,7 +290,7 @@ type family WidgetFields (w :: WidgetType) :: [Field] where ...@@ -288,7 +290,7 @@ type family WidgetFields (w :: WidgetType) :: [Field] where
WidgetFields IntSliderType = WidgetFields IntSliderType =
BoundedIntClass :++ BoundedIntClass :++
'[S.Orientation, S.ShowRange, S.ReadOut, S.SliderColor] '[S.Orientation, S.ShowRange, S.ReadOut, S.SliderColor]
WidgetFields IntProgressType = BoundedIntClass :++ '[S.BarStyle] WidgetFields IntProgressType = BoundedIntClass :++ '[S.Orientation, S.BarStyle]
WidgetFields IntRangeSliderType = WidgetFields IntRangeSliderType =
BoundedIntRangeClass :++ BoundedIntRangeClass :++
'[S.Orientation, S.ShowRange, S.ReadOut, S.SliderColor] '[S.Orientation, S.ShowRange, S.ReadOut, S.SliderColor]
...@@ -298,7 +300,7 @@ type family WidgetFields (w :: WidgetType) :: [Field] where ...@@ -298,7 +300,7 @@ type family WidgetFields (w :: WidgetType) :: [Field] where
BoundedFloatClass :++ BoundedFloatClass :++
'[S.Orientation, S.ShowRange, S.ReadOut, S.SliderColor] '[S.Orientation, S.ShowRange, S.ReadOut, S.SliderColor]
WidgetFields FloatProgressType = WidgetFields FloatProgressType =
BoundedFloatClass :++ '[S.BarStyle] BoundedFloatClass :++ '[S.Orientation, S.BarStyle]
WidgetFields FloatRangeSliderType = WidgetFields FloatRangeSliderType =
BoundedFloatRangeClass :++ BoundedFloatRangeClass :++
'[S.Orientation, S.ShowRange, S.ReadOut, S.SliderColor] '[S.Orientation, S.ShowRange, S.ReadOut, S.SliderColor]
...@@ -666,8 +668,8 @@ defaultMultipleSelectionWidget :: FieldType S.ViewName -> Rec Attr MultipleSelec ...@@ -666,8 +668,8 @@ defaultMultipleSelectionWidget :: FieldType S.ViewName -> Rec Attr MultipleSelec
defaultMultipleSelectionWidget viewName = defaultDOMWidget viewName <+> mulSelAttrs defaultMultipleSelectionWidget viewName = defaultDOMWidget viewName <+> mulSelAttrs
where where
mulSelAttrs = (Options =:: OptionLabels []) mulSelAttrs = (Options =:: OptionLabels [])
:& (SelectedLabels =:: [])
:& (SelectedValues =:: []) :& (SelectedValues =:: [])
:& (SelectedLabels =:: [])
:& (Disabled =:: False) :& (Disabled =:: False)
:& (Description =:: "") :& (Description =:: "")
:& (SelectionHandler =:: return ()) :& (SelectionHandler =:: return ())
...@@ -749,8 +751,10 @@ defaultBoundedFloatRangeWidget viewName = defaultFloatRangeWidget viewName <+> b ...@@ -749,8 +751,10 @@ defaultBoundedFloatRangeWidget viewName = defaultFloatRangeWidget viewName <+> b
-- | A record representing a widget of the _Box class from IPython -- | A record representing a widget of the _Box class from IPython
defaultBoxWidget :: FieldType S.ViewName -> Rec Attr BoxClass defaultBoxWidget :: FieldType S.ViewName -> Rec Attr BoxClass
defaultBoxWidget viewName = defaultDOMWidget viewName <+> boxAttrs defaultBoxWidget viewName = domAttrs <+> boxAttrs
where where
defaultDOM = defaultDOMWidget viewName
domAttrs = rput (ModelName =:: "BoxModel") defaultDOM
boxAttrs = (Children =:: []) boxAttrs = (Children =:: [])
:& (OverflowX =:: DefaultOverflow) :& (OverflowX =:: DefaultOverflow)
:& (OverflowY =:: DefaultOverflow) :& (OverflowY =:: DefaultOverflow)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment