Compare commits
11
Commits
d92722be9c
...
0.17.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93048d6053 | ||
|
|
d55f7b1f50 | ||
|
|
a5679cb1fc | ||
|
|
bdbf7daf4e | ||
|
|
e0efe2657f | ||
|
|
886cf0b243 | ||
|
|
251dc90cea | ||
|
|
17b3f9a03e | ||
|
|
01457dbe6f | ||
|
|
134787e1be | ||
|
|
284a8c6725 |
-40
@@ -1,40 +0,0 @@
|
||||
# This is the simple Travis configuration, which is intended for use
|
||||
# on applications which do not require cross-platform and
|
||||
# multiple-GHC-version support. For more information and other
|
||||
# options, see:
|
||||
#
|
||||
# https://docs.haskellstack.org/en/stable/travis_ci/
|
||||
#
|
||||
# Copy these contents into the root directory of your Github project in a file
|
||||
# named .travis.yml
|
||||
|
||||
# Choose a build environment
|
||||
dist: xenial
|
||||
|
||||
# Do not choose a language; we provide our own build tools.
|
||||
language: generic
|
||||
|
||||
# Caching so the next build will be fast too.
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.stack
|
||||
|
||||
# Ensure necessary system libraries are present
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libgmp-dev
|
||||
|
||||
before_install:
|
||||
# Download and unpack the stack executable
|
||||
- mkdir -p ~/.local/bin
|
||||
- export PATH=$HOME/.local/bin:$PATH
|
||||
- travis_retry curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
|
||||
|
||||
install:
|
||||
# Build dependencies
|
||||
- stack --no-terminal --install-ghc test --only-dependencies
|
||||
|
||||
script:
|
||||
# Build the package, its tests, and its docs and run the tests
|
||||
- stack --no-terminal test --haddock --no-haddock-deps
|
||||
+4
-1
@@ -1,6 +1,9 @@
|
||||
# Changelog for mtlstats
|
||||
|
||||
## current
|
||||
## 0.17.0.1
|
||||
- fixed autocapitalization
|
||||
|
||||
## 0.17.0
|
||||
- updated code to use brick instead of ncurses
|
||||
|
||||
## 0.16.1
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
name: mtlstats
|
||||
version: 0.16.1
|
||||
version: 0.17.0.1
|
||||
license: GPL-3.0-or-later
|
||||
author: "Jonathan Lamothe"
|
||||
maintainer: "jlamothe1980@gmail.com"
|
||||
|
||||
+2
-5
@@ -26,14 +26,13 @@ import Brick.Main (App (..), halt, showFirstCursor)
|
||||
import Brick.Types (BrickEvent (VtyEvent), Widget)
|
||||
import Brick.Util (on)
|
||||
import Brick.Widgets.Core (fill)
|
||||
import Control.Monad.State.Class (gets)
|
||||
import Graphics.Vty.Attributes.Color (blue, white)
|
||||
import Graphics.Vty.Input.Events
|
||||
( Event (EvKey)
|
||||
, Modifier (MCtrl)
|
||||
, Key (KChar)
|
||||
)
|
||||
import Lens.Micro (to)
|
||||
import Lens.Micro.Mtl (use)
|
||||
|
||||
import Mtlstats.Control
|
||||
import Mtlstats.Types
|
||||
@@ -57,10 +56,8 @@ draw s =
|
||||
handler :: Handler ()
|
||||
handler (VtyEvent (EvKey (KChar 'c') [MCtrl])) = halt
|
||||
handler e = do
|
||||
c <- use (to dispatch)
|
||||
c <- gets dispatch
|
||||
handleController c e
|
||||
|
||||
myAttrMap :: AttrMap
|
||||
myAttrMap = forceAttrMap (white `on` blue)
|
||||
|
||||
--jl
|
||||
|
||||
@@ -24,6 +24,7 @@ module Mtlstats.Control.CreateGoalie (createGoalieC) where
|
||||
import Brick.Widgets.Core (str)
|
||||
import Control.Monad.State.Class (gets, modify)
|
||||
import Lens.Micro ((^.), (.~), (?~), (%~), to)
|
||||
import Lens.Micro.Mtl ((.=))
|
||||
|
||||
import Mtlstats.Actions
|
||||
import Mtlstats.Format
|
||||
@@ -63,7 +64,7 @@ getActiveFlagC :: Controller
|
||||
getActiveFlagC = Controller
|
||||
{ drawController = const $ str "Is this goalie active? (Y/N)"
|
||||
, handleController = \e ->
|
||||
modify $ progMode.createGoalieStateL.cgsActiveFlag .~ ynHandler e
|
||||
progMode.createGoalieStateL.cgsActiveFlag .= ynHandler e
|
||||
}
|
||||
|
||||
confirmCreateGoalieC :: Controller
|
||||
|
||||
@@ -24,6 +24,7 @@ module Mtlstats.Control.CreatePlayer (createPlayerC) where
|
||||
import Brick.Widgets.Core (str)
|
||||
import Control.Monad.State.Class (gets, modify)
|
||||
import Lens.Micro ((^.), (.~), (?~), (%~), to)
|
||||
import Lens.Micro.Mtl ((.=), use)
|
||||
|
||||
import Mtlstats.Actions
|
||||
import Mtlstats.Format
|
||||
@@ -66,7 +67,7 @@ getActiveFlagC :: Controller
|
||||
getActiveFlagC = Controller
|
||||
{ drawController = const $ str "Is the player active? (Y/N)"
|
||||
, handleController = \e ->
|
||||
modify $ progMode.createPlayerStateL.cpsActiveFlag .~ ynHandler e
|
||||
progMode.createPlayerStateL.cpsActiveFlag .= ynHandler e
|
||||
}
|
||||
|
||||
confirmCreatePlayerC :: Controller
|
||||
@@ -84,7 +85,7 @@ confirmCreatePlayerC = Controller
|
||||
, "Create player: are you sure? (Y/N)"
|
||||
]
|
||||
, handleController = \e -> do
|
||||
cps <- gets (^.progMode.createPlayerStateL)
|
||||
cps <- use $ progMode.createPlayerStateL
|
||||
let
|
||||
success = cps^.cpsSuccessCallback
|
||||
failure = cps^.cpsFailureCallback
|
||||
|
||||
@@ -25,9 +25,10 @@ module Mtlstats.Control.EditGoalie (editGoalieC) where
|
||||
|
||||
import Brick.Types (Widget)
|
||||
import Brick.Widgets.Core (str, vBox)
|
||||
import Control.Monad.State.Class (gets, modify)
|
||||
import Control.Monad.State.Class (modify)
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Lens.Micro ((^.), (.~), (%~))
|
||||
import Lens.Micro ((^.))
|
||||
import Lens.Micro.Mtl ((.=), (%=), use)
|
||||
|
||||
import Mtlstats.Actions
|
||||
import Mtlstats.Handlers
|
||||
@@ -99,10 +100,10 @@ deleteC _ = Controller
|
||||
in str $ hdr ++ "Are you sure you want to delete this goalie? (Y/N)"
|
||||
, handleController = \e -> case ynHandler e of
|
||||
Just True -> do
|
||||
gets (^.progMode.editGoalieStateL.egsSelectedGoalie) >>= mapM_
|
||||
(\gid -> modify $ database.dbGoalies %~ dropNth gid)
|
||||
use (progMode.editGoalieStateL.egsSelectedGoalie) >>= mapM_
|
||||
(\gid -> database.dbGoalies %= dropNth gid)
|
||||
modify edit
|
||||
Just False -> modify $ progMode.editGoalieStateL.egsMode .~ EGMenu
|
||||
Just False -> progMode.editGoalieStateL.egsMode .= EGMenu
|
||||
Nothing -> return ()
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,10 @@ module Mtlstats.Control.EditPlayer (editPlayerC) where
|
||||
|
||||
import Brick.Types (Widget)
|
||||
import Brick.Widgets.Core (emptyWidget, str, vBox)
|
||||
import Control.Monad.State.Class (gets, modify)
|
||||
import Control.Monad.State.Class (modify)
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Lens.Micro ((^.), (.~), (%~))
|
||||
import Lens.Micro ((^.))
|
||||
import Lens.Micro.Mtl ((.=), (%=), use)
|
||||
|
||||
import Mtlstats.Actions
|
||||
import Mtlstats.Handlers
|
||||
@@ -90,10 +91,10 @@ deleteC _ = Controller
|
||||
in str $ hdr ++ "Are you sure you want to delete this player? (Y/N)"
|
||||
, handleController = \e -> case ynHandler e of
|
||||
Just True -> do
|
||||
gets (^.progMode.editPlayerStateL.epsSelectedPlayer) >>= mapM_
|
||||
(\pid -> modify $ database.dbPlayers %~ dropNth pid)
|
||||
use (progMode.editPlayerStateL.epsSelectedPlayer) >>= mapM_
|
||||
(\pid -> database.dbPlayers %= dropNth pid)
|
||||
modify edit
|
||||
Just False -> modify $ progMode.editPlayerStateL.epsMode .~ EPMenu
|
||||
Just False -> progMode.editPlayerStateL.epsMode .= EPMenu
|
||||
Nothing -> return ()
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
module Mtlstats.Control.EditStandings (editStandingsC) where
|
||||
|
||||
import Brick.Types (Widget)
|
||||
import Brick.Widgets.Core (str, vBox)
|
||||
import Brick.Widgets.Core (vBox)
|
||||
import Lens.Micro ((^.))
|
||||
|
||||
import Mtlstats.Format
|
||||
@@ -34,6 +34,7 @@ import Mtlstats.Prompt
|
||||
import Mtlstats.Prompt.EditStandings
|
||||
import Mtlstats.Types
|
||||
import Mtlstats.Types.Menu
|
||||
import Mtlstats.Util
|
||||
|
||||
-- | Controller for the edit standings menu
|
||||
editStandingsC :: EditStandingsMode -> Controller
|
||||
@@ -75,7 +76,10 @@ header s w = let
|
||||
[ ( "HOME", valsFor home )
|
||||
, ( "ROAD", valsFor away )
|
||||
]
|
||||
in vBox $ map str (table ++ [""]) ++ [w]
|
||||
in vBox
|
||||
[ linesToWidget $ table ++ [""]
|
||||
, w
|
||||
]
|
||||
|
||||
valsFor :: GameStats -> [Int]
|
||||
valsFor gs =
|
||||
|
||||
@@ -37,7 +37,7 @@ import Graphics.Vty.Input.Events
|
||||
, Key (KDown, KHome, KEnter, KUp)
|
||||
)
|
||||
import Lens.Micro ((^.), (.~))
|
||||
import Lens.Micro.Mtl (use)
|
||||
import Lens.Micro.Mtl ((.=), use)
|
||||
|
||||
import Mtlstats.Actions
|
||||
import Mtlstats.Actions.NewGame
|
||||
@@ -96,14 +96,14 @@ overtimeFlagC = Controller
|
||||
{ drawController = \s -> header s $
|
||||
str "Did the game go into overtime? (Y/N)"
|
||||
, handleController = \e ->
|
||||
modify $ progMode.gameStateL.overtimeFlag .~ ynHandler e
|
||||
progMode.gameStateL.overtimeFlag .= ynHandler e
|
||||
}
|
||||
|
||||
verifyDataC :: Controller
|
||||
verifyDataC = Controller
|
||||
{ drawController = \s -> let
|
||||
gs = s^.progMode.gameStateL
|
||||
in header s $ vBox $ map str $
|
||||
in header s $ linesToWidget $
|
||||
[""] ++
|
||||
labelTable
|
||||
[ ( "Date", gameDate gs )
|
||||
@@ -172,7 +172,7 @@ confirmGoalDataC = Controller
|
||||
[ ""
|
||||
, "Is the above information correct? (Y/N)"
|
||||
]
|
||||
in vBox $ map str msg
|
||||
in linesToWidget msg
|
||||
, handleController = \e -> do
|
||||
case ynHandler e of
|
||||
Just True -> modify recordGoalAssists
|
||||
@@ -201,7 +201,7 @@ getPMinsC = Controller
|
||||
|
||||
reportC :: Controller
|
||||
reportC = Controller
|
||||
{ drawController = viewport () Vertical . hCenter . vBox . map str .
|
||||
{ drawController = viewport () Vertical . hCenter . linesToWidget .
|
||||
displayReport reportCols
|
||||
, handleController = \e -> do
|
||||
scr <- use scroller
|
||||
@@ -239,8 +239,11 @@ monthHeader s w = let
|
||||
, "NOVEMBER"
|
||||
, "DECEMBER"
|
||||
]
|
||||
in header s $ vBox $ map (hCenter . str)
|
||||
(["MONTH:", ""] ++ table ++ [""]) ++ [w]
|
||||
in header s $ vBox
|
||||
[ linesToWidgetC $
|
||||
["MONTH:", ""] ++ table ++ [""]
|
||||
, w
|
||||
]
|
||||
|
||||
gameGoal :: ProgState -> (Int, Int)
|
||||
gameGoal s =
|
||||
|
||||
@@ -47,7 +47,7 @@ titleScreenC = Controller
|
||||
]
|
||||
, handleController = \case
|
||||
VtyEvent (EvKey _ _) -> modify backHome
|
||||
_ -> return ()
|
||||
_ -> return ()
|
||||
}
|
||||
|
||||
titleText :: [String]
|
||||
|
||||
@@ -27,7 +27,7 @@ import Graphics.Vty.Input.Events (Event (EvKey), Key (KChar))
|
||||
|
||||
-- | Handler for a yes/no prompt
|
||||
ynHandler :: BrickEvent () () -> Maybe Bool
|
||||
ynHandler (VtyEvent (EvKey (KChar c) _)) = case toUpper c of
|
||||
ynHandler (VtyEvent (EvKey (KChar c) [])) = case toUpper c of
|
||||
'Y' -> Just True
|
||||
'N' -> Just False
|
||||
_ -> Nothing
|
||||
|
||||
@@ -77,9 +77,9 @@ promptHandler p (VtyEvent (EvKey KEnter [])) = do
|
||||
editorW %= clearEditor
|
||||
promptAction p val
|
||||
promptHandler p (VtyEvent (EvKey (KChar c) [])) =
|
||||
modify $ editorW %~ promptProcessChar p c
|
||||
editorW %= promptProcessChar p c
|
||||
promptHandler _ (VtyEvent (EvKey KBS [])) =
|
||||
modify (editorW.editContentsL %~ deletePrevChar)
|
||||
editorW.editContentsL %= deletePrevChar
|
||||
promptHandler p (VtyEvent (EvKey k m)) =
|
||||
promptSpecialKey p k m
|
||||
promptHandler _ _ = return ()
|
||||
@@ -127,7 +127,7 @@ ucStrPrompt
|
||||
-- ^ The callback function for the result
|
||||
-> Prompt
|
||||
ucStrPrompt pStr act = (strPrompt pStr act)
|
||||
{ promptProcessChar = \ch -> editContentsL %~ insertChar ch }
|
||||
{ promptProcessChar = \ch -> editContentsL %~ insertChar (toUpper ch) }
|
||||
|
||||
-- | Creates a prompt which forces capitalization of input to
|
||||
-- accomodate a player or goalie name
|
||||
@@ -243,7 +243,7 @@ selectPrompt params = Prompt
|
||||
results = spSearch params sStr db
|
||||
when (n < maxFunKeys) $
|
||||
whenJust (nth n results) $ \(sel, _) -> do
|
||||
modify $ editorW %~ clearEditor
|
||||
editorW %= clearEditor
|
||||
spCallback params $ Just sel
|
||||
_ -> return ()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user