Skip to content

Commit

Permalink
start getting sims to run on web platform without true parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Aug 15, 2024
1 parent ac258bd commit a3618be
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
19 changes: 15 additions & 4 deletions egui/loopctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"cogentcore.org/core/icons"
"cogentcore.org/core/styles"
"cogentcore.org/core/styles/abilities"
"cogentcore.org/core/system"
"cogentcore.org/core/tree"
"github.com/emer/emergent/v2/etime"
"github.com/emer/emergent/v2/looper"
Expand Down Expand Up @@ -40,10 +41,15 @@ func (gui *GUI) AddLooperCtrl(p *tree.Plan, loops *looper.Manager, modes []etime
if !gui.IsRunning {
gui.IsRunning = true
tb.Restyle()
go func() {
f := func() {
loops.Run(mode)
gui.Stopped()
}()
}
if core.TheApp.Platform() == system.Web {
f()
} else {
go f()
}
}
})
})
Expand All @@ -68,11 +74,16 @@ func (gui *GUI) AddLooperCtrl(p *tree.Plan, loops *looper.Manager, modes []etime
if !gui.IsRunning {
gui.IsRunning = true
tb.Restyle()
go func() {
f := func() {
stack := loops.Stacks[mode]
loops.Step(mode, stepN[stack.StepLevel.String()], stack.StepLevel)
gui.Stopped()
}()
}
if core.TheApp.Platform() == system.Web {
f()
} else {
go f()
}
}
})
})
Expand Down
5 changes: 5 additions & 0 deletions netview/netview.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"cogentcore.org/core/math32/minmax"
"cogentcore.org/core/styles"
"cogentcore.org/core/styles/abilities"
"cogentcore.org/core/system"
"cogentcore.org/core/texteditor"
"cogentcore.org/core/tree"
"cogentcore.org/core/types"
Expand Down Expand Up @@ -227,6 +228,10 @@ func (nv *NetView) GoUpdateView() {
se.SetNeedsRender()
sw.NeedsRender()
sw.Scene.AsyncUnlock()
if core.TheApp.Platform() == system.Web {
fmt.Println("nv rendering")
sw.WidgetBase.Scene.RenderUpdateWindow()

Check failure on line 233 in netview/netview.go

View workflow job for this annotation

GitHub Actions / build

sw.WidgetBase.Scene.RenderUpdateWindow undefined (type *"cogentcore.org/core/core".Scene has no field or method RenderUpdateWindow)
}
}

// UpdateView updates the display based on last recorded state of network.
Expand Down
4 changes: 2 additions & 2 deletions patgen/configvocabpats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func TestVocab(t *testing.T) {
[5 2 2]: 0 0 0 1 0 0
`
// fmt.Println("Input Pats")
// fmt.Println(dt.ColumnByName("Input").Shape().Sizes)
// fmt.Println(dt.ColumnByName("Input").Shape.Sizes)
// fmt.Println(dt.ColumnByName("Input").String())
assert.Equal(t, []int{6, 3, 2, 3, 3}, dt.ColumnByName("Input").Shape().Sizes)
assert.Equal(t, exip, dt.ColumnByName("Input").String())
Expand Down Expand Up @@ -374,7 +374,7 @@ func TestVocab(t *testing.T) {
`

// fmt.Println("ECout Pats")
// fmt.Println(dt.ColumnByName("ECout").Shape().Sizes)
// fmt.Println(dt.ColumnByName("ECout").Shape.Sizes)
// fmt.Println(dt.ColumnByName("ECout").String())

assert.Equal(t, []int{6, 3, 2, 3, 3}, dt.ColumnByName("ECout").Shape().Sizes)
Expand Down

0 comments on commit a3618be

Please # to comment.