Browse Source

0 is unchecked, 2 is checked

ui_file
Gregory Rudolph 4 years ago
parent
commit
0d023704ff
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 36
      main.go

36
main.go

@ -14,7 +14,7 @@ import (
var ( var (
// Info/Statuses // Info/Statuses
batteryLevel *widgets.QLabel batteryLevel *widgets.QLabel
batteryRange *widgets.QLabel batteryRange *widgets.QLabel
chargingState *widgets.QLabel chargingState *widgets.QLabel
minutesToFull *widgets.QLabel minutesToFull *widgets.QLabel
fastChargerInd *widgets.QLabel fastChargerInd *widgets.QLabel
@ -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))
climateOn.SetChecked(climateState.IsClimateOn)
tempSetting.SetText(fmt.Sprintf("%.0f", tempSettingVal)) 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") 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()
} }

Loading…
Cancel
Save