it is with great sadness the DOM and event bus go. Its all callbacks now
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"esdi/tui/internal/dom"
|
||||
"esdi/tui/internal/events"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
@@ -12,9 +10,7 @@ import (
|
||||
|
||||
type Controller struct {
|
||||
Logger *slog.Logger
|
||||
Bus *events.Bus
|
||||
App *tview.Application
|
||||
Dom *dom.DOM
|
||||
}
|
||||
|
||||
func ListFormButtonLabels(form *tview.Form) []string {
|
||||
|
||||
@@ -25,45 +25,6 @@ func NewDeviceController(base *Controller, devService *serv.CDashService) *Devic
|
||||
StreamStrl: NewStreamingCtrl(),
|
||||
}
|
||||
|
||||
// mc.Bus.On(ui.DestroyWindowEv{}, func(e any) {
|
||||
// mc.Logger.Info(fmt.Sprintf("Called in to destroy win: %d", e.(ui.DestroyWindowEv).ID))
|
||||
// mc.CDash.DestroyWindow(e.(ui.DestroyWindowEv).ID)
|
||||
//
|
||||
// mc.Bus.Emit(ui.WindowDestroyedEv{ID: e.(ui.DestroyWindowEv).ID})
|
||||
// })
|
||||
|
||||
// mc.Bus.On(ui.MoveWindowEv{}, func(e any) {
|
||||
// mvData := e.(ui.MoveWindowEv)
|
||||
// mc.Logger.Debug(fmt.Sprintf("request to move window '%d'", mvData.WindowID))
|
||||
//
|
||||
// newDims, err := mc.CDash.MoveWindow(mvData.WindowID, mvData.Delta)
|
||||
// if err != nil && err != io.EOF {
|
||||
// mc.Logger.Debug(fmt.Sprintf("failed to move window '%d' %s", mvData.WindowID, err.Error()))
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// mc.Bus.Emit(ui.WindowMovedEv{ID: mvData.WindowID, Dims: newDims})
|
||||
// })
|
||||
|
||||
// mc.Bus.On(ui.ResizeWindowEv{}, func(e any) {
|
||||
// mvData := e.(ui.ResizeWindowEv)
|
||||
// mc.Logger.Debug(fmt.Sprintf("requested to resize window '%d'", mvData.WindowID))
|
||||
// err := mc.CDash.ResizeWindow(mvData.WindowID, mvData.Delta)
|
||||
// if err != nil && err != io.EOF {
|
||||
// mc.Logger.Debug(fmt.Sprintf("failed to resize window '%d' %s", mvData.WindowID, err.Error()))
|
||||
// return
|
||||
// }
|
||||
// })
|
||||
|
||||
// mc.Bus.On(ui.SaveLayoutEv{}, func(e any) {
|
||||
// mc.CDash.SaveLayout()
|
||||
// })
|
||||
|
||||
// mc.Bus.On(ui.ForceRedraw{}, func(e any) {
|
||||
// // mc.App.QueueUpdateDraw(func() {})
|
||||
// mc.App.Draw()
|
||||
// })
|
||||
|
||||
// mc.Bus.On(ui.StartStreamingReqEv{}, func(e any) {
|
||||
// mc.StreamStrl.Start(mc.Bus)
|
||||
// })
|
||||
@@ -147,7 +108,7 @@ func (mc *DeviceController) mainUI() error {
|
||||
var err error
|
||||
|
||||
// Set the main view
|
||||
mc.DeviceAPIView, err = views.NewDeviceAPIView(mc.Dom)
|
||||
mc.DeviceAPIView, err = views.NewDeviceAPIView()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -9,9 +9,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"esdi/tui/internal/events"
|
||||
"esdi/tui/internal/ui"
|
||||
|
||||
"github.com/ESilva15/goirsdk"
|
||||
)
|
||||
|
||||
@@ -42,10 +39,10 @@ func NewStreamingCtrl() *StreamingCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
func (sc *StreamingCtrl) Stop(bus *events.Bus) {
|
||||
}
|
||||
// func (sc *StreamingCtrl) Stop(bus *events.Bus) {
|
||||
// }
|
||||
|
||||
func (sc *StreamingCtrl) Start(bus *events.Bus) {
|
||||
func (sc *StreamingCtrl) Start() {
|
||||
// Open the telemetry file
|
||||
file, err := os.Open("/home/esilva/Desktop/projetos/simracing_peripherals/testTelemetry/supercars_indianapolis.ibt")
|
||||
if err != nil {
|
||||
@@ -73,10 +70,10 @@ func (sc *StreamingCtrl) Start(bus *events.Bus) {
|
||||
|
||||
delta := currentTime.Sub(startTime)
|
||||
|
||||
str := sc.Stringified() + fmt.Sprintf("%v - %7d\n%5f - %5f",
|
||||
_ = sc.Stringified() + fmt.Sprintf("%v - %7d\n%5f - %5f",
|
||||
t.UTC(), counter, delta.Seconds(), delta.Seconds()/float64(counter))
|
||||
|
||||
bus.Emit(ui.StreamDataEv{Str: str})
|
||||
// bus.Emit(ui.StreamDataEv{Str: str})
|
||||
counter++
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user