Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
gargantext-ihaskell
Commits
792ac0ef
Commit
792ac0ef
authored
Jul 14, 2021
by
David Davó
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Numeric Widgets example
parent
7e20685c
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
263 additions
and
56 deletions
+263
-56
Numeric Widgets.ipynb
...l-display/ihaskell-widgets/Examples/Numeric Widgets.ipynb
+238
-49
README.md
ihaskell-display/ihaskell-widgets/README.md
+9
-0
FloatLogSlider.hs
...kell/Display/Widgets/Float/BoundedFloat/FloatLogSlider.hs
+3
-2
FloatText.hs
...l-widgets/src/IHaskell/Display/Widgets/Float/FloatText.hs
+5
-1
IntText.hs
...skell-widgets/src/IHaskell/Display/Widgets/Int/IntText.hs
+5
-1
Types.hs
...ay/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
+3
-3
No files found.
ihaskell-display/ihaskell-widgets/Examples/Numeric Widgets.ipynb
View file @
792ac0ef
This diff is collapsed.
Click to expand it.
ihaskell-display/ihaskell-widgets/README.md
View file @
792ac0ef
...
...
@@ -5,3 +5,12 @@ IHaskell. The frontend (javascript) is provided by the jupyter/ipython notebook
the backend is implemented in haskell.
To know more about the widget messaging protocol, see
[
MsgSpec.md
](
MsgSpec.md
)
.
## Contributing examples
If you want to contribute with more Notebook examples, please do so on the
`Examples/`
folder. Before commiting, please make sure they can be executed sequentialy and
then remove the output from the Nootebooks with:
```
bash
jupyter nbconvert
*
.ipynb
--to
notebook
--inplace
--clear-output
```
\ No newline at end of file
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Float/BoundedFloat/FloatLogSlider.hs
View file @
792ac0ef
...
...
@@ -19,7 +19,7 @@ import Control.Monad (void)
import
Data.Aeson
import
Data.IORef
(
newIORef
)
import
qualified
Data.Scientific
as
Sci
import
Data.Vinyl
(
Rec
(
..
),
(
<+>
))
import
Data.Vinyl
(
Rec
(
..
),
(
<+>
)
,
rput
)
import
IHaskell.Display
import
IHaskell.Eval.Widgets
...
...
@@ -44,7 +44,8 @@ mkFloatLogSlider = do
:&
(
SliderColor
=::
""
)
:&
(
BaseFloat
=::
10.0
)
:&
RNil
widgetState
=
WidgetState
$
boundedFloatAttrs
<+>
sliderAttrs
widgetState
=
WidgetState
$
rput
(
MaxFloat
=::
4.0
)
$
boundedFloatAttrs
<+>
sliderAttrs
stateIO
<-
newIORef
widgetState
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Float/FloatText.hs
View file @
792ac0ef
...
...
@@ -19,6 +19,7 @@ import Control.Monad (void)
import
Data.Aeson
import
Data.IORef
(
newIORef
)
import
qualified
Data.Scientific
as
Sci
import
Data.Vinyl
(
Rec
(
..
),
(
<+>
))
import
IHaskell.Display
import
IHaskell.Eval.Widgets
...
...
@@ -36,7 +37,10 @@ mkFloatText = do
-- Default properties, with a random uuid
wid
<-
U
.
random
let
widgetState
=
WidgetState
$
defaultFloatWidget
"FloatTextView"
"FloatTextModel"
let
floatAttrs
=
defaultFloatWidget
"FloatTextView"
"FloatTextModel"
textAttrs
=
(
StepFloat
=:+
0.1
)
:&
RNil
widgetState
=
WidgetState
$
floatAttrs
<+>
textAttrs
stateIO
<-
newIORef
widgetState
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Int/IntText.hs
View file @
792ac0ef
...
...
@@ -19,6 +19,7 @@ import Control.Monad (void)
import
Data.Aeson
import
Data.IORef
(
newIORef
)
import
qualified
Data.Scientific
as
Sci
import
Data.Vinyl
(
Rec
(
..
),
(
<+>
))
import
IHaskell.Display
import
IHaskell.Eval.Widgets
...
...
@@ -36,7 +37,10 @@ mkIntText = do
-- Default properties, with a random uuid
wid
<-
U
.
random
let
widgetState
=
WidgetState
$
defaultIntWidget
"IntTextView"
"IntTextModel"
let
intAttrs
=
defaultIntWidget
"IntTextView"
"IntTextModel"
textAttrs
=
(
StepInt
=:+
1
)
:&
RNil
widgetState
=
WidgetState
$
intAttrs
<+>
textAttrs
stateIO
<-
newIORef
widgetState
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
View file @
792ac0ef
...
...
@@ -334,7 +334,7 @@ type family WidgetFields (w :: WidgetType) :: [Field] where
WidgetFields
'T
o
ggleButtonsType
=
SelectionClass
:++
[
'S
.
Tooltips
,
'S
.
Icons
,
'S
.
ButtonStyle
]
WidgetFields
'S
e
lectMultipleType
=
MultipleSelectionClass
WidgetFields
'I
n
tTextType
=
IntClass
WidgetFields
'I
n
tTextType
=
IntClass
:++
'[
'S
.
StepInt
]
WidgetFields
'B
o
undedIntTextType
=
BoundedIntClass
WidgetFields
'I
n
tSliderType
=
BoundedIntClass
:++
...
...
@@ -344,7 +344,7 @@ type family WidgetFields (w :: WidgetType) :: [Field] where
WidgetFields
'I
n
tRangeSliderType
=
BoundedIntRangeClass
:++
[
'S
.
Orientation
,
'S
.
ShowRange
,
'S
.
ReadOut
,
'S
.
SliderColor
]
WidgetFields
'F
l
oatTextType
=
FloatClass
WidgetFields
'F
l
oatTextType
=
FloatClass
:++
'[
'S
.
StepFloat
]
WidgetFields
'B
o
undedFloatTextType
=
BoundedFloatClass
WidgetFields
'F
l
oatSliderType
=
BoundedFloatClass
:++
...
...
@@ -784,7 +784,7 @@ defaultFloatWidget viewName modelName = defaultDOMWidget viewName modelName <+>
defaultBoundedFloatWidget
::
FieldType
'S
.
ViewName
->
FieldType
'S
.
ModelName
->
Rec
Attr
BoundedFloatClass
defaultBoundedFloatWidget
viewName
modelName
=
defaultFloatWidget
viewName
modelName
<+>
boundedFloatAttrs
where
boundedFloatAttrs
=
(
StepFloat
=:+
1
)
boundedFloatAttrs
=
(
StepFloat
=:+
0.
1
)
:&
(
MinFloat
=::
0
)
:&
(
MaxFloat
=::
100
)
:&
RNil
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment