diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2010-11-04 13:52:31 -0400 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-06-25 14:53:33 +0100 |
commit | aecb004b3025b85b8d833d788c1bd44eb25a1db5 (patch) | |
tree | ac2ca45e46e9bd888789aaab2019f7182c60aa1c /Bustle.hs | |
parent | 18582f7ee95881cdf7cd2cec9cf92b1219724b49 (diff) |
Show relative frequencies using progress bars
Diffstat (limited to 'Bustle.hs')
-rw-r--r-- | Bustle.hs | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -22,6 +22,7 @@ where import Prelude hiding (log, catch) +import Control.Applicative ((<$>)) import Control.Arrow ((&&&)) import Control.Exception import Control.Monad (when, forM) @@ -237,12 +238,19 @@ newCountView method signal = do treeViewAppendColumn countView nameColumn - countRenderer <- cellRendererTextNew countColumn <- treeViewColumnNew treeViewColumnSetTitle countColumn "Frequency" - cellLayoutPackStart countColumn countRenderer True - cellLayoutSetAttributes countColumn countRenderer countStore $ - \(count, (_type, _name)) -> [ cellText := show count ] + + -- Using a progress bar here is not really ideal, but I CBA to do anything + -- more auspicious right now. :) + countBar <- cellRendererProgressNew + cellLayoutPackStart countColumn countBar True + cellLayoutSetAttributes countColumn countBar countStore $ \(count, _) -> + [ cellProgressValue :=> do + upperBound <- maximum . map fst <$> listStoreToList countStore + return (count * 100 `div` upperBound) + , cellProgressText := Just $ show count + ] treeViewAppendColumn countView countColumn |