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
7e20685c
Commit
7e20685c
authored
Jul 13, 2021
by
David Davó
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Selection Sliders widgets
parent
3af85932
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
1 deletion
+131
-1
ihaskell-widgets.cabal
ihaskell-display/ihaskell-widgets/ihaskell-widgets.cabal
+2
-0
Widgets.hs
...-display/ihaskell-widgets/src/IHaskell/Display/Widgets.hs
+2
-0
SelectionRangeSlider.hs
...Haskell/Display/Widgets/Selection/SelectionRangeSlider.hs
+62
-0
SelectionSlider.hs
...src/IHaskell/Display/Widgets/Selection/SelectionSlider.hs
+60
-0
HTMLMath.hs
...l-widgets/src/IHaskell/Display/Widgets/String/HTMLMath.hs
+1
-1
Types.hs
...ay/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
+4
-0
No files found.
ihaskell-display/ihaskell-widgets/ihaskell-widgets.cabal
View file @
7e20685c
...
@@ -83,6 +83,8 @@ library
...
@@ -83,6 +83,8 @@ library
IHaskell.Display.Widgets.Selection.Dropdown
IHaskell.Display.Widgets.Selection.Dropdown
IHaskell.Display.Widgets.Selection.RadioButtons
IHaskell.Display.Widgets.Selection.RadioButtons
IHaskell.Display.Widgets.Selection.Select
IHaskell.Display.Widgets.Selection.Select
IHaskell.Display.Widgets.Selection.SelectionSlider
IHaskell.Display.Widgets.Selection.SelectionRangeSlider
IHaskell.Display.Widgets.Selection.ToggleButtons
IHaskell.Display.Widgets.Selection.ToggleButtons
IHaskell.Display.Widgets.Selection.SelectMultiple
IHaskell.Display.Widgets.Selection.SelectMultiple
IHaskell.Display.Widgets.String.HTML
IHaskell.Display.Widgets.String.HTML
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets.hs
View file @
7e20685c
...
@@ -30,6 +30,8 @@ import IHaskell.Display.Widgets.Output as X
...
@@ -30,6 +30,8 @@ import IHaskell.Display.Widgets.Output as X
import
IHaskell.Display.Widgets.Selection.Dropdown
as
X
import
IHaskell.Display.Widgets.Selection.Dropdown
as
X
import
IHaskell.Display.Widgets.Selection.RadioButtons
as
X
import
IHaskell.Display.Widgets.Selection.RadioButtons
as
X
import
IHaskell.Display.Widgets.Selection.Select
as
X
import
IHaskell.Display.Widgets.Selection.Select
as
X
import
IHaskell.Display.Widgets.Selection.SelectionSlider
as
X
import
IHaskell.Display.Widgets.Selection.SelectionRangeSlider
as
X
import
IHaskell.Display.Widgets.Selection.ToggleButtons
as
X
import
IHaskell.Display.Widgets.Selection.ToggleButtons
as
X
import
IHaskell.Display.Widgets.Selection.SelectMultiple
as
X
import
IHaskell.Display.Widgets.Selection.SelectMultiple
as
X
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/SelectionRangeSlider.hs
0 → 100644
View file @
7e20685c
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module
IHaskell.Display.Widgets.Selection.SelectionRangeSlider
(
-- * The SelectionRangeSlider Widget
SelectionRangeSlider
-- * Constructor
,
mkSelectionRangeSlider
)
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
qualified
Data.Vector
as
V
import
Data.Vinyl
(
Rec
(
..
),
(
<+>
),
rput
)
import
IHaskell.Display
import
IHaskell.Eval.Widgets
import
IHaskell.IPython.Message.UUID
as
U
import
IHaskell.Display.Widgets.Types
import
IHaskell.Display.Widgets.Common
-- | A 'SelectionRangeSlider' represents a SelectionSlider widget from IPyhon.widgets
type
SelectionRangeSlider
=
IPythonWidget
'S
e
lectionRangeSliderType
-- | Create a new SelectionRangeSlider widget
mkSelectionRangeSlider
::
IO
SelectionRangeSlider
mkSelectionRangeSlider
=
do
wid
<-
U
.
random
let
selectionAttrs
=
defaultMultipleSelectionWidget
"SelectionRangeSliderView"
"SelectionRangeSliderModel"
widgetState
=
WidgetState
$
rput
(
Indices
=::
[
0
,
0
])
$
selectionAttrs
<+>
(
Orientation
=::
HorizontalOrientation
)
:&
RNil
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 created widget
return
widget
instance
IHaskellWidget
SelectionRangeSlider
where
getCommUUID
=
uuid
comm
widget
val
_
=
case
nestedObjectLookup
val
[
"state"
,
"index"
]
of
Just
(
Array
indices
)
->
do
let
indicesList
=
map
(
\
(
Number
x
)
->
Sci
.
coefficient
x
)
$
V
.
toList
indices
void
$
setField'
widget
Indices
indicesList
triggerSelection
widget
_
->
pure
()
\ No newline at end of file
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Selection/SelectionSlider.hs
0 → 100644
View file @
7e20685c
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module
IHaskell.Display.Widgets.Selection.SelectionSlider
(
-- * The SelectionSlider Widget
SelectionSlider
-- * Constructor
,
mkSelectionSlider
)
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
-- | A 'SelectionSlider' represents a SelectionSlider widget from IPyhon.widgets
type
SelectionSlider
=
IPythonWidget
'S
e
lectionSliderType
-- | Create a new SelectionSLider widget
mkSelectionSlider
::
IO
SelectionSlider
mkSelectionSlider
=
do
wid
<-
U
.
random
let
selectionAttrs
=
defaultSelectionWidget
"SelectionSliderView"
"SelectionSliderModel"
widgetState
=
WidgetState
$
selectionAttrs
<+>
(
Orientation
=::
HorizontalOrientation
)
:&
RNil
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 created widget
return
widget
instance
IHaskellWidget
SelectionSlider
where
getCommUUID
=
uuid
comm
widget
val
_
=
case
nestedObjectLookup
val
[
"state"
,
"index"
]
of
Just
(
Number
index
)
->
do
void
$
setField'
widget
Index
(
Sci
.
coefficient
index
)
triggerSelection
widget
_
->
pure
()
\ No newline at end of file
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/String/HTMLMath.hs
View file @
7e20685c
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module
IHaskell.Display.Widgets.String.HTMLMath
module
IHaskell.Display.Widgets.String.HTMLMath
(
-- * The HTML Widget
(
-- * The HTML
Math
Widget
HTMLMathWidget
HTMLMathWidget
-- * Constructor
-- * Constructor
,
mkHTMLMathWidget
,
mkHTMLMathWidget
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Types.hs
View file @
7e20685c
...
@@ -281,6 +281,8 @@ data WidgetType = ButtonType
...
@@ -281,6 +281,8 @@ data WidgetType = ButtonType
|
DropdownType
|
DropdownType
|
RadioButtonsType
|
RadioButtonsType
|
SelectType
|
SelectType
|
SelectionSliderType
|
SelectionRangeSliderType
|
ToggleButtonsType
|
ToggleButtonsType
|
SelectMultipleType
|
SelectMultipleType
|
IntTextType
|
IntTextType
...
@@ -327,6 +329,8 @@ type family WidgetFields (w :: WidgetType) :: [Field] where
...
@@ -327,6 +329,8 @@ type family WidgetFields (w :: WidgetType) :: [Field] where
WidgetFields
'D
r
opdownType
=
SelectionClass
:++
'[
'S
.
ButtonStyle
]
WidgetFields
'D
r
opdownType
=
SelectionClass
:++
'[
'S
.
ButtonStyle
]
WidgetFields
'R
a
dioButtonsType
=
SelectionClass
WidgetFields
'R
a
dioButtonsType
=
SelectionClass
WidgetFields
'S
e
lectType
=
SelectionClass
WidgetFields
'S
e
lectType
=
SelectionClass
WidgetFields
'S
e
lectionSliderType
=
SelectionClass
:++
'[
'S
.
Orientation
]
WidgetFields
'S
e
lectionRangeSliderType
=
MultipleSelectionClass
:++
'[
'S
.
Orientation
]
WidgetFields
'T
o
ggleButtonsType
=
WidgetFields
'T
o
ggleButtonsType
=
SelectionClass
:++
[
'S
.
Tooltips
,
'S
.
Icons
,
'S
.
ButtonStyle
]
SelectionClass
:++
[
'S
.
Tooltips
,
'S
.
Icons
,
'S
.
ButtonStyle
]
WidgetFields
'S
e
lectMultipleType
=
MultipleSelectionClass
WidgetFields
'S
e
lectMultipleType
=
MultipleSelectionClass
...
...
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