# -*- 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._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.offer_setting(self._ex) def settings_done(self, settings): self._ex.update_setting(settings) self._learner.start_calcs(self._ex)