aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2014-06-26 19:13:31 +0800
committerzelig <viktor.tron@gmail.com>2014-06-26 19:13:31 +0800
commitc0a05fcf8984f04f198c5c0f8be4f73090f99403 (patch)
treec279b9ffffa2ac76627c2178f4cdc936406589c6
parent2f96652bb408e65c205317403d749ba9a395c6bb (diff)
downloadgo-tangerine-c0a05fcf8984f04f198c5c0f8be4f73090f99403.tar.gz
go-tangerine-c0a05fcf8984f04f198c5c0f8be4f73090f99403.tar.zst
go-tangerine-c0a05fcf8984f04f198c5c0f8be4f73090f99403.zip
log slider
- only add the gui logger after window is shown otherwise slider wont be shown - need to silence gui logger after window closed otherwise logsystem hangs - gui.GetLogLevelInt() extra function needed to give correcty int typecast value to gui widget that sets initial loglevel to default
-rw-r--r--ethereal/assets/qml/wallet.qml2
-rw-r--r--ethereal/ui/gui.go16
2 files changed, 15 insertions, 3 deletions
diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml
index eb3aa6df5..84f8fd5cf 100644
--- a/ethereal/assets/qml/wallet.qml
+++ b/ethereal/assets/qml/wallet.qml
@@ -319,7 +319,7 @@ ApplicationWindow {
Slider {
id: logLevelSlider
- value: eth.getLogLevel()
+ value: eth.getLogLevelInt()
anchors {
right: parent.right
top: parent.top
diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go
index f3a918ea0..8845f6af3 100644
--- a/ethereal/ui/gui.go
+++ b/ethereal/ui/gui.go
@@ -90,11 +90,12 @@ func (gui *Gui) Start(assetPath string) {
var win *qml.Window
var err error
+ var addlog = false
if len(data) == 0 {
win, err = gui.showKeyImport(context)
} else {
win, err = gui.showWallet(context)
- ethlog.AddLogSystem(gui)
+ addlog = true
}
if err != nil {
logger.Errorln("asset not found: you can set an alternative asset path on the command line using option 'asset_path'", err)
@@ -105,8 +106,13 @@ func (gui *Gui) Start(assetPath string) {
logger.Infoln("Starting GUI")
win.Show()
+ // only add the gui logger after window is shown otherwise slider wont be shown
+ if addlog {
+ ethlog.AddLogSystem(gui)
+ }
win.Wait()
-
+ // need to silence gui logger after window closed otherwise logsystem hangs
+ gui.SetLogLevel(ethlog.Silence)
gui.eth.Stop()
}
@@ -353,6 +359,12 @@ func (gui *Gui) GetLogLevel() ethlog.LogLevel {
return gui.logLevel
}
+// this extra function needed to give int typecast value to gui widget
+// that sets initial loglevel to default
+func (gui *Gui) GetLogLevelInt() int {
+ return int(gui.logLevel)
+}
+
func (gui *Gui) Println(v ...interface{}) {
gui.printLog(fmt.Sprintln(v...))
}