Milestone 2: Graphic User Interface #93

Merged
pitmutt merged 38 commits from milestone2 into master 2024-07-17 14:28:52 +00:00
5 changed files with 139 additions and 110 deletions
Showing only changes of commit 5339ea51c6 - Show all commits

View file

@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Upgraded to GHC 9.6.5
- Implemented config and data folder
### Fixed

View file

@ -202,7 +202,7 @@ processUri user pwd =
main :: IO ()
main = do
config <- load ["zenith.cfg"]
config <- load ["$(HOME)/Zenith/zenith.cfg"]
args <- getArgs
dbFilePath <- require config "dbFilePath"
{-nodeUser <- require config "nodeUser"-}

View file

@ -25,6 +25,8 @@ import Lens.Micro ((&), (+~), (.~), (?~), (^.), set)
import Lens.Micro.TH
import Monomer
import qualified Monomer.Lens as L
import System.Directory (getHomeDirectory)
import System.FilePath ((</>))
import System.Hclip
import Text.Printf
import Text.Wrap (FillScope(..), FillStrategy(..), WrapSettings(..), wrapText)
@ -141,6 +143,7 @@ data AppModel = AppModel
, _recipientValid :: !Bool
, _amountValid :: !Bool
, _showId :: !(Maybe T.Text)
, _home :: !FilePath
} deriving (Eq, Show)
makeLenses ''AppModel
@ -440,7 +443,11 @@ buildUI wenv model = widgetTree
(fromIntegral $ qrCodeWidth qr))
[fitWidth]
Nothing ->
image_ "./assets/1F928_color.png" [fitEither]) `styleBasic`
image_
(T.pack $
(model ^. home) </>
"Zenith/assets/1F928_color.png")
[fitEither]) `styleBasic`
[bgColor white, height 100, width 100]
, filler
] `styleBasic`
@ -504,7 +511,9 @@ buildUI wenv model = widgetTree
, spacer
, label (showt $ model ^. timer) `styleBasic` [padding 3, textSize 8]
, filler
, image_ "./assets/1F993.png" [fitHeight] `styleBasic`
, image_
(T.pack $ (model ^. home) </> "Zenith/assets/1F993.png")
[fitHeight] `styleBasic`
[height 24, width 24] `nodeVisible`
(model ^. zebraOn)
, label
@ -1242,6 +1251,10 @@ txtWrap = wrapText (WrapSettings False True NoFill FillAfterFirst) 32
runZenithGUI :: Config -> IO ()
runZenithGUI config = do
homeDir <- try getHomeDirectory :: IO (Either IOError FilePath)
case homeDir of
Left e -> print e
Right hD -> do
let host = c_zebraHost config
let port = c_zebraPort config
let dbFilePath = c_dbPath config
@ -1260,11 +1273,13 @@ runZenithGUI config = do
walList <- getWallets pool $ zgb_net chainInfo
accList <-
if not (null walList)
then runNoLoggingT $ getAccounts pool $ entityKey $ head walList
then runNoLoggingT $
getAccounts pool $ entityKey $ head walList
else return []
addrList <-
if not (null accList)
then runNoLoggingT $ getAddresses pool $ entityKey $ head accList
then runNoLoggingT $
getAddresses pool $ entityKey $ head accList
else return []
txList <-
if not (null addrList)
@ -1327,7 +1342,8 @@ runZenithGUI config = do
False
False
Nothing
startApp model handleEvent buildUI params
hD
startApp model handleEvent buildUI (params hD)
Left e -> do
initDb dbFilePath
let model =
@ -1372,16 +1388,26 @@ runZenithGUI config = do
False
False
Nothing
startApp model handleEvent buildUI params
hD
startApp model handleEvent buildUI (params hD)
where
params =
params hd =
[ appWindowTitle "Zenith - Zcash Full Node Wallet"
, appWindowState $ MainWindowNormal (1000, 700)
, appTheme zenithTheme
, appFontDef "Regular" "./assets/Atkinson-Hyperlegible-Regular-102.ttf" --"./assets/DejaVuSansMono.ttf"
, appFontDef "Bold" "./assets/Atkinson-Hyperlegible-Bold-102.ttf"
, appFontDef "Italic" "./assets/Atkinson-Hyperlegible-Italic-102.ttf"
, appFontDef "Remix" "./assets/remixicon.ttf"
, appFontDef
"Regular"
(T.pack $
hd </>
"Zenith/assets/Atkinson-Hyperlegible-Regular-102.ttf" --"./assets/DejaVuSansMono.ttf"
)
, appFontDef
"Bold"
(T.pack $ hd </> "Zenith/assets/Atkinson-Hyperlegible-Bold-102.ttf")
, appFontDef
"Italic"
(T.pack $ hd </> "Zenith/assets/Atkinson-Hyperlegible-Italic-102.ttf")
, appFontDef "Remix" (T.pack $ hd </> "Zenith/assets/remixicon.ttf")
, appDisableAutoScale True
, appScaleFactor 2.0
, appInitEvent AppInit

@ -1 +1 @@
Subproject commit 90c8a7c3028bd6836dea5655221277a25d457653
Subproject commit e8074419cfb54559a4c09731ad2448d5930869a2

View file

@ -47,6 +47,8 @@ library
, brick
, bytestring
, data-default
, directory
, filepath
, esqueleto
, resource-pool
, binary