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
e68fbb8e
Commit
e68fbb8e
authored
Jun 23, 2015
by
Sumit Sahrawat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reformat with hindent
parent
8f3f18c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
16 deletions
+8
-16
Common.hs
...y/ihaskell-widgets/src/IHaskell/Display/Widgets/Common.hs
+4
-7
Image.hs
...ay/ihaskell-widgets/src/IHaskell/Display/Widgets/Image.hs
+4
-9
No files found.
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Common.hs
View file @
e68fbb8e
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedStrings #-}
module
IHaskell.Display.Widgets.Common
(
module
IHaskell.Display.Widgets.Common
(
ButtonStyle
(
..
),
ImageFormat
(
..
))
where
-- * Predefined button styles
ButtonStyle
(
..
),
-- * Image formats
ImageFormat
(
..
),
)
where
import
Data.Aeson
(
ToJSON
(
..
))
import
Data.Aeson
(
ToJSON
(
..
))
import
qualified
Data.Text
as
T
import
qualified
Data.Text
as
T
...
@@ -28,7 +23,9 @@ instance ToJSON ButtonStyle where
...
@@ -28,7 +23,9 @@ instance ToJSON ButtonStyle where
toJSON
None
=
""
toJSON
None
=
""
-- | Image formats for ImageWidget
-- | Image formats for ImageWidget
data
ImageFormat
=
PNG
|
SVG
|
JPG
data
ImageFormat
=
PNG
|
SVG
|
JPG
deriving
Eq
deriving
Eq
instance
Show
ImageFormat
where
instance
Show
ImageFormat
where
...
...
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Image.hs
View file @
e68fbb8e
...
@@ -50,8 +50,9 @@ data ImageWidget =
...
@@ -50,8 +50,9 @@ data ImageWidget =
newtype
ImageInt
=
ImageInt
{
unwrap
::
Int
}
newtype
ImageInt
=
ImageInt
{
unwrap
::
Int
}
instance
ToJSON
ImageInt
where
instance
ToJSON
ImageInt
where
toJSON
(
ImageInt
n
)
|
n
>
0
=
toJSON
$
str
$
show
n
toJSON
(
ImageInt
n
)
|
otherwise
=
toJSON
$
str
$
""
|
n
>
0
=
toJSON
$
str
$
show
n
|
otherwise
=
toJSON
$
str
$
""
-- | Create a new image widget
-- | Create a new image widget
mkImageWidget
::
IO
ImageWidget
mkImageWidget
::
IO
ImageWidget
...
@@ -64,13 +65,7 @@ mkImageWidget = do
...
@@ -64,13 +65,7 @@ mkImageWidget = do
val
<-
newIORef
""
val
<-
newIORef
""
let
initData
=
object
[
"model_name"
.=
str
"WidgetModel"
,
"widget_class"
.=
str
"IPython.Image"
]
let
initData
=
object
[
"model_name"
.=
str
"WidgetModel"
,
"widget_class"
.=
str
"IPython.Image"
]
b
=
ImageWidget
b
=
ImageWidget
{
uuid
=
commUUID
,
format
=
fmt
,
height
=
hgt
,
width
=
wdt
,
b64value
=
val
}
{
uuid
=
commUUID
,
format
=
fmt
,
height
=
hgt
,
width
=
wdt
,
b64value
=
val
}
-- Open a comm for this widget, and store it in the kernel state
-- Open a comm for this widget, and store it in the kernel state
widgetSendOpen
b
initData
(
toJSON
b
)
widgetSendOpen
b
initData
(
toJSON
b
)
...
...
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