Compare commits

..

No commits in common. "e3de5c7624b6037c07b7eb8fd9557393a2fcaaf6" and "01459544a5104e6337da64942e9e5864f86e424b" have entirely different histories.

3 changed files with 10 additions and 56 deletions

View file

@ -204,14 +204,12 @@ main :: IO ()
main = do main = do
config <- load ["$(HOME)/Zenith/zenith.cfg"] config <- load ["$(HOME)/Zenith/zenith.cfg"]
args <- getArgs args <- getArgs
dbFileName <- require config "dbFileName" dbFilePath <- require config "dbFilePath"
{-nodeUser <- require config "nodeUser"-} {-nodeUser <- require config "nodeUser"-}
{-nodePwd <- require config "nodePwd"-} {-nodePwd <- require config "nodePwd"-}
zebraPort <- require config "zebraPort" zebraPort <- require config "zebraPort"
zebraHost <- require config "zebraHost" zebraHost <- require config "zebraHost"
dbFP <- getZenithPath let myConfig = Config dbFilePath zebraHost zebraPort
let dbFilePath = dbFP ++ dbFileName
let myConfig = Config (T.pack dbFilePath) zebraHost zebraPort
if not (null args) if not (null args)
then do then do
case head args case head args
@ -238,5 +236,4 @@ printUsage = do
putStrLn "Available commands:" putStrLn "Available commands:"
{-putStrLn "legacy\tLegacy CLI for zcashd"-} {-putStrLn "legacy\tLegacy CLI for zcashd"-}
putStrLn "tui\tTUI for zebrad" putStrLn "tui\tTUI for zebrad"
putStrLn "gui\tGUI for zebrad"
putStrLn "rescan\tRescan the existing wallet(s)" putStrLn "rescan\tRescan the existing wallet(s)"

View file

