itemfield 1.1.0.2 → 1.2.0.0
raw patch · 7 files changed
+25/−24 lines, 7 filesdep ~basedep ~microlensdep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, microlens, text, vty
API changes (from Hackage documentation)
- TextUI.ItemField: CaVa :: ItemState
- TextUI.ItemField: itemCaVaAttr :: AttrName
+ TextUI.ItemField: Pending :: ItemState
+ TextUI.ItemField: itemPendingAttr :: AttrName
Files
- examples/bookcase.hs +3/−3
- examples/workreport.hs +5/−5
- itemfield.cabal +5/−3
- src/TextUI/ItemField.hs +2/−2
- src/TextUI/ItemField/Attrs.hs +4/−5
- src/TextUI/ItemField/Layout.hs +5/−5
- src/TextUI/ItemField/Types.hs +1/−1
examples/bookcase.hs view
@@ -63,7 +63,7 @@ bookstate s = case s of Good -> "read by you" Bad -> "missing or damaged"- CaVa -> "on loan"+ Pending -> "on loan" _ -> "" @@ -101,7 +101,7 @@ where bkVtyEvent (EvResize _ _) = continue s bkVtyEvent (EvKey (KChar 'r') []) = continue =<< handleEventLensed s shelves (setBooks Good) e- bkVtyEvent (EvKey (KChar 'l') []) = continue =<< handleEventLensed s shelves (setBooks CaVa) e+ bkVtyEvent (EvKey (KChar 'l') []) = continue =<< handleEventLensed s shelves (setBooks Pending) e bkVtyEvent (EvKey (KChar 'm') []) = continue =<< handleEventLensed s shelves (setBooks Bad) e bkVtyEvent (EvKey (KChar 'Q') []) = halt s bkVtyEvent (EvKey (KChar 'q') []) = halt s@@ -123,7 +123,7 @@ summary s = showNum s <> " " <> bookstate s putStrLn $ "Final bookcase state: " <> intercalate ", " [ (show $ length st8s) <> " books"- , summary Good, summary CaVa, summary Bad+ , summary Good, summary Pending, summary Bad ] where app = App { appDraw = showBookcase , appHandleEvent = bookEvent
examples/workreport.hs view
@@ -57,7 +57,7 @@ workerstate s = case s of Good -> "done" Bad -> "error"- CaVa -> "delayed"+ Pending -> "delayed" _ -> "" -- KWQ: add a mapper that will map through and provide index, state, and [groups]@@ -70,7 +70,7 @@ showNum = show . flip numSt8 st8s summary s = showNum s <> " " <> workerstate s in intercalate ", " [ show (length st8s) <> " workers"- , summary Good, summary CaVa, summary Bad+ , summary Good, summary Pending, summary Bad ] @@ -102,7 +102,7 @@ workVtyEvt (EvResize _ _) = continue s workVtyEvt (EvKey (KChar 'r') []) = runWork s -- workVtyEvt e@(EvKey (KChar 'r') []) = continue =<< handleEventLensed s workers (runWork (s^. e- -- workVtyEvt e@(EvKey (KChar 'l') []) = continue =<< handleEventLensed s shelves (setBooks CaVa) e+ -- workVtyEvt e@(EvKey (KChar 'l') []) = continue =<< handleEventLensed s shelves (setBooks Pending) e -- workVtyEvt e@(EvKey (KChar 'm') []) = continue =<< handleEventLensed s shelves (setBooks Bad) e workVtyEvt (EvKey (KChar 'Q') []) = halt s workVtyEvt (EvKey (KChar 'q') []) = halt s@@ -137,9 +137,9 @@ doWork reportChan myId = do r <- randomRIO (100000,3000000) threadDelay r- s <- ([Good, Bad, CaVa] !!) <$> randomRIO (0,2)+ s <- ([Good, Bad, Pending] !!) <$> randomRIO (0,2) writeChan reportChan $ WorkerFinished myId s- when (s == CaVa) $ doWork reportChan myId+ when (s == Pending) $ doWork reportChan myId -- KWQ: workers can report their total time taken and result, which can be displayed in a separate widget -- KWQ: with brick viewport scrolling, is itemMoreMessageAttr and associated even used?
itemfield.cabal view
@@ -1,5 +1,5 @@ name: itemfield-version: 1.1.0.2+version: 1.2.0.0 synopsis: A brick Widget for selectable summary of many elements on a terminal description: @@ -16,7 +16,7 @@ . * 0.2.0.0 -- more key events: Shift+Arrow to mark/unmark with move .- * 0.2.0.1 -- more key events: G=mrk/unm group, A=mrk/unm all, !=mrk bad; add helpMsg+ * 0.2.0.1 -- more key events: G=toggle group, A=toggle all, !=mrk bad; add helpMsg . * 0.3.0.0 -- rename from StateFieldSelector to ItemField .@@ -25,7 +25,9 @@ * 1.0.0.0 -- update from vty-ui to brick . * 1.1.0.0 -- add support for 's' and 'f' keys and mouse events- + .+ * 1.2.0.0 -- intermediary state is "Pending"+ license: BSD3 license-file: LICENSE author: Kevin Quick <quick@sparq.org>
src/TextUI/ItemField.hs view
@@ -30,7 +30,7 @@ Marked * itemMarkedAttr Good + itemGoodAttr Bad ! itemBadAttr- Pending ~ itemCaVaAttr+ Pending ~ itemPendingAttr @ See below for the definitions of these and other attributes that can@@ -210,7 +210,7 @@ -- set marks based on existing state KChar '+' -> setMark Marked fieldw $ allWithState Good KChar '!' -> setMark Marked fieldw $ allWithState Bad- KChar '~' -> setMark Marked fieldw $ allWithState CaVa+ KChar '~' -> setMark Marked fieldw $ allWithState Pending KChar 's' -> return $ onFldWidget clrItm markItem $ allWithState Good KChar 'f' -> return $ onFldWidget clrItm markItem $ allWithState Bad _ -> return fieldw
src/TextUI/ItemField/Attrs.hs view
@@ -40,10 +40,9 @@ itemBadAttr :: AttrName itemBadAttr = itemFieldAttr <> attrName "itemBad" --- | The 'itemCaVaAttr' indicates an item that is in the CaVa state--- ("ca va" is French for "OK" or "so-so").-itemCaVaAttr :: AttrName-itemCaVaAttr = itemFieldAttr <> attrName "itemModerate"+-- | The 'itemPendingAttr' indicates an item that is in the Pending state+itemPendingAttr :: AttrName+itemPendingAttr = itemFieldAttr <> attrName "itemModerate" -- | The 'itemBlankAttr' is an interstitial attribute marker for -- portions of the ItemField that are to be left blank@@ -94,7 +93,7 @@ itemDefaultAttrs :: [ (AttrName, Attr) ] itemDefaultAttrs = [ (itemGoodAttr, black `on` green `withStyle` bold) , (itemBadAttr, black `on` red)- , (itemCaVaAttr, black `on` yellow)+ , (itemPendingAttr, black `on` yellow) , (itemMoreMessageAttr, currentAttr `withStyle` reverseVideo) , (itemHeaderAttr, currentAttr `withStyle` underline) ]
src/TextUI/ItemField/Layout.hs view
@@ -61,11 +61,11 @@ ssRep :: ItemState -> (T.Text, Brick.AttrMap.AttrName)-ssRep Free = (T.singleton '.', itemFreeAttr)-ssRep Marked = (T.singleton '*', itemMarkedAttr)-ssRep Good = (T.singleton '+', itemGoodAttr)-ssRep Bad = (T.singleton '!', itemBadAttr)-ssRep CaVa = (T.singleton '~', itemCaVaAttr)+ssRep Free = (T.singleton '.', itemFreeAttr)+ssRep Marked = (T.singleton '*', itemMarkedAttr)+ssRep Good = (T.singleton '+', itemGoodAttr)+ssRep Bad = (T.singleton '!', itemBadAttr)+ssRep Pending = (T.singleton '~', itemPendingAttr) groupSepText :: T.Text groupSepText = T.singleton ' '
src/TextUI/ItemField/Types.hs view
@@ -6,7 +6,7 @@ type GroupName = T.Text type NumItems = Int data Items = ItemGroup GroupName Items | Items NumItems deriving Show-data ItemState = Free | Marked | Good | Bad | CaVa deriving (Show,Eq)+data ItemState = Free | Marked | Good | Bad | Pending deriving (Show,Eq) type ItemIdent = Maybe (Int -> ItemState -> T.Text) -- KWQ: if Items were Foldable, could auto-compute length?