Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ReckonPrimer.activity/coach.py
blob: 310538d89382037d14b4908e3941d0af72e6e571 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-

import os
import pprint
import pickle
from display import Display

class Coach:
    """ The coach supervises the selection of exercises. """
    print('in coach, class definition')

    def __init__(self):
        #print("in coach.__init__")
        self._ex = None # the learner can change the settings of _this_ exerc

    def register(self, sess, dis, collect, learner):
        self._sess = sess
        self._dis = dis
        self._collect = collect
        self._learner = learner
        print('in coach.register, exaddsimp =', self._collect.select(0))
        print('in coach.register, exaddsimp._display =', self._collect.select(0)._display._testvar)
        print('in coach.register, expassten =', self._collect.select(1))
        print('in coach.register, expassten._display =', self._collect.select(1)._display._testvar)       
        print('in coach.register, extimesdiv=', self._collect.select(2))
        print('in coach.register, extimesdiv._display=', self._collect.select(2)._display._testvar)

    def request_exercise(self):
        """ This preliminary version just lets the Learner select. """
        #print("in coach.request_exercise")
        self._dis.offer_coll_to_learner(self._collect)
        # calls back with notify('exerc-selected'... OR 'switch-to-setts'

    def exercise_selected(self, key):
        self._dis.init_calc()
        self._ex = self._collect.select(key)
        self._learner.start_calcs(self._ex)
    
    def switch_to_settings(self, key):
        self._ex = self._collect.select(key)
        self._dis.init_calc()
        self._dis.offer_setting(self._ex)        
    
    def settings_done(self, settings):
        self._ex.update_setting(settings)
        self._dis.init_calc()
        self._learner.start_calcs(self._ex)