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() output_interface.output(self.counter.get_value())
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(DISCARDED_VALUE) context.state = context.initial_state
def __init__(self): super(State, self).__init__() self.counter = Simple_counter(0, MAX_EXERCISE_ID) output_interface.output(NUMBER_SETTINGS_GUIDE)
def __init__(self): super(State, self).__init__() output_interface.output(CONFIRM)
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() list_element = self.list_to_scroll[self.counter.get_value()] output_interface.output(list_element)
def __init__(self, list_to_scroll): super(State, self).__init__() self.counter = Simple_counter(0, len(list_to_scroll) - 1) self.list_to_scroll = list_to_scroll output_interface.output(NUMBER_SETTINGS_GUIDE)
def start(initial_value): """cuntdown from initial_value to 0. Each second I give output remaining seconds""" for x in reversed(xrange(1, initial_value)): oldnow = time.time() output_interface.output(str(x)) time.sleep(1.0 - (time.time() - oldnow))
#coding: utf-8 import config import button_interface as bi import _test_output as output_interface from lang import dictionary from lang import dict_values_sorted #SELECT TIME #getting list of all items in time_dictionary (converting dictionary into a list) time_dictionary = dictionary["time_dictionary"] list_values = dict_values_sorted(time_dictionary) print list_values initial_state = bi.Selecting_from_list_state(list_values) obj = bi.Button_interface_thread(initial_state) print("DEBUG: ", obj) #starting thread obj.start() while (obj.finish != True): pass output_interface.output("finito")