diff options
author | Kevin Chabowski <kevin@kch42.de> | 2013-08-17 14:57:40 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2013-08-17 14:57:40 +0200 |
commit | a12232f527666695c57a6014401c1a34c2fb6611 (patch) | |
tree | 76825b119d7862d16af962b94ca9d3499be689b6 /main.go | |
parent | a6990de0ba8260d1021188b862c38478f401c721 (diff) | |
download | biomed-a12232f527666695c57a6014401c1a34c2fb6611.tar.gz biomed-a12232f527666695c57a6014401c1a34c2fb6611.tar.bz2 biomed-a12232f527666695c57a6014401c1a34c2fb6611.zip |
GUI is now locked on slow operations (e.g. Filling).
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -15,6 +15,7 @@ type GUI struct { showbiomes *gtk.CheckButton statusContext uint + lastStatus string mapw *MapWidget } @@ -201,7 +202,7 @@ func (g *GUI) Init() { hbox := gtk.NewHBox(false, 0) - g.mapw = NewMapWidget(g.reportError, g.updateInfo) + g.mapw = NewMapWidget(g.reportError, g.updateInfo, g.setBusy) hbox.PackStart(g.mapw.DArea(), true, true, 3) sidebar := g.mkSidebar() @@ -221,6 +222,17 @@ func (g *GUI) Init() { g.setTool(NewFillTool()) } +func (g *GUI) setBusy(b bool) { + g.window.SetSensitive(!b) + g.statusbar.Pop(g.statusContext) + if b { + g.statusbar.Push(g.statusContext, "!!! PLEASE WAIT !!!") + + } else { + g.statusbar.Push(g.statusContext, g.lastStatus) + } +} + func (g *GUI) reportError(msg string) { dlg := gtk.NewMessageDialog(g.window, gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, msg) dlg.Run() @@ -229,8 +241,9 @@ func (g *GUI) reportError(msg string) { } func (g *GUI) updateInfo(x, z int, bio mcmap.Biome) { + g.lastStatus = fmt.Sprintf("X:%d, Z:%d, Biome:%s", x, z, bio) g.statusbar.Pop(g.statusContext) - g.statusbar.Push(g.statusContext, fmt.Sprintf("X:%d, Z:%d, Biome:%s", x, z, bio)) + g.statusbar.Push(g.statusContext, g.lastStatus) } func (g *GUI) mkUpdateToolFx(rb *gtk.RadioButton, t Tool) func() { |