def mainloop(d): transitions_iter = cycle(DisplayEffects.transitions) images_iter = cycle(DisplayEffects.static_images) while True: #next(transitions_iter)(d) #time.sleep(1) #next(images_iter)(d) DisplayEffects.display_burning_man(d) time.sleep(3)
def get_question_response(self, question): if not question: return "" DisplayEffects.scroll_text(self.display, question) SoundEffects.play_type_your_answer() DisplayEffects.display_text(self.display, '???', font=DisplayEffects.BigFont) answer_events = keyboard.record(until="enter") return next(keyboard.get_typed_strings(answer_events))
def get_boundary_selection(self, categories): if not categories or len(categories) == 0: return "" for i, cat in categories.items(): SoundEffects.categories[cat['name']].play() DisplayEffects.scroll_text(self.display, "{0}. {1} ".format(i, cat['display'])) SoundEffects.play_type_your_boundary() DisplayEffects.display_text(self.display, '???', font=DisplayEffects.BigFont) cat_events = keyboard.record(until="enter") return next(keyboard.get_typed_strings(cat_events))
def interaction_thread(disp): global key_pressed con = create_connection('data/le_data.db') with con: repo = Repository(con) io_manager = InteractionManager(disp) keyboard.on_press(on_press) while True: try: with display_lock: if key_pressed: keyboard.unhook_all() do_user_interaction(repo, io_manager) key_pressed = False keyboard.on_press(on_press) # Reset Static Image on display if DisplayEffects.current_image: DisplayEffects.current_image(disp) time.sleep(1) except Exception as e: print("Exception in interaction thread: " + str(e)) continue
def transition(d): DisplayEffects.random_transition(d)
def display_random_image(self): DisplayEffects.display_random_image(self.display)
def random_display_transition(self): DisplayEffects.random_transition(self.display)
def select_boundary(self): SoundEffects.play_random_boundary_selection() self.scroll_text("Select Your Boundary...") DisplayEffects.random_transition(self.display)
def try_again(self): SoundEffects.play_random_try_again() DisplayEffects.display_try_again(self.display) time.sleep(5)
def scroll_text(self, text): DisplayEffects.scroll_text(self.display, text)