added some new fields
This commit is contained in:
@@ -11,6 +11,7 @@ require (
|
||||
github.com/rivo/tview v0.42.0
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
|
||||
go.bug.st/serial v1.7.1
|
||||
golang.org/x/term v0.38.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
@@ -23,6 +24,6 @@ require (
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
golang.org/x/sys v0.39.0 // indirect
|
||||
golang.org/x/sys v0.43.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
)
|
||||
|
||||
@@ -37,6 +37,8 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
|
||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07 h1:UyzmZLoiDWMRywV4DUYb9Fbt8uiOSooupjTq10vpvnU=
|
||||
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.bug.st/serial v1.7.1 h1:5aP8wYL0UjEYOVs3oPAGscjaSfRQLHtCvBFXNN/rwtc=
|
||||
go.bug.st/serial v1.7.1/go.mod h1:d0MmS16Qt9b1m06yoYRNUXhRRTJV5Qg2S5EKqQtnayQ=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
||||
@@ -73,8 +75,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
|
||||
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
|
||||
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
|
||||
+217
-121
@@ -1,53 +1,5 @@
|
||||
Windows:
|
||||
1:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 331
|
||||
Y0: 190
|
||||
Width: 116
|
||||
Height: 70
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 6
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "234"
|
||||
Title: SPEEDO
|
||||
uidata:
|
||||
WID: 1
|
||||
TelemetryField: Speed
|
||||
2:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 140
|
||||
Y0: 412
|
||||
Width: 57
|
||||
Height: 57
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 4
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "6"
|
||||
Title: Thr
|
||||
uidata:
|
||||
WID: 2
|
||||
TelemetryField: Throttle Control
|
||||
3:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 207
|
||||
@@ -69,32 +21,80 @@ Windows:
|
||||
PreviewValue: "61.4"
|
||||
Title: BBias
|
||||
uidata:
|
||||
WID: 3
|
||||
WID: 1
|
||||
TelemetryField: BrakeBias
|
||||
4:
|
||||
2:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 354
|
||||
Y0: 71
|
||||
Width: 74
|
||||
Height: 111
|
||||
X0: 710
|
||||
Y0: 8
|
||||
Width: 84
|
||||
Height: 57
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 12
|
||||
TextSize: 4
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: R
|
||||
Title: Box
|
||||
PreviewValue: PIT
|
||||
Title: Pit Sp
|
||||
uidata:
|
||||
WID: 2
|
||||
TelemetryField: Pit Speed Limiter
|
||||
3:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 74
|
||||
Y0: 413
|
||||
Width: 57
|
||||
Height: 57
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 4
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "12"
|
||||
Title: TC
|
||||
uidata:
|
||||
WID: 3
|
||||
TelemetryField: TC Control
|
||||
4:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 60
|
||||
Y0: 91
|
||||
Width: 85
|
||||
Height: 57
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 4
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "123"
|
||||
Title: Lap
|
||||
uidata:
|
||||
WID: 4
|
||||
TelemetryField: Gear
|
||||
TelemetryField: Lap Number
|
||||
5:
|
||||
uiwindow:
|
||||
Dims:
|
||||
@@ -122,76 +122,28 @@ Windows:
|
||||
6:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 60
|
||||
Y0: 91
|
||||
Width: 85
|
||||
Height: 57
|
||||
X0: 331
|
||||
Y0: 190
|
||||
Width: 116
|
||||
Height: 70
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 4
|
||||
TextSize: 6
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "123"
|
||||
Title: Lap
|
||||
PreviewValue: "234"
|
||||
Title: SPEEDO
|
||||
uidata:
|
||||
WID: 6
|
||||
TelemetryField: Lap Number
|
||||
TelemetryField: Speed
|
||||
7:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 74
|
||||
Y0: 413
|
||||
Width: 57
|
||||
Height: 57
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 4
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "12"
|
||||
Title: TC
|
||||
uidata:
|
||||
WID: 7
|
||||
TelemetryField: TC Control
|
||||
8:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 60
|
||||
Y0: 155
|
||||
Width: 226
|
||||
Height: 57
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 4
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "06:45.123"
|
||||
Title: Last Lap
|
||||
uidata:
|
||||
WID: 8
|
||||
TelemetryField: Last Lap Time
|
||||
9:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 9
|
||||
@@ -213,14 +165,62 @@ Windows:
|
||||
PreviewValue: "12"
|
||||
Title: ABS
|
||||
uidata:
|
||||
WID: 9
|
||||
WID: 7
|
||||
TelemetryField: ABS Control
|
||||
8:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 590
|
||||
Y0: 367
|
||||
Width: 100
|
||||
Height: 50
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 3
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "101.5"
|
||||
Title: Water T
|
||||
uidata:
|
||||
WID: 8
|
||||
TelemetryField: Water Temperature
|
||||
9:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 354
|
||||
Y0: 71
|
||||
Width: 74
|
||||
Height: 111
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 12
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: R
|
||||
Title: Box
|
||||
uidata:
|
||||
WID: 9
|
||||
TelemetryField: Gear
|
||||
10:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 710
|
||||
Y0: 8
|
||||
Width: 84
|
||||
X0: 140
|
||||
Y0: 412
|
||||
Width: 57
|
||||
Height: 57
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
@@ -234,8 +234,104 @@ Windows:
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: PIT
|
||||
Title: Pit Sp
|
||||
PreviewValue: "6"
|
||||
Title: Thr
|
||||
uidata:
|
||||
WID: 10
|
||||
TelemetryField: Pit Speed Limiter
|
||||
TelemetryField: Throttle Control
|
||||
11:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 694
|
||||
Y0: 423
|
||||
Width: 100
|
||||
Height: 50
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 3
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "4.56"
|
||||
Title: Oil P
|
||||
uidata:
|
||||
WID: 11
|
||||
TelemetryField: Oil Pressure
|
||||
12:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 60
|
||||
Y0: 155
|
||||
Width: 226
|
||||
Height: 57
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 4
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "06:45.123"
|
||||
Title: Last Lap
|
||||
uidata:
|
||||
WID: 12
|
||||
TelemetryField: Last Lap Time
|
||||
13:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 694
|
||||
Y0: 367
|
||||
Width: 100
|
||||
Height: 50
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 3
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "101.4"
|
||||
Title: Oil T
|
||||
uidata:
|
||||
WID: 13
|
||||
TelemetryField: Oil Temperature
|
||||
14:
|
||||
uiwindow:
|
||||
Dims:
|
||||
X0: 436
|
||||
Y0: 71
|
||||
Width: 206
|
||||
Height: 57
|
||||
Decor:
|
||||
BGColour: 4161
|
||||
FGColour: 65535
|
||||
TitleColour: 65535
|
||||
BorderColour: 63488
|
||||
TitleSize: 2
|
||||
TextSize: 4
|
||||
HasBorder: 1
|
||||
Padding: 0
|
||||
Opts:
|
||||
ShowID: 0
|
||||
WinType: 2
|
||||
PreviewValue: "9999"
|
||||
Title: Dig Tacho
|
||||
uidata:
|
||||
WID: 14
|
||||
TelemetryField: RPM
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"esdi/cmd"
|
||||
"esdi/telemetry"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"esdi/cmd"
|
||||
"esdi/telemetry"
|
||||
|
||||
"github.com/arl/statsviz"
|
||||
)
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ var internalToSDKFieldNames = map[telemetry.FieldID]string{
|
||||
telemetry.Speed: "Speed",
|
||||
telemetry.Gear: "Gear",
|
||||
telemetry.RPM: "RPM",
|
||||
// Engine Data
|
||||
telemetry.OilPress: "OilPress",
|
||||
telemetry.OilTemp: "OilTemp",
|
||||
telemetry.WaterTemp: "WaterTemp",
|
||||
// Engine Warnings
|
||||
telemetry.PitSpeedLimiter: "irsdk_pitSpeedLimiter",
|
||||
// Ajudstements
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -45,16 +46,16 @@ func NewIRacingProvider(
|
||||
// Open the input file if provided - otherwise live telemetry was requested
|
||||
// Maybe this can be changed so we don't have to run it with these ifs but by configuring our
|
||||
// provider
|
||||
// var file goirsdk.Reader = nil
|
||||
// if source != "" {
|
||||
// file, err = os.Open(source)
|
||||
// if err != nil {
|
||||
// return &IRacing{}, err
|
||||
// // log.Fatalf("Failed to open IBT file: %v", err)
|
||||
// }
|
||||
// }
|
||||
var file goirsdk.Reader = nil
|
||||
if source != "" {
|
||||
file, err = os.Open(source)
|
||||
if err != nil {
|
||||
return &IRacing{}, err
|
||||
// log.Fatalf("Failed to open IBT file: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
sdk, err := goirsdk.Init(nil, telemOut, yamlOut)
|
||||
sdk, err := goirsdk.Init(file, telemOut, yamlOut)
|
||||
if err != nil {
|
||||
logger.Error("failed to open the IRSDK instance")
|
||||
return &IRacing{}, err
|
||||
@@ -211,8 +212,17 @@ func (i *IRacing) Subscribe(requestFields map[int16]telem.FieldID) {
|
||||
out.Type = telem.DataTypeUINT16
|
||||
out.Raw = uint64(uint16(v.(float32)))
|
||||
}
|
||||
// Engine Data
|
||||
case telem.OilPress:
|
||||
binding.Transform = FloatToStringTransform
|
||||
case telem.OilTemp:
|
||||
binding.Transform = FloatToStringTransform
|
||||
case telem.WaterTemp:
|
||||
binding.Transform = FloatToStringTransform
|
||||
// Something else
|
||||
case telem.PitSpeedLimiter:
|
||||
binding.Transform = PitSpeedLimiterTransform
|
||||
// Adjustements
|
||||
case telem.BrakeBias:
|
||||
binding.Transform = FloatToStringTransform
|
||||
case telem.ABSSetting:
|
||||
|
||||
+9
-2
@@ -19,8 +19,7 @@ type FieldMapper struct {
|
||||
|
||||
// VirtualField will define data that is acquired through middleware
|
||||
// So fuel per lap predictions and so on
|
||||
type VirtualField struct {
|
||||
}
|
||||
type VirtualField struct{}
|
||||
|
||||
// NOTE: Update the iracing SDK to write data to the same map ALWAYS, then
|
||||
// I can bind that address and read directly from there on the transform
|
||||
@@ -134,6 +133,10 @@ const (
|
||||
Speed FieldID = iota
|
||||
RPM
|
||||
Gear
|
||||
// Engine Data
|
||||
OilPress
|
||||
OilTemp
|
||||
WaterTemp
|
||||
// Engine Warnings
|
||||
PitSpeedLimiter
|
||||
// Adjustements
|
||||
@@ -169,6 +172,10 @@ var FieldNames = [MaxFields]string{
|
||||
Speed: "Speed",
|
||||
RPM: "RPM",
|
||||
Gear: "Gear",
|
||||
// Engine Data
|
||||
OilPress: "Oil Pressure",
|
||||
OilTemp: "Oil Temperature",
|
||||
WaterTemp: "Water Temperature",
|
||||
// Engine Warnings
|
||||
PitSpeedLimiter: "Pit Speed Limiter",
|
||||
// Ajustments
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"esdi/cdashdisplay"
|
||||
helper "esdi/helpers"
|
||||
"esdi/tui/internal/services"
|
||||
"esdi/tui/internal/views"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/rivo/tview"
|
||||
@@ -104,7 +105,6 @@ func (lc *LayoutController) registerHooks() {
|
||||
func (lc *LayoutController) parseWindowFormData(
|
||||
form views.CDashDisplayWindowFormView,
|
||||
) (*cdashdisplay.DesktopUIWindow, error) {
|
||||
|
||||
xValue, err := strconv.ParseUint(form.X.GetText(), 10, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -214,34 +214,32 @@ func (lc *LayoutController) createWindow() {
|
||||
// the buttons for that purpuse
|
||||
func (lc *LayoutController) updateFormView(win *cdashdisplay.DesktopUIWindow) error {
|
||||
// OnSuccess we update our form to be an existing window form
|
||||
lc.Messages <- fmt.Sprintf("Setting up window:\n%+v\n", win)
|
||||
|
||||
err := lc.LayoutToolView.WindowCreatedSuccessfuly(win)
|
||||
lc.Logger.Debug(fmt.Sprintf("updating form view for: %+v", win.Title))
|
||||
err := lc.LayoutToolView.WindowCreatedSuccessfuly(lc.Logger, win)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set the update window button behaviour
|
||||
lc.Logger.Debug(fmt.Sprintf("setting the update window behaviour: %+v", win.Title))
|
||||
formView := lc.LayoutToolView.FormQuickAccess[win.UIData.IDX]
|
||||
|
||||
lc.Logger.Debug(fmt.Sprintf("setting form button callback: %+v", win.Title))
|
||||
err = SetFormButtonCallback(formView.Form.Form, "Update", func() {
|
||||
lc.Messages <- "pressed update form button\n"
|
||||
window, err := lc.parseWindowFormData(*formView.Form)
|
||||
if err != nil {
|
||||
// lc.Messages <- "failed to parse window form data " + err.Error() + "\n"
|
||||
return
|
||||
}
|
||||
// lc.Messages <- fmt.Sprintf("window data in form: %v\n", window)
|
||||
|
||||
window.UIData.IDX = formView.WinID
|
||||
|
||||
lc.updateWindowAction(window)
|
||||
})
|
||||
if err != nil {
|
||||
lc.Messages <- "failed to set callback for update button\n"
|
||||
return err
|
||||
}
|
||||
|
||||
lc.Logger.Debug(fmt.Sprintf("setting input catpure: %+v", win.Title))
|
||||
formView.Form.Form.SetInputCapture(func(ev *tcell.EventKey) *tcell.EventKey {
|
||||
switch ev.Key() {
|
||||
case tcell.KeyEscape:
|
||||
@@ -251,6 +249,7 @@ func (lc *LayoutController) updateFormView(win *cdashdisplay.DesktopUIWindow) er
|
||||
return ev
|
||||
})
|
||||
|
||||
lc.Logger.Debug(fmt.Sprintf("giving focus to layouttree"))
|
||||
lc.App.SetFocus(lc.LayoutToolView.LayoutTree.Tree)
|
||||
|
||||
return nil
|
||||
@@ -308,8 +307,11 @@ func (lc *LayoutController) displayLoadedLayouts() {
|
||||
lc.Logger.Debug("We want to view our layout!")
|
||||
|
||||
for _, w := range lc.DevService.CDash.State.Layout.Windows {
|
||||
lc.Logger.Debug(fmt.Sprintf("updatinf form view for a layout: %+v", w))
|
||||
lc.Logger.Debug("==========================================================================")
|
||||
lc.Logger.Debug(fmt.Sprintf("updating form view for a layout: %+v", w.UIData.TelemetryField))
|
||||
err := lc.updateFormView(w)
|
||||
|
||||
lc.Logger.Debug(fmt.Sprintf("form view updated: %+v", err))
|
||||
if err != nil {
|
||||
lc.Logger.Debug("an error happened viewing our layout")
|
||||
lc.Messages <- "failed to add window to list"
|
||||
@@ -392,7 +394,6 @@ func (lc *LayoutController) moveWindow() {
|
||||
oldCapture := formView.Form.GetInputCapture()
|
||||
|
||||
formView.Form.SetInputCapture(func(ev *tcell.EventKey) *tcell.EventKey {
|
||||
lc.Messages <- "Captured event??\n"
|
||||
switch ev.Key() {
|
||||
case tcell.KeyESC:
|
||||
formView.Form.SetInputCapture(oldCapture)
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"esdi/cdashdisplay"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
|
||||
"esdi/cdashdisplay"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/rivo/tview"
|
||||
@@ -127,12 +129,15 @@ func NewLayoutToolView() *LayoutToolView {
|
||||
}
|
||||
|
||||
func (ltv *LayoutToolView) WindowCreatedSuccessfuly(
|
||||
win *cdashdisplay.DesktopUIWindow,
|
||||
lcLogger *slog.Logger, win *cdashdisplay.DesktopUIWindow,
|
||||
) error {
|
||||
lcLogger.Debug(fmt.Sprintf("creating window form view for: %+v", win.Title))
|
||||
updateWindowForm := NewWindowFormView(win)
|
||||
|
||||
// Update the pages ID
|
||||
lcLogger.Debug(fmt.Sprintf("removing page: %+v", LayoutToolNewWindowID))
|
||||
ltv.LayoutActions.Pages.RemovePage(LayoutToolNewWindowID)
|
||||
lcLogger.Debug(fmt.Sprintf("adding page: %+v", LayoutToolNewWindowID))
|
||||
AddAndShowPage(
|
||||
ltv.LayoutActions.Pages,
|
||||
windowInfoPageID(win.UIData.IDX),
|
||||
@@ -140,12 +145,15 @@ func (ltv *LayoutToolView) WindowCreatedSuccessfuly(
|
||||
)
|
||||
|
||||
// Then set the CreateWindowView pointer to nil
|
||||
lcLogger.Debug(fmt.Sprintf("setting create window pointer to nil: %+v", LayoutToolNewWindowID))
|
||||
ltv.LayoutActions.CreateWindowView = nil
|
||||
|
||||
// Add this form thing to the quick access map
|
||||
lcLogger.Debug(fmt.Sprintf("adding form to quick access map: %+v", LayoutToolNewWindowID))
|
||||
ltv.FormQuickAccess[win.UIData.IDX] = updateWindowForm
|
||||
|
||||
// Add it to the tree view
|
||||
lcLogger.Debug(fmt.Sprintf("adding it to tree view: %+v", LayoutToolNewWindowID))
|
||||
return ltv.LayoutTree.AddWindow(win)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user