terrasync 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(); statusTimer.stop(); statusTimer = nil; vbox hbox 4 1 1 message 1.0 0.4 0.4 center vbox table left false 0 0 center terrasync-enabled left 0 1 3 /sim/terrasync/enabled true dialog-apply terrasync-enabled /sim/terrasync/scenery-dir 1 1 center ai-data-enabled left 1 2 /sim/terrasync/ai-data-enabled true dialog-apply ai-data-enabled /sim/terrasync/enabled other-data-enabled left 2 2 2 /sim/terrasync/other-data-enabled true dialog-apply other-data-enabled /sim/terrasync/enabled warning_text 3 04 1.0 0.4 0.4 1 center hbox left 4 center center hbox left table fill fill 0 table left top false 0 0 /sim/gui/dialogs/terrasync/display-mode 0 0 0 2 left 200 Status: %s /sim/gui/dialogs/terrasync/status true 0.7 0.7 0.7 1 left 1 0 0.7 0.7 0.7 1 1 1 %d /sim/terrasync/downloaded-kbytes true right true 0.7 0.7 0.7 1 left 2 0 0.7 0.7 0.7 1 2 1 %s /sim/terrasync/update-count true true right 0.7 0.7 0.7 1 left 3 0 0.7 0.7 0.7 1 3 1 %s /sim/terrasync/tile-count true true right 0.7 0.7 0.7 1 0 0 /sim/gui/dialogs/terrasync/display-mode 1 fill fill true 600 300 terrasync 6 hbox 3 true true /sim/terrasync/built-in-svn-available