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
This commit is contained in:
zelig 2014-06-26 12:13:31 +01:00
parent 2f96652bb4
commit c0a05fcf89
2 changed files with 15 additions and 3 deletions

View File

@ -319,7 +319,7 @@ ApplicationWindow {
Slider {
id: logLevelSlider
value: eth.getLogLevel()
value: eth.getLogLevelInt()
anchors {
right: parent.right
top: parent.top

View File

@ -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...))
}