we got the data reading going again

This commit is contained in:
2026-03-03 22:02:42 +00:00
parent 11dc255303
commit f8e65a03d2
5 changed files with 97 additions and 70 deletions
+17 -52
View File
@@ -1,5 +1,7 @@
package views
import "github.com/rivo/tview"
// Car data lengths
const (
SpeedLen = 5
@@ -12,56 +14,19 @@ const (
streamingBoxID = "streaming-box"
)
func streamingWindow() {
// bus.Emit(ui.LogEv{Log: "creating streaming window"})
//
// // Get the ActionPages parent
// box := tview.NewTextView()
// box.SetBorder(true).SetTitle("STREAMING")
// box.SetInputCapture(func(ev *tcell.EventKey) *tcell.EventKey {
// switch ev.Key() {
// case tcell.KeyEsc:
// // well, I really need to design the UI (as if lmao) better
// os.Exit(0)
// }
//
// return ev
// })
//
// var err error
// var boxNode *dom.UINode
//
// // delete the currently existing streaming-box
// actionPages := doc.GetElemByID(LayoutToolActionPagesID).(*tview.Pages)
// actionPages.RemovePage(streamingBoxID)
//
// // Get the currently exisiting streaming box in the dom so we can delete it
// boxNode = doc.GetNodeByID(streamingBoxID)
// if boxNode != nil {
// doc.DeleteElem(boxNode)
// }
//
// // Register this streaming box as an UINode
// boxNode, err = doc.NewUINode(
// streamingBoxID,
// doc.GetElemByID(LayoutToolActionPagesID),
// box,
// )
// if err != nil {
// return
// }
//
// // Add it to the action pages and view it
// // AddAndShowPage(actionPages, boxNode, true)
//
// bus.Emit(ui.StartStreamingReqEv{})
//
// bus.On(ui.StreamDataEv{}, func(e any) {
// bus.Emit(ui.RedrawEv{
// Fn: func() {
// sd := e.(ui.StreamDataEv)
// box.SetText(sd.Str)
// },
// })
// })
type StreamView struct {
TextView *tview.TextView
}
func NewStreamView() *StreamView {
tv := tview.NewTextView()
tv.SetTitle("Streaming Tool").SetBorder(true)
return &StreamView{
TextView: tv,
}
}
func (sv *StreamView) Update(str string) {
sv.TextView.SetText(str)
}