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
42907a5b
Commit
42907a5b
authored
Jun 04, 2015
by
Sumit Sahrawat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conform to the messaging spec
Still no visible outputs.
parent
67406e30
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
17 deletions
+16
-17
Button.hs
...y/ihaskell-widgets/src/IHaskell/Display/Widgets/Button.hs
+2
-8
Main.hs
main/Main.hs
+7
-4
Evaluate.hs
src/IHaskell/Eval/Evaluate.hs
+1
-1
Widgets.hs
src/IHaskell/Eval/Widgets.hs
+3
-2
Types.hs
src/IHaskell/Types.hs
+3
-2
No files found.
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Button.hs
View file @
42907a5b
...
...
@@ -44,19 +44,13 @@ mkButton = do
let
b
=
Button
uuid
desc
ttip
dis
sty
-- Open a comm for this widget, and store it in the kernel state
widgetSendOpen
b
$
toJSON
ButtonInitData
-- Initial state update
widgetSendUpdate
b
.
toJSON
.
UpdateState
.
toJSON
$
b
-- DEBUG: Try to display it too
widgetSendView
b
widgetSendOpen
b
(
toJSON
ButtonInitData
)
(
toJSON
b
)
-- Return the button widget
return
b
update
::
Button
->
[
Pair
]
->
IO
()
update
b
v
=
widgetSendUpdate
b
.
toJSON
.
UpdateState
.
object
$
v
update
b
v
=
widgetSendUpdate
b
.
toJSON
.
object
$
v
-- | Set the button style
setButtonStyle
::
ButtonStyle
->
Button
->
IO
()
...
...
main/Main.hs
View file @
42907a5b
...
...
@@ -294,7 +294,7 @@ replyTo interface req@ExecuteRequest { getCode = code } replyHeader state = do
else
sendOutput
$
Display
pager
handleMessage
::
KernelState
->
WidgetMsg
->
IO
KernelState
handleMessage
state
(
Open
widget
value
)
=
do
handleMessage
state
(
Open
widget
initVal
stateVal
)
=
do
-- Check whether the widget is already present in the state
let
oldComms
=
openComms
state
uuid
=
getCommUUID
widget
...
...
@@ -305,15 +305,18 @@ replyTo interface req@ExecuteRequest { getCode = code } replyHeader state = do
target
=
targetName
widget
communicate
val
ue
=
do
communicate
val
=
do
head
<-
dupHeader
replyHeader
CommDataMessage
writeChan
(
iopubChannel
interface
)
$
CommData
head
uuid
val
ue
writeChan
(
iopubChannel
interface
)
$
CommData
head
uuid
val
if
present
then
return
state
else
do
-- Send the comm open
header
<-
dupHeader
replyHeader
CommOpenMessage
send
$
CommOpen
header
target
uuid
value
send
$
CommOpen
header
target
uuid
initVal
-- Initial state update
communicate
.
toJSON
$
UpdateState
stateVal
-- Send anything else the widget requires.
open
widget
communicate
...
...
src/IHaskell/Eval/Evaluate.hs
View file @
42907a5b
...
...
@@ -918,7 +918,7 @@ evalCommand output (Expression expr) state = do
uuid
=
getCommUUID
widget
case
Map
.
lookup
uuid
oldComms
of
Nothing
->
error
"Unregistered widget"
Just
w
->
do
Just
_
->
do
liftIO
$
widgetSendView
widget
return
evalOut
...
...
src/IHaskell/Eval/Widgets.hs
View file @
42907a5b
...
...
@@ -41,8 +41,9 @@ widgetSend :: IHaskellWidget a
->
a
->
Value
->
IO
()
widgetSend
msgType
widget
value
=
queue
$
msgType
(
Widget
widget
)
value
widgetSendOpen
::
IHaskellWidget
a
=>
a
->
Value
->
IO
()
widgetSendOpen
=
widgetSend
Open
widgetSendOpen
::
IHaskellWidget
a
=>
a
->
Value
->
Value
->
IO
()
widgetSendOpen
widget
initVal
stateVal
=
queue
$
Open
(
Widget
widget
)
initVal
stateVal
widgetSendUpdate
::
IHaskellWidget
a
=>
a
->
Value
->
IO
()
widgetSendUpdate
=
widgetSend
Update
...
...
src/IHaskell/Types.hs
View file @
42907a5b
...
...
@@ -182,10 +182,11 @@ data LintStatus = LintOn
|
LintOff
deriving
(
Eq
,
Show
)
data
WidgetMsg
=
Open
Widget
Value
data
WidgetMsg
=
Open
Widget
Value
Value
-- ^ Cause the interpreter to open a new comm, and
-- register the associated widget in the
-- kernelState.
-- kernelState. Also sends a Value with comm_open,
-- and then sends an initial state update Value.
|
Update
Widget
Value
-- ^ Cause the interpreter to send a comm_msg
-- containing a state update for the widget.
...
...
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