mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-19 12:56:08 +00:00
Reformat with hindent
This commit is contained in:
parent
8f3f18c5e1
commit
e68fbb8ec3
@ -1,11 +1,6 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module IHaskell.Display.Widgets.Common (
|
||||
-- * Predefined button styles
|
||||
ButtonStyle(..),
|
||||
-- * Image formats
|
||||
ImageFormat(..),
|
||||
) where
|
||||
module IHaskell.Display.Widgets.Common (ButtonStyle(..), ImageFormat(..)) where
|
||||
|
||||
import Data.Aeson (ToJSON(..))
|
||||
import qualified Data.Text as T
|
||||
@ -28,7 +23,9 @@ instance ToJSON ButtonStyle where
|
||||
toJSON None = ""
|
||||
|
||||
-- | Image formats for ImageWidget
|
||||
data ImageFormat = PNG | SVG | JPG
|
||||
data ImageFormat = PNG
|
||||
| SVG
|
||||
| JPG
|
||||
deriving Eq
|
||||
|
||||
instance Show ImageFormat where
|
||||
|
@ -50,8 +50,9 @@ data ImageWidget =
|
||||
newtype ImageInt = ImageInt { unwrap :: Int }
|
||||
|
||||
instance ToJSON ImageInt where
|
||||
toJSON (ImageInt n) | n > 0 = toJSON $ str $ show n
|
||||
| otherwise = toJSON $ str $ ""
|
||||
toJSON (ImageInt n)
|
||||
| n > 0 = toJSON $ str $ show n
|
||||
| otherwise = toJSON $ str $ ""
|
||||
|
||||
-- | Create a new image widget
|
||||
mkImageWidget :: IO ImageWidget
|
||||
@ -64,13 +65,7 @@ mkImageWidget = do
|
||||
val <- newIORef ""
|
||||
|
||||
let initData = object ["model_name" .= str "WidgetModel", "widget_class" .= str "IPython.Image"]
|
||||
b = ImageWidget
|
||||
{ uuid = commUUID
|
||||
, format = fmt
|
||||
, height = hgt
|
||||
, width = wdt
|
||||
, b64value = val
|
||||
}
|
||||
b = ImageWidget { uuid = commUUID, format = fmt, height = hgt, width = wdt, b64value = val }
|
||||
|
||||
-- Open a comm for this widget, and store it in the kernel state
|
||||
widgetSendOpen b initData (toJSON b)
|
||||
|
Loading…
x
Reference in New Issue
Block a user