gui.nas: use nasal-dir-initialized signal for INIT func, so that it's
earlier available. (The settimer/1 was a workaround for another problem that should be fixed by now.) globals.nas: load $FG_HOME/Nasal/ files as first settimer(0) function, so that it always comes after all nasal-dir-initialized callbacks This should fix the glide_slope_tunnel/popupTip bug and makes the startup order clearer and cleaner.
This commit is contained in:
parent
804ccca250
commit
d1fd61c728
2 changed files with 10 additions and 7 deletions
Nasal
|
@ -131,11 +131,11 @@ var printlog = func(level, args...) {
|
||||||
# Load and execute ~/.fgfs/Nasal/*.nas files in alphabetic order
|
# Load and execute ~/.fgfs/Nasal/*.nas files in alphabetic order
|
||||||
# after all $FG_ROOT/Nasal/*.nas files were loaded.
|
# after all $FG_ROOT/Nasal/*.nas files were loaded.
|
||||||
#
|
#
|
||||||
_setlistener("/sim/signals/nasal-dir-initialized", func {
|
settimer(func {
|
||||||
var path = getprop("/sim/fg-home") ~ "/Nasal";
|
var path = getprop("/sim/fg-home") ~ "/Nasal";
|
||||||
if((var dir = directory(path)) == nil) return;
|
if((var dir = directory(path)) == nil) return;
|
||||||
foreach(var file; sort(dir, cmp))
|
foreach(var file; sort(dir, cmp))
|
||||||
if(size(file) > 4 and substr(file, -4) == ".nas")
|
if(size(file) > 4 and substr(file, -4) == ".nas")
|
||||||
io.load_nasal(path ~ "/" ~ file, substr(file, 0, size(file) - 4));
|
io.load_nasal(path ~ "/" ~ file, substr(file, 0, size(file) - 4));
|
||||||
});
|
}, 0);
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ var fdm = getprop("/sim/flight-model");
|
||||||
var screenHProp = nil;
|
var screenHProp = nil;
|
||||||
var tipArg = nil;
|
var tipArg = nil;
|
||||||
|
|
||||||
var INIT = func {
|
_setlistener("/sim/signals/nasal-dir-initialized", func {
|
||||||
screenHProp = props.globals.getNode("/sim/startup/ysize");
|
screenHProp = props.globals.getNode("/sim/startup/ysize");
|
||||||
tipArg = props.Node.new({ "dialog-name" : "PopTip" });
|
tipArg = props.Node.new({ "dialog-name" : "PopTip" });
|
||||||
|
|
||||||
|
@ -104,10 +104,13 @@ var INIT = func {
|
||||||
|
|
||||||
var fps = props.globals.getNode("/sim/rendering/fps-display", 1);
|
var fps = props.globals.getNode("/sim/rendering/fps-display", 1);
|
||||||
setlistener(fps, fpsDisplay, 1);
|
setlistener(fps, fpsDisplay, 1);
|
||||||
setlistener("/sim/startup/xsize",
|
setlistener("/sim/startup/xsize", func {
|
||||||
func { if (fps.getValue()) { fpsDisplay(0); fpsDisplay(1) } });
|
if (fps.getValue()) {
|
||||||
}
|
fpsDisplay(0);
|
||||||
settimer(INIT, 1);
|
fpsDisplay(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
Loading…
Add table
Reference in a new issue