forked from cerc-io/plugeth
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:
parent
2f96652bb4
commit
c0a05fcf89
@ -319,7 +319,7 @@ ApplicationWindow {
|
|||||||
|
|
||||||
Slider {
|
Slider {
|
||||||
id: logLevelSlider
|
id: logLevelSlider
|
||||||
value: eth.getLogLevel()
|
value: eth.getLogLevelInt()
|
||||||
anchors {
|
anchors {
|
||||||
right: parent.right
|
right: parent.right
|
||||||
top: parent.top
|
top: parent.top
|
||||||
|
@ -90,11 +90,12 @@ func (gui *Gui) Start(assetPath string) {
|
|||||||
|
|
||||||
var win *qml.Window
|
var win *qml.Window
|
||||||
var err error
|
var err error
|
||||||
|
var addlog = false
|
||||||
if len(data) == 0 {
|
if len(data) == 0 {
|
||||||
win, err = gui.showKeyImport(context)
|
win, err = gui.showKeyImport(context)
|
||||||
} else {
|
} else {
|
||||||
win, err = gui.showWallet(context)
|
win, err = gui.showWallet(context)
|
||||||
ethlog.AddLogSystem(gui)
|
addlog = true
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorln("asset not found: you can set an alternative asset path on the command line using option 'asset_path'", err)
|
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")
|
logger.Infoln("Starting GUI")
|
||||||
|
|
||||||
win.Show()
|
win.Show()
|
||||||
|
// only add the gui logger after window is shown otherwise slider wont be shown
|
||||||
|
if addlog {
|
||||||
|
ethlog.AddLogSystem(gui)
|
||||||
|
}
|
||||||
win.Wait()
|
win.Wait()
|
||||||
|
// need to silence gui logger after window closed otherwise logsystem hangs
|
||||||
|
gui.SetLogLevel(ethlog.Silence)
|
||||||
gui.eth.Stop()
|
gui.eth.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,6 +359,12 @@ func (gui *Gui) GetLogLevel() ethlog.LogLevel {
|
|||||||
return gui.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{}) {
|
func (gui *Gui) Println(v ...interface{}) {
|
||||||
gui.printLog(fmt.Sprintln(v...))
|
gui.printLog(fmt.Sprintln(v...))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user