Test basic brick setup
This commit is contained in:
parent
9a956785ef
commit
9cf9e889f5
3 changed files with 46 additions and 6 deletions
45
app/Main.hs
45
app/Main.hs
|
|
@ -1,8 +1,47 @@
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import qualified Database.SQLite.Simple as DB
|
--import qualified Database.SQLite.Simple as DB
|
||||||
|
--import qualified TaskMachine.Database as TMD
|
||||||
|
--main = DB.withConnection "test.db" TMD.initializeNewDB
|
||||||
|
|
||||||
import qualified TaskMachine.Database as TMB
|
import Control.Monad
|
||||||
|
import Data.Monoid
|
||||||
|
|
||||||
|
import qualified Brick as B
|
||||||
|
import qualified Graphics.Vty as VTY
|
||||||
|
|
||||||
|
myAttrMap :: B.AttrMap
|
||||||
|
myAttrMap = B.attrMap VTY.defAttr
|
||||||
|
[ ("taskList" <> "normal", withStyle VTY.bold $ B.fg VTY.cyan)
|
||||||
|
, ("taskList" <> "highlight", withStyle VTY.bold $ B.bg VTY.cyan)
|
||||||
|
, ("taskList" <> "urgent" <> "normal", withStyle VTY.bold $ B.fg VTY.yellow)
|
||||||
|
, ("taskList" <> "urgent" <> "highlight", withStyle VTY.bold $ B.bg VTY.yellow)
|
||||||
|
, ("taskList" <> "veryUrgent" <> "normal", withStyle VTY.bold $ B.fg VTY.red)
|
||||||
|
, ("taskList" <> "veryUrgent" <> "highlight", withStyle VTY.bold $ B.bg VTY.red)
|
||||||
|
, ("taskList" <> "overdue" <> "normal", withStyle VTY.bold $ B.fg VTY.magenta)
|
||||||
|
, ("taskList" <> "overdue" <> "highlight", withStyle VTY.bold $ B.bg VTY.magenta)
|
||||||
|
]
|
||||||
|
where withStyle = flip VTY.withStyle
|
||||||
|
|
||||||
|
data ResourceName = Asdf
|
||||||
|
deriving (Eq, Ord)
|
||||||
|
|
||||||
|
myApp :: B.App () () ResourceName
|
||||||
|
myApp = B.App
|
||||||
|
{ B.appDraw = \_ -> [myTestWidget]
|
||||||
|
, B.appHandleEvent = B.resizeOrQuit
|
||||||
|
, B.appStartEvent = \s -> return s
|
||||||
|
, B.appChooseCursor = B.neverShowCursor
|
||||||
|
, B.appAttrMap = \_ -> myAttrMap
|
||||||
|
}
|
||||||
|
where
|
||||||
|
myTestWidget = normal B.<=> urgent B.<=> veryUrgent B.<=> overdue
|
||||||
|
normal = B.withAttr ("taskList" <> "normal") (B.str " normal ") B.<+> B.withAttr ("taskList" <> "highlight") (B.str "style")
|
||||||
|
urgent = B.withAttr ("taskList" <> "urgent" <> "normal") (B.str " urgent ") B.<+> B.withAttr ("taskList" <> "urgent" <> "highlight") (B.str "style")
|
||||||
|
veryUrgent = B.withAttr ("taskList" <> "veryUrgent" <> "normal") (B.str "very urgent ") B.<+> B.withAttr ("taskList" <> "veryUrgent" <> "highlight") (B.str "style")
|
||||||
|
overdue = B.withAttr ("taskList" <> "overdue" <> "normal") (B.str " overdue ") B.<+> B.withAttr ("taskList" <> "overdue" <> "highlight") (B.str "style")
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = DB.withConnection "test.db" TMB.initializeNewDB
|
main = void $ B.defaultMain myApp ()
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ description: Please see the README on Github at <https://github.com/Garm
|
||||||
dependencies:
|
dependencies:
|
||||||
- base >= 4.7 && < 5
|
- base >= 4.7 && < 5
|
||||||
- sqlite-simple
|
- sqlite-simple
|
||||||
|
- brick
|
||||||
|
- vty
|
||||||
#- containers
|
#- containers
|
||||||
#- unordered-containers
|
#- unordered-containers
|
||||||
#- text
|
#- text
|
||||||
|
|
@ -32,7 +34,6 @@ dependencies:
|
||||||
#- bytestring
|
#- bytestring
|
||||||
#- stm
|
#- stm
|
||||||
#- megaparsec
|
#- megaparsec
|
||||||
#- brick
|
|
||||||
|
|
||||||
library:
|
library:
|
||||||
source-dirs: src
|
source-dirs: src
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
# resolver:
|
# resolver:
|
||||||
# name: custom-snapshot
|
# name: custom-snapshot
|
||||||
# location: "./custom-snapshot.yaml"
|
# location: "./custom-snapshot.yaml"
|
||||||
resolver: lts-10.9
|
resolver: lts-11.0
|
||||||
|
|
||||||
# User packages to be built.
|
# User packages to be built.
|
||||||
# Various formats can be used as shown in the example below.
|
# Various formats can be used as shown in the example below.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue