From 0d023704ff2ee81ca85a6a7cc4e304bb676b99ac Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Tue, 13 Jul 2021 16:20:39 -0400 Subject: [PATCH] 0 is unchecked, 2 is checked --- main.go | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/main.go b/main.go index 1fe6129..f5f1b35 100644 --- a/main.go +++ b/main.go @@ -14,7 +14,7 @@ import ( var ( // Info/Statuses batteryLevel *widgets.QLabel - batteryRange *widgets.QLabel + batteryRange *widgets.QLabel chargingState *widgets.QLabel minutesToFull *widgets.QLabel fastChargerInd *widgets.QLabel @@ -22,6 +22,7 @@ var ( chargeDoorOpenInd *widgets.QLabel insideTemp *widgets.QLabel outsideTemp *widgets.QLabel + climateUnitLabel *widgets.QLabel // Controls tempSetting *widgets.QLineEdit @@ -69,7 +70,7 @@ func main() { doorLockLabel := widgets.NewQLabel(nil, 0) sentryModeLabel := widgets.NewQLabel(nil, 0) chargingStateLabel := widgets.NewQLabel(nil, 0) - climateUnitLable := widgets.NewQLabel(nil, 0) + climateUnitLabel = widgets.NewQLabel(nil, 0) tempSetting = widgets.NewQLineEdit(nil) @@ -109,7 +110,6 @@ func main() { outsideTempLabel.SetText("Outside Temp: ") climateEnabledLabel.SetText("Climate On: ") climateSettingLabel.SetText("Climate Setting: ") - climateUnitLable.SetText(guiSettings.GuiTemperatureUnits) doorLockLabel.SetText("Lock Doors: ") sentryModeLabel.SetText("Sentry Mode: ") chargingStateLabel.SetText("Charging: ") @@ -157,7 +157,7 @@ func main() { climateHbox.AddItem(widgets.NewQSpacerItem(10, 10, widgets.QSizePolicy__Fixed, widgets.QSizePolicy__Fixed)) climateHbox.AddWidget(climateSettingLabel, 0, 0) climateHbox.AddWidget(tempSetting, 0, 0) - climateHbox.AddWidget(climateUnitLable,0,0) + climateHbox.AddWidget(climateUnitLabel, 0, 0) // Security Section (Lock/Unlock doors & start/stop charge. Also enable Sentry Mode) securityHbox.AddWidget(lockedDoors, 0, 0) @@ -252,18 +252,16 @@ func setValues() { chargeDoorOpenInd.SetText("Closed") } - insideTemp.SetText(fmt.Sprintf("%.0f%+v", insideTempVal, guiSettings.GuiTemperatureUnits)) - outsideTemp.SetText(fmt.Sprintf("%.0f%+v", outsideTempVal, guiSettings.GuiTemperatureUnits)) + insideTemp.SetText(fmt.Sprintf("%.0f %+v", insideTempVal, guiSettings.GuiTemperatureUnits)) + outsideTemp.SetText(fmt.Sprintf("%.0f %+v", outsideTempVal, guiSettings.GuiTemperatureUnits)) + climateOn.SetChecked(climateState.IsClimateOn) tempSetting.SetText(fmt.Sprintf("%.0f", tempSettingVal)) + climateUnitLabel.SetText(guiSettings.GuiTemperatureUnits) + + lockedDoors.SetChecked(vehicleState.Locked) + sentryMode.SetChecked(vehicleState.SentryMode) + sentryMode.SetCheckable(!vehicleState.SentryMode) - climateOn.SetChecked(climateState.IsClimateOn) - if vehicleState != nil { - lockedDoors.SetChecked(vehicleState.Locked) - sentryMode.SetChecked(vehicleState.SentryMode) - } else { - lockedDoors.SetCheckable(false) - sentryMode.SetCheckable(false) - } startStopCharge.SetChecked(chargeStats.ChargingState == "Charging") if chargeStats.ChargingState == "Disconnected" { startStopCharge.SetCheckable(false) @@ -277,10 +275,10 @@ func enableClimate(i int) { showDialogue("Unable to parse temp setting\n%+v", err) } if i == 0 { - vehicle.SetTemperature(temp,temp) - vehicle.StartAirConditioning() - } else { vehicle.StopAirConditioning() + } else { + vehicle.SetTemperature(temp, temp) + vehicle.StartAirConditioning() } go func() { time.Sleep(1 * time.Minute) @@ -308,9 +306,9 @@ func sentryModeEnable(i int) { func enableCharging(i int) { if i == 0 { - vehicle.StartCharging() - } else { vehicle.StopCharging() + } else { + vehicle.StartCharging() } go setValues() }