juliencegarra / OpenMATB

OpenMATB: A Multi-Attribute Task Battery promoting task customization, software extendability and experiment replicability
Other
43 stars 32 forks source link

Pause the simulation through the scenario #27

Open thomakl opened 1 year ago

thomakl commented 1 year ago

Hi,

Is there a way to make the simulation pause with its modal window from the "core.window.pause_prompt" method through the scenario.txt ? I would like to ask questions to my participant in regard to the simulation and I will measure the time they need to answer it. To achieve that, I would like the system to pause and when the participant is done, he/she could press the "P" to resume the simulation.

Cheers TL

benoitvalery commented 1 year ago

Hi @thomakl, the feature you are looking for (scheduled pause) is simply the instructions plugin. Once enabled it will trigger a pause at required time with optional instructions (leave it empty if You want). Ses our Wiki for more information. Best. Benoît.

thomakl commented 1 year ago

Hi Benoit,

I am digging into the instructions plugin and I can't find what I am looking for. As I understand it correctly, the instruction plugin when triggered will pause all the other plugins (that is what I want) and hide them (that is not what I want). However, as for the other behaviour of the instruction plugin such as maxdurationsec and response-key those are in favour.

Cheers, TL

benoitvalery commented 1 year ago

Could you try to set the instructions plugin parameter 'taskplacement' to ' invisible' and see what happens. There might be some adjustment to make since this plugin has not been thought to be hidden.

thomakl commented 1 year ago

Setting 'taskplacement' to 'insivible' is not in the dictionnary. input:

0:00:02;instructions;filename;empty.txt
0:00:02;instructions;taskplacement;invisible
0:00:02;instructions;start

result: Erreur � la ligne 43. taskplacement devrait �tre compris dans ['fullscreen', 'topmid', 'topright', 'topleft', 'bottomleft', 'bottommid', 'bottomright'] (et non invisible) So I tried to set the variable to 'bottomleft' but I have got the following issue :

Traceback (most recent call last):
  File "C:\Users\username\Projets\openmatb\main.py", line 58, in <module>
    app = OpenMATB()
  File "C:\Users\username\Projets\openmatb\main.py", line 55, in __init__
    self.scheduler.run()
  File "C:\Users\username\Projets\openmatb\core\scheduler.py", line 266, in run
    self.event_loop.run()
  File "C:\Users\username\Projets\openmatb\venv\lib\site-packages\pyglet\app\base.py", line 169, in run
    timeout = self.idle()
  File "C:\Users\username\Projets\openmatb\venv\lib\site-packages\pyglet\app\base.py", line 239, in idle
    redraw_all = self.clock.call_scheduled_functions(dt)
  File "C:\Users\username\Projets\openmatb\venv\lib\site-packages\pyglet\clock.py", line 255, in call_scheduled_functions
    item.func(dt, *item.args, **item.kwargs)
  File "C:\Users\username\Projets\openmatb\core\clock.py", line 29, in advance
    self.tick()
  File "C:\Users\username\Projets\openmatb\venv\lib\site-packages\pyglet\clock.py", line 348, in tick
    self.call_scheduled_functions(delta_t)
  File "C:\Users\username\Projets\openmatb\venv\lib\site-packages\pyglet\clock.py", line 255, in call_scheduled_functions
    item.func(dt, *item.args, **item.kwargs)
  File "C:\Users\username\Projets\openmatb\core\scheduler.py", line 109, in update
    [p.update(self.scenariotime) for p in ap]
  File "C:\Users\username\Projets\openmatb\core\scheduler.py", line 109, in <listcomp>
    [p.update(self.scenariotime) for p in ap]
  File "C:\Users\username\Projets\openmatb\plugins\abstract.py", line 437, in update
    self.hide()          # If so retrieve the next slide and show it
  File "C:\Users\username\Projets\openmatb\plugins\abstract.py", line 102, in hide
    self.get_widget('task_title').hide()
AttributeError: 'NoneType' object has no attribute 'hide'