diff options
author | zelig <viktor.tron@gmail.com> | 2014-03-27 18:14:04 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2014-03-27 18:14:04 +0800 |
commit | 49c710bf442940b3abc68123964b56b211b92c12 (patch) | |
tree | 9434b3684195dcf497f613fbc86d43a60602d532 /ethereal/ui/gui.go | |
parent | 642630db15a793cf0a0f7fbd827daee364df5423 (diff) | |
download | go-tangerine-49c710bf442940b3abc68123964b56b211b92c12.tar go-tangerine-49c710bf442940b3abc68123964b56b211b92c12.tar.gz go-tangerine-49c710bf442940b3abc68123964b56b211b92c12.tar.bz2 go-tangerine-49c710bf442940b3abc68123964b56b211b92c12.tar.lz go-tangerine-49c710bf442940b3abc68123964b56b211b92c12.tar.xz go-tangerine-49c710bf442940b3abc68123964b56b211b92c12.tar.zst go-tangerine-49c710bf442940b3abc68123964b56b211b92c12.zip |
assetPath configurable on command line for ethereal GUI
- solves the problem of non-standard installs
- add AssetPath to config as string var
- introduced UiLib constructor which falls back to defaultAssetPath (earlier behaviour) if no assetPath is set
- defaultAssetPath now internal concern of UiLib
- gui.Start(assetPath) argument passed from ethereal main() as set Init() in config.go
- informative log message if wallet.qml fails to open
Diffstat (limited to 'ethereal/ui/gui.go')
-rw-r--r-- | ethereal/ui/gui.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go index c8f4bedab..89736ac29 100644 --- a/ethereal/ui/gui.go +++ b/ethereal/ui/gui.go @@ -53,6 +53,7 @@ type Gui struct { txDb *ethdb.LDBDatabase addr []byte + } // Create GUI, but doesn't start it @@ -71,7 +72,7 @@ func New(ethereum *eth.Ethereum) *Gui { return &Gui{eth: ethereum, lib: lib, txDb: db, addr: addr} } -func (ui *Gui) Start() { +func (ui *Gui) Start(assetPath string) { defer ui.txDb.Close() // Register ethereum functions @@ -89,14 +90,16 @@ func (ui *Gui) Start() { // Expose the eth library and the ui library to QML context.SetVar("eth", ui.lib) - context.SetVar("ui", &UiLib{engine: ui.engine, eth: ui.eth}) + uiLib := NewUiLib(ui.engine, ui.eth, assetPath) + context.SetVar("ui", uiLib) // Load the main QML interface - component, err := ui.engine.LoadFile(AssetPath("qml/wallet.qml")) + component, err := ui.engine.LoadFile(uiLib.AssetPath("qml/wallet.qml")) if err != nil { + ethutil.Config.Log.Infoln("FATAL: asset not found: you can set an alternative asset path on on the command line using option 'asset_path'") panic(err) } - ui.engine.LoadFile(AssetPath("qml/transactions.qml")) + ui.engine.LoadFile(uiLib.AssetPath("qml/transactions.qml")) ui.win = component.CreateWindow(nil) |