# --------------------------------------------------------------------- # IMPORTS # --------------------------------------------------------------------- # from otree.api import * # We use explicit import instead of * in order to avoid import warnings from otree.api import models from otree.api import widgets from otree.api import Page from otree.api import WaitPage from otree.api import BaseConstants from otree.api import BaseSubsession from otree.api import BaseGroup from otree.api import BasePlayer # --------------------------------------------------------------------- # CLASSES # --------------------------------------------------------------------- class C(BaseConstants): NAME_IN_URL = 'start_disclaimer' # Define the players per group (since the value can be set dynamically within the settings.py we can keep it as none (should keep it as none)) PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 TIMER = 30 #TODO change later to desired length class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): pass # --------------------------------------------------------------------- # FUNCTIONS # --------------------------------------------------------------------- def js_vars_custom(player): ''' Override the js_vars function to pass certain variables to javascript Args: player (Player): the player to pass the variables to javascript for Returns: (dict): with the timer value handed over as timer and the current treatment handed over as treatment ''' return dict(timer=C.TIMER) # --------------------------------------------------------------------- # CLASSES - PAGES # --------------------------------------------------------------------- class ArrivalWaitPage(WaitPage): pass class StartWarningPage(Page): timeout_seconds = 99999 # Override the functions for the javascript variables and the timer with the custom functions js_vars = js_vars_custom # --------------------------------------------------------------------- # Define the order of the pages # --------------------------------------------------------------------- page_sequence = [ArrivalWaitPage, StartWarningPage]