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
cb13bfcc
Commit
cb13bfcc
authored
Jul 12, 2021
by
David Davó
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Numeric float widgets
parent
3f363ac8
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
82 additions
and
4 deletions
+82
-4
ihaskell-widgets.cabal
ihaskell-display/ihaskell-widgets/ihaskell-widgets.cabal
+1
-0
Widgets.hs
...-display/ihaskell-widgets/src/IHaskell/Display/Widgets.hs
+1
-0
Common.hs
...y/ihaskell-widgets/src/IHaskell/Display/Widgets/Common.hs
+1
-0
BoundedFloatText.hs
...ll/Display/Widgets/Float/BoundedFloat/BoundedFloatText.hs
+1
-1
FloatLogSlider.hs
...kell/Display/Widgets/Float/BoundedFloat/FloatLogSlider.hs
+66
-0
FloatProgress.hs
...skell/Display/Widgets/Float/BoundedFloat/FloatProgress.hs
+1
-1
FloatRangeSlider.hs
...splay/Widgets/Float/BoundedFloatRange/FloatRangeSlider.hs
+1
-1
BoundedIntText.hs
...IHaskell/Display/Widgets/Int/BoundedInt/BoundedIntText.hs
+1
-1
Singletons.hs
...askell-widgets/src/IHaskell/Display/Widgets/Singletons.hs
+1
-0
Types.hs
...ay/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
+8
-0
No files found.
ihaskell-display/ihaskell-widgets/ihaskell-widgets.cabal
View file @
cb13bfcc
...
...
@@ -76,6 +76,7 @@ library
IHaskell.Display.Widgets.Float.BoundedFloat.BoundedFloatText
IHaskell.Display.Widgets.Float.BoundedFloat.FloatProgress
IHaskell.Display.Widgets.Float.BoundedFloat.FloatSlider
IHaskell.Display.Widgets.Float.BoundedFloat.FloatLogSlider
IHaskell.Display.Widgets.Float.BoundedFloatRange.FloatRangeSlider
IHaskell.Display.Widgets.Image
IHaskell.Display.Widgets.Output
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets.hs
View file @
cb13bfcc
...
...
@@ -20,6 +20,7 @@ import IHaskell.Display.Widgets.Float.FloatText as X
import
IHaskell.Display.Widgets.Float.BoundedFloat.BoundedFloatText
as
X
import
IHaskell.Display.Widgets.Float.BoundedFloat.FloatProgress
as
X
import
IHaskell.Display.Widgets.Float.BoundedFloat.FloatSlider
as
X
import
IHaskell.Display.Widgets.Float.BoundedFloat.FloatLogSlider
as
X
import
IHaskell.Display.Widgets.Float.BoundedFloatRange.FloatRangeSlider
as
X
import
IHaskell.Display.Widgets.Image
as
X
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Common.hs
View file @
cb13bfcc
...
...
@@ -82,6 +82,7 @@ pattern FloatPairValue = S.SFloatPairValue
pattern
LowerFloat
=
S
.
SLowerFloat
pattern
UpperFloat
=
S
.
SUpperFloat
pattern
Orientation
=
S
.
SOrientation
pattern
BaseFloat
=
S
.
SBaseFloat
pattern
ShowRange
=
S
.
SShowRange
pattern
ReadOut
=
S
.
SReadOut
pattern
SliderColor
=
S
.
SSliderColor
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Float/BoundedFloat/BoundedFloatText.hs
View file @
cb13bfcc
...
...
@@ -36,7 +36,7 @@ mkBoundedFloatText = do
-- Default properties, with a random uuid
wid
<-
U
.
random
let
widgetState
=
WidgetState
$
defaultBoundedFloatWidget
"FloatTextView"
"FloatTextModel"
let
widgetState
=
WidgetState
$
defaultBoundedFloatWidget
"FloatTextView"
"
Bounded
FloatTextModel"
stateIO
<-
newIORef
widgetState
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Float/BoundedFloat/FloatLogSlider.hs
0 → 100644
View file @
cb13bfcc
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module
IHaskell.Display.Widgets.Float.BoundedFloat.FloatLogSlider
(
-- * The FloatSlider Widget
FloatLogSlider
-- * Constructor
,
mkFloatLogSlider
)
where
-- To keep `cabal repl` happy when running from the ihaskell repo
import
Prelude
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
import
IHaskell.IPython.Message.UUID
as
U
import
IHaskell.Display.Widgets.Types
import
IHaskell.Display.Widgets.Common
-- | 'FloatLogSlider' represents an FloatLogSlider widget from IPython.html.widgets.
type
FloatLogSlider
=
IPythonWidget
'F
l
oatLogSliderType
-- | Create a new widget
mkFloatLogSlider
::
IO
FloatLogSlider
mkFloatLogSlider
=
do
-- Default properties, with a random uuid
wid
<-
U
.
random
let
boundedFloatAttrs
=
defaultBoundedFloatWidget
"FloatLogSliderView"
"FloatLogSliderModel"
sliderAttrs
=
(
Orientation
=::
HorizontalOrientation
)
:&
(
ShowRange
=::
False
)
:&
(
ReadOut
=::
True
)
:&
(
SliderColor
=::
""
)
:&
(
BaseFloat
=::
10.0
)
:&
RNil
widgetState
=
WidgetState
$
boundedFloatAttrs
<+>
sliderAttrs
stateIO
<-
newIORef
widgetState
let
widget
=
IPythonWidget
wid
stateIO
-- Open a comm for this widget, and store it in the kernel state
widgetSendOpen
widget
$
toJSON
widgetState
-- Return the widget
return
widget
instance
IHaskellWidget
FloatLogSlider
where
getCommUUID
=
uuid
comm
widget
val
_
=
case
nestedObjectLookup
val
[
"state"
,
"value"
]
of
Just
(
Number
value
)
->
do
void
$
setField'
widget
FloatValue
(
Sci
.
toRealFloat
value
)
triggerChange
widget
_
->
pure
()
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Float/BoundedFloat/FloatProgress.hs
View file @
cb13bfcc
...
...
@@ -35,7 +35,7 @@ mkFloatProgress = do
-- Default properties, with a random uuid
wid
<-
U
.
random
let
boundedFloatAttrs
=
defaultBoundedFloatWidget
"ProgressView"
"ProgressModel"
let
boundedFloatAttrs
=
defaultBoundedFloatWidget
"ProgressView"
"
Float
ProgressModel"
progressAttrs
=
(
Orientation
=::
HorizontalOrientation
)
:&
(
BarStyle
=::
DefaultBar
)
:&
RNil
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Float/BoundedFloatRange/FloatRangeSlider.hs
View file @
cb13bfcc
...
...
@@ -38,7 +38,7 @@ mkFloatRangeSlider = do
-- Default properties, with a random uuid
wid
<-
U
.
random
let
boundedFloatAttrs
=
defaultBoundedFloatRangeWidget
"Float
SliderView"
"Float
SliderModel"
let
boundedFloatAttrs
=
defaultBoundedFloatRangeWidget
"Float
RangeSliderView"
"FloatRange
SliderModel"
sliderAttrs
=
(
Orientation
=::
HorizontalOrientation
)
:&
(
ShowRange
=::
True
)
:&
(
ReadOut
=::
True
)
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Int/BoundedInt/BoundedIntText.hs
View file @
cb13bfcc
...
...
@@ -36,7 +36,7 @@ mkBoundedIntText = do
-- Default properties, with a random uuid
wid
<-
U
.
random
let
widgetState
=
WidgetState
$
defaultBoundedIntWidget
"IntTextView"
"IntTextModel"
let
widgetState
=
WidgetState
$
defaultBoundedIntWidget
"IntTextView"
"
Bounded
IntTextModel"
stateIO
<-
newIORef
widgetState
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Singletons.hs
View file @
cb13bfcc
...
...
@@ -88,6 +88,7 @@ singletons
| LowerFloat
| UpperFloat
| Orientation
| BaseFloat
| ShowRange
| ReadOut
| SliderColor
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
View file @
cb13bfcc
...
...
@@ -215,6 +215,7 @@ type family FieldType (f :: Field) :: * where
FieldType
'S
.
UpperInt
=
Integer
FieldType
'S
.
IntPairValue
=
(
Integer
,
Integer
)
FieldType
'S
.
Orientation
=
OrientationValue
FieldType
'S
.
BaseFloat
=
Double
FieldType
'S
.
ShowRange
=
Bool
FieldType
'S
.
ReadOut
=
Bool
FieldType
'S
.
SliderColor
=
Text
...
...
@@ -289,6 +290,7 @@ data WidgetType = ButtonType
|
FloatTextType
|
BoundedFloatTextType
|
FloatSliderType
|
FloatLogSliderType
|
FloatProgressType
|
FloatRangeSliderType
|
BoxType
...
...
@@ -341,6 +343,9 @@ type family WidgetFields (w :: WidgetType) :: [Field] where
WidgetFields
'F
l
oatSliderType
=
BoundedFloatClass
:++
[
'S
.
Orientation
,
'S
.
ShowRange
,
'S
.
ReadOut
,
'S
.
SliderColor
]
WidgetFields
'F
l
oatLogSliderType
=
BoundedFloatClass
:++
[
'S
.
Orientation
,
'S
.
ShowRange
,
'S
.
ReadOut
,
'S
.
SliderColor
,
'S
.
BaseFloat
]
WidgetFields
'F
l
oatProgressType
=
BoundedFloatClass
:++
[
'S
.
Orientation
,
'S
.
BarStyle
]
WidgetFields
'F
l
oatRangeSliderType
=
...
...
@@ -557,6 +562,9 @@ instance ToPairs (Attr 'S.UpperFloat) where
instance
ToPairs
(
Attr
'S
.
Orientation
)
where
toPairs
x
=
[
"orientation"
.=
toJSON
x
]
instance
ToPairs
(
Attr
'S
.
BaseFloat
)
where
toPairs
x
=
[
"base"
.=
toJSON
x
]
instance
ToPairs
(
Attr
'S
.
ShowRange
)
where
toPairs
x
=
[
"_range"
.=
toJSON
x
]
...
...
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