From c44d39ec289aa41eca98b904430e72886dec86b2 Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Mon, 8 Apr 2019 14:16:34 +0200 Subject: [PATCH] Scenery Download (Terrasync) dialog Consolidate the two nasal sections into one (only one nasal section would be used). Make controls work properly and accurately reflect status. Remove OK and Apply as enable/disable takes effect immediately. Comment out unsupported "Download other data files" checkbox. Revised logic of AI Traffic to reflect status; added button to force update (normally AI Traffic update is only performed during startup) --- gui/dialogs/terrasync.xml | 216 ++++++++++++++++---------------------- 1 file changed, 91 insertions(+), 125 deletions(-) diff --git a/gui/dialogs/terrasync.xml b/gui/dialogs/terrasync.xml index 18425b9c6..2267e43fb 100644 --- a/gui/dialogs/terrasync.xml +++ b/gui/dialogs/terrasync.xml @@ -5,47 +5,63 @@ - - var computeStatusText = func { - # first, check if the system is actually enabled - if (!getprop('/sim/terrasync/enabled')) - return "Downloading disabled"; - - # only happens if terrasync failed to activate, so - # indicates a problem - if (!getprop('/sim/terrasync/active')) - return "unable to start downloading"; - - var errCount = getprop('/sim/terrasync/error-count'); - if (errCount > 0) - return "errors occurred during download"; - - # we need to suggest some remedial action here! - if (getprop('/sim/terrasync/stalled')) - return "Downloading has stalled. Check yuor network connection and settings"; - - if (getprop('/sim/terrasync/busy')) { - var kbytesSec = getprop('/sim/terrasync/transfer-rate-bytes-sec') / 1024; - return sprintf('Downloading: %dKB/sec', int(kbytesSec)); - } - - # we are enabled but not busy, so idle - return "Idle"; - } - - # timer function, update summary status string - var updateStatusText = func { - - var s = computeStatusText(); - setprop("/sim/gui/dialogs/terrasync/status", s); - } - - # the TerraSync properties of interest are tied, so we can't use a - # listener. Let's poll while the dialog is open; not ideal but not - # a major problem. - var statusTimer = maketimer(0.4, updateStatusText); - statusTimer.start(); - updateStatusText(); + 0) + return "Errors occurred during download"; + +# we need to suggest some remedial action here! + if (getprop('/sim/terrasync/stalled')) + return "Downloading has stalled. Check your network connection and settings"; + + if (getprop('/sim/terrasync/busy')) { + var kbytesSec = getprop('/sim/terrasync/transfer-rate-bytes-sec') / 1024; + return sprintf('Downloading: %dKB/sec', int(kbytesSec)); + } + +# we are enabled but not busy, so idle + return "Ready"; +} + +# timer function, update summary status string +var updateStatusText = func { + var s = computeStatusText(); + setprop("/sim/gui/dialogs/terrasync/status", s); + + var msg = ""; + if (getprop("/sim/terrasync/available")) { + if (getprop("/sim/terrasync/enabled")) + msg = "Automatic download active; monitor your bandwidth on metered connection."; + } else { + if (getprop("/sim/terrasync/intialized")) + msg = "Automatic download not active."; + else + msg = "Automatic download not supported."; + } + setprop("/sim/terrasync/ui-message-node", msg); +} + +# the TerraSync properties of interest are tied, so we can't use a +# listener. Let's poll while the dialog is open; not ideal but not +# a major problem. +var statusTimer = maketimer(0.4, updateStatusText); +statusTimer.start(); +updateStatusText(); + +setprop("/sim/gui/dialogs/terrasync/display-mode", "0"); + + ]]> @@ -64,7 +80,7 @@ 1 - + 1 @@ -90,8 +106,9 @@ 0.4 0.4 - center - + left + /sim/terrasync/ui-message-node + true @@ -117,7 +134,7 @@ 1 3 /sim/terrasync/enabled - + true dialog-apply @@ -148,18 +165,42 @@ 2 --> /sim/terrasync/ai-data-enabled - + true dialog-apply ai-data-enabled - /sim/terrasync/enabled + /sim/terrasync/enabled + /sim/traffic-manager/enabled - + + + warning_text 3 @@ -403,36 +444,7 @@ true - - - -