@ -1,6 +1,5 @@
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BlockArguments #-}
module Zenith.GUI where module Zenith.GUI where
@ -103,9 +102,6 @@ data AppEvent
| CheckRecipient !T.Text | CheckRecipient !T.Text
| CheckAmount !Float | CheckAmount !Float
| ShowTxId !T.Text | ShowTxId !T.Text
| ShowAdrBook
| CloseAdrBook
| NotImplemented
deriving (Eq, Show) deriving (Eq, Show)
data AppModel = AppModel data AppModel = AppModel
@ -148,7 +144,6 @@ data AppModel = AppModel
, _amountValid :: !Bool , _amountValid :: !Bool
, _showId :: !(Maybe T.Text) , _showId :: !(Maybe T.Text)
, _home :: !FilePath , _home :: !FilePath
, _showAdrBook :: !Bool
} deriving (Eq, Show) } deriving (Eq, Show)
makeLenses ''AppModel makeLenses ''AppModel
@ -190,8 +185,6 @@ buildUI wenv model = widgetTree
, txIdOverlay `nodeVisible` isJust (model ^. showId) , txIdOverlay `nodeVisible` isJust (model ^. showId)
, msgOverlay `nodeVisible` isJust (model ^. msg) , msgOverlay `nodeVisible` isJust (model ^. msg)
, modalOverlay `nodeVisible` isJust (model ^. modalMsg) , modalOverlay `nodeVisible` isJust (model ^. modalMsg)
, adrbookOverlay `nodeVisible` model ^. showAdrBook
, msgAdrBookOverlay `nodeVisible` model ^. notImplemented
] ]
mainWindow = mainWindow =
vstack vstack
@ -254,8 +247,6 @@ buildUI wenv model = widgetTree
[bgColor white, borderB 1 gray, padding 3] [bgColor white, borderB 1 gray, padding 3]
, box_ [alignLeft, onClick ShowSeed] (label "Backup Wallet") `styleBasic` , box_ [alignLeft, onClick ShowSeed] (label "Backup Wallet") `styleBasic`
[bgColor white, borderB 1 gray, padding 3] [bgColor white, borderB 1 gray, padding 3]
, box_ [alignLeft, onClick ShowAdrBook] (label "Address Book") `styleBasic`
[bgColor white, borderB 1 gray, padding 3]
]) `styleBasic` ]) `styleBasic`
[bgColor btnColor, padding 3] [bgColor btnColor, padding 3]
newBox = newBox =
@ -759,26 +750,6 @@ buildUI wenv model = widgetTree
] ]
]) `styleBasic` ]) `styleBasic`
[padding 2, bgColor white, width 280, borderB 1 gray, borderT 1 gray] [padding 2, bgColor white, width 280, borderB 1 gray, borderT 1 gray]
adrbookOverlay =
alert CloseAdrBook $
vstack
[ box_
[]
(label "Address Book" `styleBasic`
[textFont "Bold", textSize 12, textColor white]) `styleBasic`
[bgColor btnColor, radius 2, padding 3]
, spacer
, hstack [
button "New" notImplemented
, spacer
, button "Edit" notImplemented
, spacer
, button "Copy" notImplemented
]
]
notImplemented = NotImplemented
generateQRCodes :: Config -> IO () generateQRCodes :: Config -> IO ()
generateQRCodes config = do generateQRCodes config = do
@ -1089,9 +1060,6 @@ handleEvent wenv node model evt =
(i < (fromIntegral (model ^. balance) / 100000000.0)) (i < (fromIntegral (model ^. balance) / 100000000.0))
] ]
ShowTxId tx -> [Model $ model & showId ?~ tx & modalMsg .~ Nothing] ShowTxId tx -> [Model $ model & showId ?~ tx & modalMsg .~ Nothing]
ShowAdrBook -> [Model $ model & showAdrBook .~ True & menuPopup .~ False]
CloseAdrBook -> [Model $ model & showAdrBook .~ False]
NotImplemented -> [Model $ model & msg ?~ "Function not implemented..." & menuPopup .~ False & modalMsg .~ Nothing]
where where
currentWallet = currentWallet =
if null (model ^. wallets) if null (model ^. wallets)
@ -1357,9 +1325,10 @@ runZenithGUI config = do
Nothing Nothing
"" ""
"" ""
(SaveAddress (if not (null accList) (SaveAddress $
if not (null accList)
then Just (head accList) then Just (head accList)
else Nothing ) ) else Nothing)
False False
False False
Nothing Nothing
@ -1373,9 +1342,7 @@ runZenithGUI config = do
False False
False False
Nothing Nothing
"" hD
False
-- hD
startApp model handleEvent buildUI (params hD) startApp model handleEvent buildUI (params hD)
Left e -> do Left e -> do
initDb dbFilePath initDb dbFilePath
@ -1391,9 +1358,9 @@ runZenithGUI config = do
0 0
[] []
0 0
(Just ( (Just $
"Couldn't connect to Zebra on " <> "Couldn't connect to Zebra on " <>
host <> ":" <> showt port <> ". Check your configuration." ) ) host <> ":" <> showt port <> ". Check your configuration.")
False False
314259000 314259000
(Just 30000) (Just 30000)
@ -1421,9 +1388,7 @@ runZenithGUI config = do
False False
False False
Nothing Nothing
"" hD
False
-- hD
startApp model handleEvent buildUI (params hD) startApp model handleEvent buildUI (params hD)
where where
params hd = params hd =

View file

@ -10,7 +10,6 @@ import Data.Scientific (Scientific(..), scientific)
import qualified Data.Text as T import qualified Data.Text as T
import qualified Data.Text.Encoding as E import qualified Data.Text.Encoding as E
import System.Process (createProcess_, shell) import System.Process (createProcess_, shell)
import System.Directory
import Text.Regex.Posix import Text.Regex.Posix
import ZcashHaskell.Orchard (encodeUnifiedAddress, isValidUnifiedAddress) import ZcashHaskell.Orchard (encodeUnifiedAddress, isValidUnifiedAddress)
import ZcashHaskell.Sapling (decodeSaplingAddress, isValidShieldedAddress) import ZcashHaskell.Sapling (decodeSaplingAddress, isValidShieldedAddress)
@ -91,13 +90,6 @@ copyAddress a =
createProcess_ "toClipboard" $ createProcess_ "toClipboard" $
shell $ "echo " ++ T.unpack (addy a) ++ " | xclip -r -selection clipboard" shell $ "echo " ++ T.unpack (addy a) ++ " | xclip -r -selection clipboard"
-- | Get current user and build zenith path
getZenithPath :: IO String
getZenithPath = do
d <- getHomeDirectory
let homeDirectory = d
return (homeDirectory ++ "/Zenith/")
-- | Bound a value to the 0..1 range, used for progress reporting on UIs -- | Bound a value to the 0..1 range, used for progress reporting on UIs
validBarValue :: Float -> Float validBarValue :: Float -> Float
validBarValue = clamp (0, 1) validBarValue = clamp (0, 1)