From ee294cd971f2735c7abce9c488949ad214be258f Mon Sep 17 00:00:00 2001 From: Kai O'Reilly Date: Tue, 9 Jul 2024 14:42:02 -0700 Subject: [PATCH] update to various core cleanup changes --- canvas/canvas.go | 9 +-------- code/debugpanel.go | 5 +---- numbers/cmd/numbers/numbers.go | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/canvas/canvas.go b/canvas/canvas.go index c03899ff..4deeaf7f 100644 --- a/canvas/canvas.go +++ b/canvas/canvas.go @@ -546,15 +546,8 @@ func (vv *Canvas) SetTitle() { if vv.Filename == "" { return } - win := vv.Scene.RenderWindow() - if win == nil { - return - } dfnm := fsx.DirAndFile(string(vv.Filename)) - winm := "Cogent Canvas • " + dfnm - win.SetName(winm) - win.SetTitle(winm) - vv.Scene.Body.Title = winm + vv.Scene.Body.SetTitle("Cogent Canvas • " + dfnm) } // NewDrawing opens a new drawing window diff --git a/code/debugpanel.go b/code/debugpanel.go index d42f9ee9..dcc0c967 100644 --- a/code/debugpanel.go +++ b/code/debugpanel.go @@ -374,10 +374,7 @@ func (dv *DebugPanel) Continue() { } } if dv.Code != nil { - sc := dv.Code.AsWidget().Scene - if sc != nil && sc.Stage.Mains != nil { - sc.Stage.Mains.RenderWindow.Raise() - } + dv.Code.Events().RenderWindow().Raise() } if ds != nil { dv.InitState(ds) diff --git a/numbers/cmd/numbers/numbers.go b/numbers/cmd/numbers/numbers.go index 97ef4fdc..6cda244a 100644 --- a/numbers/cmd/numbers/numbers.go +++ b/numbers/cmd/numbers/numbers.go @@ -18,6 +18,7 @@ import ( "cogentcore.org/core/base/fsx" "cogentcore.org/core/cli" "cogentcore.org/core/core" + "cogentcore.org/core/events" "cogentcore.org/core/shell" "cogentcore.org/core/shell/interpreter" "github.com/traefik/yaegi/interp" @@ -105,14 +106,15 @@ func Interactive(c *Config) error { in.Interp.Use(databrowser.Symbols) in.Config() - w := b.RunWindow() - go func() { - if c.Expr != "" { - in.Eval(c.Expr) - } - in.Interactive() - }() - w.Wait() + b.OnShow(func(e events.Event) { + go func() { + if c.Expr != "" { + in.Eval(c.Expr) + } + in.Interactive() + }() + }) + b.RunMainWindow() return nil }