setting time rate to zero (7 key) doesn't pause scripts

Bug #730180 reported by Matthew Gates
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Stellarium
Fix Released
Medium
Sibi Antony

Bug Description

summary says it all...

Changed in stellarium:
status: New → Confirmed
assignee: nobody → Matthew Gates (matthew-porpoisehead)
importance: Undecided → Medium
milestone: none → 1.0.0
Revision history for this message
Alexander Wolf (alexwolf) wrote :

I can't reproduce this bug on version 0.11.1 of Stellarium

Changed in stellarium:
milestone: 1.0.0 → none
Changed in stellarium:
assignee: Matthew Gates (matthew-porpoisehead) → nobody
status: Confirmed → Fix Released
Revision history for this message
Sibi Antony (sibi-antony) wrote :

I guess this problem is still present. Though the timerate is set to zero, the script continues to execute.

Seems like QScriptEngine doesn't provide pause functionality.
From what I understand, there are no direct ways to pause script evaluation. The possibility is to attach a QScriptEngineDebugger and interupt the script execution.

If someone has any other ideas/qt hacks, please let me know. I am willing to fix this.

Changed in stellarium:
status: Fix Released → In Progress
Revision history for this message
Sibi Antony (sibi-antony) wrote :

I would suggest to keep the timerate setting and script pausing separate for mainly 2 reasons. One, the user might expect the script to resume from pausing with last known timerate - which requires to remember the last timerate etc.

Second - Currently, the script rate changes are performed (setScriptRate()) relying on the wait() used inside a script. i.e. on an assumption that the script uses wait() calls and thereby tweaking the wait() time. However, this is not good for pause, since for lengthy scripts which doesn't use wait() at all, the pause will never happen. A better approach is to identify each script statement execution and once a gui pause event is received, intercept the script execution.

So we can keep the timerate and script pausing separate for now, unless until it is really necessary.
For a user who wishes to pause a script, I am implementing a script pausing based on QScriptEngineAgent. We can have a keyboard shortcut to map this to pause/play scripts - much like in old Stellarium versions (0.9.1)

Revision history for this message
Sibi Antony (sibi-antony) wrote :

Patch for script pause functionality.

Some of the options considered were :

1. Use a QScriptEngineDebugger and issue intercept
2. Use QScriptEngineAgent and wait and processEvents() until resumed.
3. A hybrid signal-slot, with a signal emitted during pause , which is caught by a JS slot.
 The JS slot will wait until a resume signal is received.

The first method is a bit of overkill, and will need tweaks for linker/include options.
The agent based method requires explicit calling of processEvents() (The QScriptEngineDebugger does the same thing - uses QScriptEngineAgent, but is transparent )
The JS slot to wait - I don't think the slots are really meant to block, generally they're only seen used with getters/setters.

The patch uses the second approach. It ensures pause-on-next-statement, but please keep in mind that there are situations wherein the pause is not obvious. For eg: if the previous statement had continuous operations like fading, zooming to an object etc. it will continue for the configured duration.

Revision history for this message
Sibi Antony (sibi-antony) wrote :

The shortcuts.
Old stellarium versions had key '6' for pausing and 'K' for resume. Since 'K' is already taken for timerate setting, I'm using '5' and '6'.
Also have key binding for stopping script. Please reassign them if required.

Revision history for this message
Alexander Wolf (alexwolf) wrote :
Changed in stellarium:
milestone: none → 0.11.4
assignee: nobody → Sibi Antony (sibi-antony)
status: In Progress → Fix Committed
Changed in stellarium:
status: Fix Committed → Fix Released
tags: added: blocks-hwcert-enablement
Revision history for this message
Alexander Wolf (alexwolf) wrote :

James, how HWE Next Project related with Stellarium?

tags: removed: blocks-hwcert-enablement
no longer affects: hwe-next
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.