From 331d33344291eb598909397cbcbe7b1932425f89 Mon Sep 17 00:00:00 2001 From: Michael J Mulligan Date: Tue, 23 Mar 2021 20:26:39 +0000 Subject: [PATCH 1/2] Proper use of the ldflags to set version and build data. --- ui/SystemPanel.go | 2 +- ui/ui.go | 2 ++ uiWidgets/OctoScreenInfoBox.go | 11 +++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ui/SystemPanel.go b/ui/SystemPanel.go index e2979506..1ba497af 100755 --- a/ui/SystemPanel.go +++ b/ui/SystemPanel.go @@ -51,7 +51,7 @@ func (this *systemPanel) initialize() { this.octoPrintInfoBox = uiWidgets.CreateOctoPrintInfoBox(this.UI.Client, logoWidth) this.Grid().Attach(this.octoPrintInfoBox, 0, 0, 1, 1) - this.octoScreenInfoBox = uiWidgets.CreateOctoScreenInfoBox(this.UI.Client, OctoScreenVersion) + this.octoScreenInfoBox = uiWidgets.CreateOctoScreenInfoBox(this.UI.Client, Version, Build) this.Grid().Attach(this.octoScreenInfoBox, 1, 0, 2, 1) this.octoScreenPluginInfoBox = uiWidgets.CreateOctoScreenPluginInfoBox(this.UI.Client, this.UI.UIState, this.UI.OctoPrintPluginIsAvailable) diff --git a/ui/ui.go b/ui/ui.go index 03d989ed..f202ee8f 100755 --- a/ui/ui.go +++ b/ui/ui.go @@ -19,6 +19,8 @@ import ( "github.com/Z-Bolt/OctoScreen/utils" ) +var Version string +var Build string type UI struct { sync.Mutex diff --git a/uiWidgets/OctoScreenInfoBox.go b/uiWidgets/OctoScreenInfoBox.go index fac22708..66361ae1 100755 --- a/uiWidgets/OctoScreenInfoBox.go +++ b/uiWidgets/OctoScreenInfoBox.go @@ -2,7 +2,7 @@ package uiWidgets import ( // "fmt" - "strings" + //"strings" "github.com/Z-Bolt/OctoScreen/octoprintApis" // "github.com/Z-Bolt/OctoScreen/octoprintApis/dataModels" @@ -15,10 +15,12 @@ type OctoScreenInfoBox struct { func CreateOctoScreenInfoBox( client *octoprintApis.Client, - octoScreenVersion string, + Version string, + Build string, ) *OctoScreenInfoBox { logoImage := utils.MustImageFromFile("logos/octoscreen-isometric-90%.png") + /* str2 := "" str3 := "" stringArray := strings.Split(octoScreenVersion, " ") @@ -29,13 +31,14 @@ func CreateOctoScreenInfoBox( str2 = octoScreenVersion str3 = "" } + */ base := CreateSystemInfoBox( client, logoImage, "OctoScreen", - str2, - str3, + Version, + Build, ) instance := &OctoScreenInfoBox { From 42079277716fe7970406d01ffd32a6eccc906187 Mon Sep 17 00:00:00 2001 From: Michael J Mulligan Date: Tue, 23 Mar 2021 20:29:11 +0000 Subject: [PATCH 2/2] Comment and remove old 'OctoScreenVersion' (not needed) --- ui/CommonPanel.go | 3 --- ui/ui.go | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ui/CommonPanel.go b/ui/CommonPanel.go index 0dd2a122..b0e77588 100755 --- a/ui/CommonPanel.go +++ b/ui/CommonPanel.go @@ -15,9 +15,6 @@ import ( "github.com/Z-Bolt/OctoScreen/utils" ) -// OctoScreenVersion - set at compilation time. -var OctoScreenVersion = "2.7.0" - type CommonPanel struct { UI *UI grid *gtk.Grid diff --git a/ui/ui.go b/ui/ui.go index f202ee8f..835d4794 100755 --- a/ui/ui.go +++ b/ui/ui.go @@ -19,6 +19,7 @@ import ( "github.com/Z-Bolt/OctoScreen/utils" ) +// Set at compile time via -ldflags (See: MakeFile) var Version string var Build string