1
0
Fork 0

Adapting to new screen-shot command

Success/error report is now automatically displayed by a listener.
This commit is contained in:
ThorstenB 2011-06-13 20:38:04 +02:00
parent 4f838934cb
commit 04fb5b3066
3 changed files with 14 additions and 21 deletions

View file

@ -1254,6 +1254,17 @@ var common_aircraft_keys = {
],
};
_setlistener("/sim/signals/screenshot", func {
var path = getprop("/sim/paths/screenshot-last");
var button = { button: { legend: "Ok", default: 1, binding: { command: "dialog-close" }}};
var success= getprop("/sim/signals/screenshot");
if (success) {
popupTip("Screenshot written to '" ~ path ~ "'", 3);
} else {
popupTip("Error writing screenshot '" ~ path ~ "'", 600, button);
}
});
var do_welcome = 1;
_setlistener("/sim/signals/fdm-initialized", func {
var haveTutorials = size(props.globals.getNode("/sim/tutorials", 1).getChildren("tutorial"));

View file

@ -58,12 +58,7 @@
<command>nasal</command>
<script>
gui.popdown();
var success = fgcommand("screen-capture");
var path = getprop("/sim/paths/screenshot-last");
if (success)
gui.popupTip("Screenshot written to '" ~ path ~ "'");
else
gui.popupTip("Error writing screenshot '" ~ path ~ "'");
fgcommand("screen-capture");
</script>
</binding>
</item>
@ -568,7 +563,7 @@
</binding>
</item>
<item>
<item>
<label>Reload HUD</label>
<binding>
<command>reinit</command>

View file

@ -1106,20 +1106,7 @@ top down before the key bindings are parsed.
<name>F3</name>
<desc>Capture screen</desc>
<binding>
<command>nasal</command>
<script>
var success = fgcommand("screen-capture");
var path = getprop("/sim/paths/screenshot-last");
var threading = getprop("/sim/rendering/multithreading-mode");
var button = { button: { legend: "Ok", default: 1, binding: { command: "dialog-close" }}};
if (threading and threading != "SingleThreaded") {
gui.popupTip("Threading model must be SingleThreaded (or not defined) for snapshots to work.", 600, button);
} elsif (success) {
gui.popupTip("Screenshot written to '" ~ path ~ "'", 2);
} else {
gui.popupTip("Error writing screenshot '" ~ path ~ "'", 600, button);
}
</script>
<command>screen-capture</command>
</binding>
<mod-shift>
<desc>Load panel</desc>