from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants def vars_for_all_templates(self): return { 'round': self.round_number, 'dot_block': self.player.dot_block , 'static_path': '{}/dot_plot_{}.png'.format(Constants.name_in_url, int(self.player.task_identifier_cloud)), 'num_rounds': Constants.num_rounds, 'incentive': c(self.session.config['incentive_dots']) } class Slider(Page): def is_displayed(self): return self.player.task_identifier_percent is not None form_model = 'player' form_fields = ['guess'] def before_next_page(self): if self.player.on_paying_round: self.player.set_payoffs() class Wait(Page): def is_displayed(self): return self.player.task_identifier_percent is not None timeout_seconds = 1 page_sequence = [ Slider, Wait, ]