def left_button_click(self, context): """OVERRIDE METHOD from abstract super class. if user clicks on left button, the number increase of one unit and then the audio interface tells the new number""" self.counter.decrease() list_element = self.list_to_scroll[self.counter.get_value()] output_interface.output(list_element)
def __init__(self, list_to_scroll, minimum=1): super(State, self).__init__() self.counter = Simple_counter(minimum, len(list_to_scroll) - 1) self.list_to_scroll = list_to_scroll list_element = self.list_to_scroll[self.counter.get_value()] output_interface.output(list_element)
def start(initial_value): """cuntdown from initial_value to 0. Each second I give output remaining seconds""" for x in range(initial_value, 0, -1): oldnow = time.time() output_interface.output(str(x), 250) delay = float(time.time()) - oldnow if (delay >= 0.0 and delay < 1.0): time.sleep(1.0 - delay)
def notify(self, percentage, sensor_position): self.result_sum += percentage self.n_result += 1 if(percentage<MINIMUM_PERCENTAGE): output_interface.output(ERROR + " " + lang.dictionary[sensor_position]) else: output_interface.output(CORRECT + " " + lang.dictionary[sensor_position])
# -*- coding: utf-8 -*- import pyttsx import vocal_synthesizer as vs vs.init() vs.output("it works")
def left_button_click(self, context): """OVERRIDE METHOD from abstract super class. user don't want to confirm current number -> the state returns to inital_state to allow user to select another number""" output_interface.output(NO + ", " + DISCARDED_VALUE) context.state = context.initial_state
def right_button_click(self, context): """OVERRIDE METHOD from abstract super class. user confirmed current number -> current module can return the selected number and its work is done""" output_interface.output(YES) context.finish = True
def __init__(self, selected): super(State, self).__init__() output_interface.output(CONFIRM + " " + str(selected) + "?")
def right_button_click(self, context): """OVERRIDE METHOD from abstract super class. if user clicks on right button, the number increase of one unit and then the audio interface tells the new number""" self.counter.increase() output_interface.output(self.counter.get_value())
def __init__(self): super(State, self).__init__() self.counter = Simple_counter(0, MAX_EXERCISE_ID) output_interface.output(self.counter.get_value())