0 is unchecked, 2 is checked
This commit is contained in:
32
main.go
32
main.go
@ -22,6 +22,7 @@ var (
|
|||||||
chargeDoorOpenInd *widgets.QLabel
|
chargeDoorOpenInd *widgets.QLabel
|
||||||
insideTemp *widgets.QLabel
|
insideTemp *widgets.QLabel
|
||||||
outsideTemp *widgets.QLabel
|
outsideTemp *widgets.QLabel
|
||||||
|
climateUnitLabel *widgets.QLabel
|
||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
tempSetting *widgets.QLineEdit
|
tempSetting *widgets.QLineEdit
|
||||||
@ -69,7 +70,7 @@ func main() {
|
|||||||
doorLockLabel := widgets.NewQLabel(nil, 0)
|
doorLockLabel := widgets.NewQLabel(nil, 0)
|
||||||
sentryModeLabel := widgets.NewQLabel(nil, 0)
|
sentryModeLabel := widgets.NewQLabel(nil, 0)
|
||||||
chargingStateLabel := widgets.NewQLabel(nil, 0)
|
chargingStateLabel := widgets.NewQLabel(nil, 0)
|
||||||
climateUnitLable := widgets.NewQLabel(nil, 0)
|
climateUnitLabel = widgets.NewQLabel(nil, 0)
|
||||||
|
|
||||||
tempSetting = widgets.NewQLineEdit(nil)
|
tempSetting = widgets.NewQLineEdit(nil)
|
||||||
|
|
||||||
@ -109,7 +110,6 @@ func main() {
|
|||||||
outsideTempLabel.SetText("Outside Temp: ")
|
outsideTempLabel.SetText("Outside Temp: ")
|
||||||
climateEnabledLabel.SetText("Climate On: ")
|
climateEnabledLabel.SetText("Climate On: ")
|
||||||
climateSettingLabel.SetText("Climate Setting: ")
|
climateSettingLabel.SetText("Climate Setting: ")
|
||||||
climateUnitLable.SetText(guiSettings.GuiTemperatureUnits)
|
|
||||||
doorLockLabel.SetText("Lock Doors: ")
|
doorLockLabel.SetText("Lock Doors: ")
|
||||||
sentryModeLabel.SetText("Sentry Mode: ")
|
sentryModeLabel.SetText("Sentry Mode: ")
|
||||||
chargingStateLabel.SetText("Charging: ")
|
chargingStateLabel.SetText("Charging: ")
|
||||||
@ -157,7 +157,7 @@ func main() {
|
|||||||
climateHbox.AddItem(widgets.NewQSpacerItem(10, 10, widgets.QSizePolicy__Fixed, widgets.QSizePolicy__Fixed))
|
climateHbox.AddItem(widgets.NewQSpacerItem(10, 10, widgets.QSizePolicy__Fixed, widgets.QSizePolicy__Fixed))
|
||||||
climateHbox.AddWidget(climateSettingLabel, 0, 0)
|
climateHbox.AddWidget(climateSettingLabel, 0, 0)
|
||||||
climateHbox.AddWidget(tempSetting, 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)
|
// Security Section (Lock/Unlock doors & start/stop charge. Also enable Sentry Mode)
|
||||||
securityHbox.AddWidget(lockedDoors, 0, 0)
|
securityHbox.AddWidget(lockedDoors, 0, 0)
|
||||||
@ -252,18 +252,16 @@ func setValues() {
|
|||||||
chargeDoorOpenInd.SetText("Closed")
|
chargeDoorOpenInd.SetText("Closed")
|
||||||
}
|
}
|
||||||
|
|
||||||
insideTemp.SetText(fmt.Sprintf("%.0f%+v", insideTempVal, guiSettings.GuiTemperatureUnits))
|
insideTemp.SetText(fmt.Sprintf("%.0f %+v", insideTempVal, guiSettings.GuiTemperatureUnits))
|
||||||
outsideTemp.SetText(fmt.Sprintf("%.0f%+v", outsideTempVal, guiSettings.GuiTemperatureUnits))
|
outsideTemp.SetText(fmt.Sprintf("%.0f %+v", outsideTempVal, guiSettings.GuiTemperatureUnits))
|
||||||
tempSetting.SetText(fmt.Sprintf("%.0f", tempSettingVal))
|
|
||||||
|
|
||||||
climateOn.SetChecked(climateState.IsClimateOn)
|
climateOn.SetChecked(climateState.IsClimateOn)
|
||||||
if vehicleState != nil {
|
tempSetting.SetText(fmt.Sprintf("%.0f", tempSettingVal))
|
||||||
|
climateUnitLabel.SetText(guiSettings.GuiTemperatureUnits)
|
||||||
|
|
||||||
lockedDoors.SetChecked(vehicleState.Locked)
|
lockedDoors.SetChecked(vehicleState.Locked)
|
||||||
sentryMode.SetChecked(vehicleState.SentryMode)
|
sentryMode.SetChecked(vehicleState.SentryMode)
|
||||||
} else {
|
sentryMode.SetCheckable(!vehicleState.SentryMode)
|
||||||
lockedDoors.SetCheckable(false)
|
|
||||||
sentryMode.SetCheckable(false)
|
|
||||||
}
|
|
||||||
startStopCharge.SetChecked(chargeStats.ChargingState == "Charging")
|
startStopCharge.SetChecked(chargeStats.ChargingState == "Charging")
|
||||||
if chargeStats.ChargingState == "Disconnected" {
|
if chargeStats.ChargingState == "Disconnected" {
|
||||||
startStopCharge.SetCheckable(false)
|
startStopCharge.SetCheckable(false)
|
||||||
@ -277,10 +275,10 @@ func enableClimate(i int) {
|
|||||||
showDialogue("Unable to parse temp setting\n%+v", err)
|
showDialogue("Unable to parse temp setting\n%+v", err)
|
||||||
}
|
}
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
vehicle.SetTemperature(temp,temp)
|
|
||||||
vehicle.StartAirConditioning()
|
|
||||||
} else {
|
|
||||||
vehicle.StopAirConditioning()
|
vehicle.StopAirConditioning()
|
||||||
|
} else {
|
||||||
|
vehicle.SetTemperature(temp, temp)
|
||||||
|
vehicle.StartAirConditioning()
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(1 * time.Minute)
|
time.Sleep(1 * time.Minute)
|
||||||
@ -308,9 +306,9 @@ func sentryModeEnable(i int) {
|
|||||||
|
|
||||||
func enableCharging(i int) {
|
func enableCharging(i int) {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
vehicle.StartCharging()
|
|
||||||
} else {
|
|
||||||
vehicle.StopCharging()
|
vehicle.StopCharging()
|
||||||
|
} else {
|
||||||
|
vehicle.StartCharging()
|
||||||
}
|
}
|
||||||
go setValues()
|
go setValues()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user