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
027f74aa
Unverified
Commit
027f74aa
authored
Nov 17, 2018
by
Vaibhav Sagar
Committed by
GitHub
Nov 17, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #967 from Shimuuar/update_display
Implement update_display_data message
parents
fd5cbf34
301df38e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
8 deletions
+42
-8
EasyKernel.hs
ipython-kernel/src/IHaskell/IPython/EasyKernel.hs
+2
-1
Parser.hs
ipython-kernel/src/IHaskell/IPython/Message/Parser.hs
+1
-1
Types.hs
ipython-kernel/src/IHaskell/IPython/Types.hs
+37
-4
Widgets.hs
src/IHaskell/Eval/Widgets.hs
+1
-1
Publish.hs
src/IHaskell/Publish.hs
+1
-1
No files found.
ipython-kernel/src/IHaskell/IPython/EasyKernel.hs
View file @
027f74aa
...
...
@@ -195,8 +195,9 @@ replyTo config execCount interface req@ExecuteRequest{} replyHeader = do
send
$
PublishDisplayData
outputHeader
(
displayOutput
config
x
)
Nothing
in
run
config
(
getCode
req
)
clearOutput
sendOutput
liftIO
.
send
$
PublishDisplayData
outputHeader
(
displayResult
config
res
)
liftIO
.
send
$
PublishDisplayData
outputHeader
(
displayResult
config
res
)
Nothing
idleHeader
<-
dupHeader
replyHeader
StatusMessage
...
...
ipython-kernel/src/IHaskell/IPython/Message/Parser.hs
View file @
027f74aa
...
...
@@ -168,7 +168,7 @@ displayDataParser :: LByteString -> Message
displayDataParser
=
requestParser
$
\
obj
->
do
dataDict
::
Object
<-
obj
.:
"data"
let
displayDatas
=
makeDisplayDatas
dataDict
return
$
PublishDisplayData
noHeader
displayDatas
return
$
PublishDisplayData
noHeader
displayDatas
Nothing
requestParser
::
FromJSON
a
=>
(
a
->
Parser
Message
)
->
LByteString
->
Message
requestParser
parser
content
=
...
...
ipython-kernel/src/IHaskell/IPython/Types.hs
View file @
027f74aa
...
...
@@ -16,6 +16,7 @@ module IHaskell.IPython.Types (
Message
(
..
),
MessageHeader
(
..
),
Username
,
Transient
(
..
),
MessageType
(
..
),
CodeReview
(
..
),
Width
,
...
...
@@ -184,6 +185,7 @@ data MessageType = KernelInfoReplyMessage
|
StatusMessage
|
StreamMessage
|
DisplayDataMessage
|
UpdateDisplayDataMessage
|
OutputMessage
|
InputMessage
|
IsCompleteRequestMessage
...
...
@@ -217,6 +219,7 @@ showMessageType ExecuteResultMessage = "execute_result"
showMessageType
StatusMessage
=
"status"
showMessageType
StreamMessage
=
"stream"
showMessageType
DisplayDataMessage
=
"display_data"
showMessageType
UpdateDisplayDataMessage
=
"update_display_data"
showMessageType
OutputMessage
=
"pyout"
showMessageType
InputMessage
=
"pyin"
showMessageType
IsCompleteRequestMessage
=
"is_complete_request"
...
...
@@ -251,6 +254,7 @@ instance FromJSON MessageType where
"status"
->
return
StatusMessage
"stream"
->
return
StreamMessage
"display_data"
->
return
DisplayDataMessage
"update_display_data"
->
return
UpdateDisplayDataMessage
"pyout"
->
return
OutputMessage
"pyin"
->
return
InputMessage
"is_complete_request"
->
return
IsCompleteRequestMessage
...
...
@@ -301,6 +305,16 @@ data CodeReview = CodeComplete
|
CodeUnknown
deriving
Show
newtype
Transient
=
Transient
{
transientDisplayId
::
UUID
}
deriving
(
Show
,
Eq
)
instance
ToJSON
Transient
where
toJSON
t
=
object
[
"display_id"
.=
transientDisplayId
t
]
-- | A message used to communicate with the IPython frontend.
data
Message
=
-- | A request from a frontend for information about the kernel.
...
...
@@ -384,6 +398,13 @@ data Message =
PublishDisplayData
{
header
::
MessageHeader
,
displayData
::
[
DisplayData
]
-- ^ A list of data representations.
,
transient
::
Maybe
Transient
}
|
PublishUpdateDisplayData
{
header
::
MessageHeader
,
displayData
::
[
DisplayData
]
-- ^ A list of data representations.
,
transient
::
Maybe
Transient
}
|
PublishOutput
...
...
@@ -544,10 +565,22 @@ instance ToJSON Message where
object
[
"execution_state"
.=
executionState
]
toJSON
PublishStream
{
streamType
=
streamType
,
streamContent
=
content
}
=
object
[
"data"
.=
content
,
"name"
.=
streamType
]
toJSON
PublishDisplayData
{
displayData
=
datas
}
=
object
[
"metadata"
.=
object
[]
,
"data"
.=
object
(
map
displayDataToJson
datas
)]
toJSON
r
@
PublishDisplayData
{
displayData
=
datas
}
=
object
$
case
transient
r
of
Just
t
->
((
"transient"
.=
toJSON
(
transient
r
))
:
)
Nothing
->
id
$
[
"metadata"
.=
object
[]
,
"data"
.=
object
(
map
displayDataToJson
datas
)
]
toJSON
r
@
PublishUpdateDisplayData
{
displayData
=
datas
}
=
object
$
case
transient
r
of
Just
t
->
((
"transient"
.=
toJSON
(
transient
r
))
:
)
Nothing
->
id
$
[
"metadata"
.=
object
[]
,
"data"
.=
object
(
map
displayDataToJson
datas
)
]
toJSON
PublishOutput
{
executionCount
=
execCount
,
reprText
=
reprText
}
=
object
[
"data"
.=
object
[
"text/plain"
.=
reprText
]
...
...
src/IHaskell/Eval/Widgets.hs
View file @
027f74aa
...
...
@@ -171,7 +171,7 @@ data WidgetDisplay = WidgetDisplay MessageHeader [DisplayData]
instance
ToJSON
WidgetDisplay
where
toJSON
(
WidgetDisplay
replyHeader
ddata
)
=
let
pbval
=
toJSON
$
PublishDisplayData
replyHeader
ddata
let
pbval
=
toJSON
$
PublishDisplayData
replyHeader
ddata
Nothing
in
toJSON
$
IPythonMessage
replyHeader
pbval
DisplayDataMessage
-- Override toJSON for ClearOutput
...
...
src/IHaskell/Publish.hs
View file @
027f74aa
...
...
@@ -67,7 +67,7 @@ publishResult send replyHeader displayed updateNeeded poutput upager result = do
sendOutput
(
ManyDisplay
manyOuts
)
=
mapM_
sendOutput
manyOuts
sendOutput
(
Display
outs
)
=
do
hdr
<-
dupHeader
replyHeader
DisplayDataMessage
send
$
PublishDisplayData
hdr
$
map
(
convertSvgToHtml
.
prependCss
)
outs
send
$
PublishDisplayData
hdr
(
map
(
convertSvgToHtml
.
prependCss
)
outs
)
Nothing
convertSvgToHtml
(
DisplayData
MimeSvg
s
)
=
html
$
makeSvgImg
$
base64
$
E
.
encodeUtf8
s
convertSvgToHtml
x
=
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