From eed2bc3259b719d577c552f07f66c135fbdc90bb Mon Sep 17 00:00:00 2001 From: Roman Ludwicki <romek21@op.pl> Date: Wed, 28 Sep 2022 16:43:50 +0200 Subject: [PATCH] Correct margin for message text in the "Download scenery" dialog. Minor correction for margin and padding for layout. --- gui/dialogs/terrasync.xml | 268 +++++++++++++++++--------------------- 1 file changed, 116 insertions(+), 152 deletions(-) diff --git a/gui/dialogs/terrasync.xml b/gui/dialogs/terrasync.xml index b1f830ab5..80eb6f302 100644 --- a/gui/dialogs/terrasync.xml +++ b/gui/dialogs/terrasync.xml @@ -2,76 +2,75 @@ <PropertyList> <name>terrasync</name> - + <nasal> - <open> - <![CDATA[ + <open> + <![CDATA[ + var computeStatusText = func { + # first, check if the system is actually enabled + if (!getprop('/sim/terrasync/enabled')) + return "Downloading disabled"; -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 "Automatic download inactive"; -# only happens if terrasync failed to activate, so -# indicates a problem - if (!getprop('/sim/terrasync/active')) - return "Automatic download inactive"; + # we need to suggest some remedial action here! + if (getprop('/sim/terrasync/stalled')) + return "Downloading has stalled. Check your network connection and settings"; -# 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)); + } - 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"; + } -# 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); -# 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); + } - 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(); -# 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"); - - ]]> - </open> + setprop("/sim/gui/dialogs/terrasync/display-mode", "0"); + ]]> + </open> - <close> - statusTimer.stop(); - statusTimer = nil; - </close> - + <close> + statusTimer.stop(); + statusTimer = nil; + </close> + </nasal> - + <layout>vbox</layout> + <default-padding>3</default-padding> <group> <layout>hbox</layout> - <default-padding>4</default-padding> + <default-padding>1</default-padding> <empty><stretch>1</stretch></empty> @@ -86,7 +85,6 @@ setprop("/sim/gui/dialogs/terrasync/display-mode", "0"); <pref-height>16</pref-height> <legend></legend> <keynum>27</keynum> - <border>2</border> <binding> <command>dialog-close</command> </binding> @@ -95,40 +93,33 @@ setprop("/sim/gui/dialogs/terrasync/display-mode", "0"); <hrule/> - <text> - <name>message</name> - <color> - <red>1.0</red> - <green>0.4</green> - <blue>0.4</blue> - </color> - <halign>left</halign> - <property>/sim/terrasync/ui-message-node</property> - <live>true</live> - </text> - <group> <layout>vbox</layout> + <padding>5</padding> <group> - <layout>table</layout> + <layout>hbox</layout> <halign>left</halign> - <equal>false</equal> - <!-- only for a gap --> <text> - <row>0</row> - <col>0</col> - <halign>center</halign> - <label> </label> + <name>message</name> + <color> + <red>1.0</red> + <green>0.4</green> + <blue>0.4</blue> + </color> + <property>/sim/terrasync/ui-message-node</property> + <live>true</live> </text> + </group> + + <group> + <layout>hbox</layout> + <halign>left</halign> <checkbox> <name>terrasync-enabled</name> <halign>left</halign> - <row>0</row> - <col>1</col> - <colspan>3</colspan> <property>/sim/terrasync/enabled</property> <label>Enable automatic scenery download</label> <live>true</live> @@ -143,23 +134,20 @@ setprop("/sim/gui/dialogs/terrasync/display-mode", "0"); </not-equals> </enable> </checkbox> + </group> + + <group> + <layout>hbox</layout> + <halign>left</halign> <!-- only for a gap --> <text> - <row>1</row> - <col>1</col> - <halign>center</halign> <label> </label> </text> <checkbox> <name>ai-data-enabled</name> <halign>left</halign> - <row>1</row> - <col>2</col> -<!-- - <colspan>2</colspan> ---> <property>/sim/terrasync/ai-data-enabled</property> <label>Update AI Traffic during FG start</label> <live>true</live> @@ -168,21 +156,18 @@ setprop("/sim/gui/dialogs/terrasync/display-mode", "0"); <object-name>ai-data-enabled</object-name> </binding> <enable> - <property>/sim/terrasync/enabled</property> - <property>/sim/traffic-manager/enabled</property> + <property>/sim/terrasync/enabled</property> + <property>/sim/traffic-manager/enabled</property> </enable> </checkbox> <button> - <row>1</row> - <col>3</col> <legend>Update Now</legend> - <border>2</border> <equal>true</equal> <enable> - <property>/sim/terrasync/enabled</property> - <property>/sim/traffic-manager/enabled</property> - <property>/sim/terrasync/ai-data-enabled</property> + <property>/sim/terrasync/enabled</property> + <property>/sim/traffic-manager/enabled</property> + <property>/sim/terrasync/ai-data-enabled</property> </enable> <binding> <command>property-assign</command> @@ -196,12 +181,9 @@ setprop("/sim/gui/dialogs/terrasync/display-mode", "0"); </binding> </button> -<!-- <checkbox> + <!-- <checkbox> <name>other-data-enabled</name> <halign>left</halign> - <row>2</row> - <col>2</col> - <colspan>2</colspan> <property>/sim/terrasync/other-data-enabled</property> <label>Download other data files</label> <live>true</live> @@ -212,39 +194,40 @@ setprop("/sim/gui/dialogs/terrasync/display-mode", "0"); <enable> <property>/sim/terrasync/enabled</property> </enable> - </checkbox> ---> + </checkbox> --> + </group> + + <group> + <layout>hbox</layout> + <halign>center</halign> + <text> <name>warning_text</name> - <row>3</row> - <col>0</col><colspan>4</colspan> <color> <red>1.0</red> <green>0.4</green> <blue>0.4</blue> <alpha>1</alpha> </color> - <halign>center</halign> <label/> </text> - </group> + </group> - <hrule/> + <hrule/> + + <group> + <layout>vbox</layout> + <halign>left</halign> + <default-padding>5</default-padding> <group> <layout>hbox</layout> <halign>left</halign> - <default-padding>4</default-padding> - - <!-- only for a gap --> - <text> - <halign>center</halign> - <label> </label> - </text> <button> <legend>Information</legend> + <equal>true</equal> <binding> <command>property-assign</command> <property>/sim/gui/dialogs/terrasync/display-mode</property> @@ -252,14 +235,9 @@ setprop("/sim/gui/dialogs/terrasync/display-mode", "0"); </binding> </button> - <!-- only for a gap --> - <text> - <halign>center</halign> - <label></label> - </text> - <button> - <legend> Log </legend> + <legend>Log</legend> + <equal>true</equal> <binding> <command>property-assign</command> <property>/sim/gui/dialogs/terrasync/display-mode</property> @@ -273,11 +251,6 @@ setprop("/sim/gui/dialogs/terrasync/display-mode", "0"); <layout>hbox</layout> <halign>left</halign> - <!-- gap --> - <text> - <label></label> - </text> - <group> <layout>table</layout> <halign>fill</halign> @@ -456,43 +429,34 @@ setprop("/sim/gui/dialogs/terrasync/display-mode", "0"); </equals> </visible> - <halign>fill</halign> - <valign>fill</valign> - <stretch>true</stretch> - <pref-width>600</pref-width> + <halign>fill</halign> + <valign>fill</valign> + <stretch>true</stretch> + <pref-width>600</pref-width> <pref-height>300</pref-height> <logclass>terrasync</logclass> - <padding>6</padding> </loglist> - </group> - - <!-- gap --> - <text> - <label></label> - </text> - </group> <!-- end of tabbed group --> + </group> - <hrule/> + <hrule/> - <group> - <layout>hbox</layout> - <default-padding>3</default-padding> - <empty><stretch>true</stretch></empty> + <group> + <layout>hbox</layout> + <default-padding>3</default-padding> + <empty><stretch>true</stretch></empty> - <button> - <legend>Close</legend> - <border>2</border> - <equal>true</equal> - <key>Esc</key> - <binding> - <command>dialog-close</command> - </binding> - </button> - <empty><stretch>true</stretch></empty> - </group> + <button> + <legend>Close</legend> + <equal>true</equal> + <key>Esc</key> + <binding> + <command>dialog-close</command> + </binding> + </button> + <empty><stretch>true</stretch></empty> </group> </PropertyList>