|
|
|
@ -48,6 +48,7 @@ var (
@@ -48,6 +48,7 @@ var (
|
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
|
mainApp = widgets.NewQApplication(len(os.Args), os.Args) |
|
|
|
|
window = widgets.NewQMainWindow(nil, 0) |
|
|
|
|
|
|
|
|
|
// Setup all UI Elements
|
|
|
|
|
batteryLevel = widgets.NewQLabel(nil, 0) |
|
|
|
@ -68,6 +69,7 @@ func main() {
@@ -68,6 +69,7 @@ func main() {
|
|
|
|
|
doorLockLabel := widgets.NewQLabel(nil, 0) |
|
|
|
|
sentryModeLabel := widgets.NewQLabel(nil, 0) |
|
|
|
|
chargingStateLabel := widgets.NewQLabel(nil, 0) |
|
|
|
|
climateUnitLable := widgets.NewQLabel(nil, 0) |
|
|
|
|
|
|
|
|
|
tempSetting = widgets.NewQLineEdit(nil) |
|
|
|
|
|
|
|
|
@ -81,7 +83,6 @@ func main() {
@@ -81,7 +83,6 @@ func main() {
|
|
|
|
|
trunk = widgets.NewQPushButton(nil) |
|
|
|
|
frunk = widgets.NewQPushButton(nil) |
|
|
|
|
|
|
|
|
|
vboxLayout := widgets.NewQVBoxLayout() |
|
|
|
|
statusLayout := widgets.NewQFormLayout(nil) |
|
|
|
|
chargeHbox := widgets.NewQHBoxLayout() |
|
|
|
|
tempHbox := widgets.NewQHBoxLayout() |
|
|
|
@ -89,10 +90,14 @@ func main() {
@@ -89,10 +90,14 @@ func main() {
|
|
|
|
|
securityHbox := widgets.NewQHBoxLayout() |
|
|
|
|
actionHbox := widgets.NewQHBoxLayout() |
|
|
|
|
|
|
|
|
|
centralWidget := widgets.NewQWidget(window, 0) |
|
|
|
|
|
|
|
|
|
// Set Values for everything
|
|
|
|
|
setValues() |
|
|
|
|
|
|
|
|
|
// Some adjustments
|
|
|
|
|
window.SetWindowTitle(fmt.Sprintf("%+v: %+v", vehicle.DisplayName, vehicle.Vin)) |
|
|
|
|
|
|
|
|
|
batteryLevel.SetFixedWidth(30) |
|
|
|
|
insideTemp.SetFixedWidth(25) |
|
|
|
|
outsideTemp.SetFixedWidth(25) |
|
|
|
@ -104,6 +109,7 @@ func main() {
@@ -104,6 +109,7 @@ 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: ") |
|
|
|
@ -151,6 +157,7 @@ func main() {
@@ -151,6 +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) |
|
|
|
|
|
|
|
|
|
// Security Section (Lock/Unlock doors & start/stop charge. Also enable Sentry Mode)
|
|
|
|
|
securityHbox.AddWidget(lockedDoors, 0, 0) |
|
|
|
@ -183,12 +190,9 @@ func main() {
@@ -183,12 +190,9 @@ func main() {
|
|
|
|
|
statusLayout.AddRow3(" ", nil) |
|
|
|
|
statusLayout.AddRow2(doorLockLabel, securityHbox) |
|
|
|
|
statusLayout.AddRow6(actionHbox) |
|
|
|
|
vboxLayout.AddItem(statusLayout) |
|
|
|
|
|
|
|
|
|
window = widgets.NewQMainWindow(nil, 0) |
|
|
|
|
window.SetWindowTitle(fmt.Sprintf("%+v: %+v", vehicle.DisplayName, vehicle.Vin)) |
|
|
|
|
centralWidget := widgets.NewQWidget(window, 0) |
|
|
|
|
centralWidget.SetLayout(vboxLayout) |
|
|
|
|
// Finish setting up the window, and let her go
|
|
|
|
|
centralWidget.SetLayout(statusLayout) |
|
|
|
|
window.SetCentralWidget(centralWidget) |
|
|
|
|
if !popup { |
|
|
|
|
window.Show() |
|
|
|
@ -229,7 +233,7 @@ func setValues() {
@@ -229,7 +233,7 @@ func setValues() {
|
|
|
|
|
insideTempVal = (climateState.InsideTemp * 1.8) + 32 |
|
|
|
|
outsideTempVal = (climateState.OutsideTemp * 1.8) + 32 |
|
|
|
|
} |
|
|
|
|
batteryLevel.SetText(fmt.Sprintf("%+v", chargeStats.BatteryLevel)) |
|
|
|
|
batteryLevel.SetText(fmt.Sprintf("%+v%%", chargeStats.BatteryLevel)) |
|
|
|
|
batteryRange.SetText(fmt.Sprintf("%.2f%+v", chargeStats.BatteryRange, |
|
|
|
|
strings.Replace(guiSettings.GuiDistanceUnits, "/hr", "", -1))) |
|
|
|
|
batteryRange.SetFixedWidth(10 * len(batteryRange.Text())) |
|
|
|
@ -248,8 +252,8 @@ func setValues() {
@@ -248,8 +252,8 @@ func setValues() {
|
|
|
|
|
chargeDoorOpenInd.SetText("Closed") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
insideTemp.SetText(fmt.Sprintf("%.0f", insideTempVal)) |
|
|
|
|
outsideTemp.SetText(fmt.Sprintf("%.0f", outsideTempVal)) |
|
|
|
|
insideTemp.SetText(fmt.Sprintf("%.0f%+v", insideTempVal, guiSettings.GuiTemperatureUnits)) |
|
|
|
|
outsideTemp.SetText(fmt.Sprintf("%.0f%+v", outsideTempVal, guiSettings.GuiTemperatureUnits)) |
|
|
|
|
tempSetting.SetText(fmt.Sprintf("%.0f", tempSettingVal)) |
|
|
|
|
|
|
|
|
|
climateOn.SetChecked(climateState.IsClimateOn) |
|
|
|
|