Stellarium / stellarium

Stellarium is a free GPL software which renders realistic skies in real time with OpenGL. It is available for Linux/Unix, Windows and macOS. With Stellarium, you really see what you can see with your eyes, binoculars or a small telescope.
https://stellarium.org
GNU General Public License v2.0
7.48k stars 809 forks source link

Pause and resume Stellarium scripts #3043

Open dsagred opened 1 year ago

dsagred commented 1 year ago

Hi,

Stellarium offers a well documented scripting functionality which we use and intend to use in future for public outreach in schools.

Expected Behaviour

As in the documentation of the current Stellarium version, scripts can be paused and resumed. This is very essential for all scripts that run longer than a few seconds, especially when Stellarium is used for interactive planetarium shows.

Actual Behaviour

The current version does not implement the function pauseScript(). According to the discussion in Bug #766 it is a known technical issue, caused by Qt.

I am raising this in the hope this essential feature could be re-implemented in some way within this and future Stellarium versions.

System

Logfile

QAction::event: Ambiguous shortcut overload: Ctrl+D, R pauseScript() is deprecated and will no longer be available in future versions of Stellarium.

github-actions[bot] commented 1 year ago

Thanks for adding your first issue to Stellarium. If you have questions, please do not hesitate to contact us.

gzotti commented 1 year ago

We have documented the difference between Qt5- and Qt6-based builds. On Qt5-based builds pause and resume should still work. Currently there is no known way to re-implement this with Qt6.

starinastar commented 10 months ago

I created a workaround for this in the scripting system that uses the SetTimeRate(0.05) (for instance) to slow down time as a signal to pause. The script calls a function that does a while loop until time is sped up to "realtime" again by tapping the L key - k key does not work in this context for some reason? Is it a bug? I will file an issue separately).

Once the time setting is in realtime again, the while loop finishes and the script "unpauses"

Here's the function:

pauseByUserKey('L');

function pauseByUserKey(key) {
    var timerate = core.getTimeRate();
    core.setTimeRate(0.05);
    do
    {
        core.wait(1);
    }
    while( core.getTimeRate() < 0.1 );
    core.setTimeRate(timerate);
}

Full script below in .txt since Github doesn't like the .ssc file ending:

testing_pause_resume_hack_2.ssc.txt

I have also tested this hack pattern with some other key commands like "h" that toggles the horizon line, but that can cause unwanted visuals.