Exemplo n.º 1
0
def show_single_photo():
	if PhotoThread.photo_load_threads()[0].is_alive():
		Output.debug("PLT is still running. Sleeping 0.5s before trying again.")
		Display.root().after(500, show_single_photo)
		return
	Display.show_single_photo()
	Output.debug("Display.show_single_photo() returned")
	Settings.WAIT_FOR_BUTTON_PRESS = True
	Settings.ON_BUTTON_PRESS = lambda: Settings.main_script.start()
Exemplo n.º 2
0
	def next_step(self):
		Settings.WAIT_FOR_BUTTON_PRESS = False
		Settings.AFTER_ID = None
		delay, command, additional, target_branch = self.lines[self.line]
		self.line += 1
		if self.line>=len(self.lines):
			self.line = 0

		if command=="text":
			if target_branch is not None:
				Settings.ON_BUTTON_PRESS = lambda: target_branch.start()
				Settings.WAIT_FOR_BUTTON_PRESS = True
			Display.display_text(additional)
		elif command=="photo":
			Output.debug("Photo! Number " + str(additional))
			functions.call_photo_thread(additional)
		elif command=="overview":
			if target_branch is not None:
				Settings.ON_BUTTON_PRESS = lambda: target_branch.start()
				Settings.WAIT_FOR_BUTTON_PRESS = True
			Display.show_overview()
		elif command=="clear":
			Display.clear()
		elif command=="branch":
			Display.root().after(delay, lambda: target_branch.start())
			return
		elif command=="wait":
			Settings.ON_BUTTON_PRESS = self.next_step
			Settings.WAIT_FOR_BUTTON_PRESS = True
			return
		elif command=="init_run":
			functions.start_run(self)
			return

		# check if the next command is a "photo"
		if self.lines[self.line][1]=="photo":
			delay = max(delay - Settings.PHOTO_DELAY, 1)

		if Settings.DEBUG_SHORT_DELAYS:
			delay = delay / 100 + 1
			
		#Output.debug("Waiting: " + str(delay))

		Settings.AFTER_ID = Display.root().after(delay, self.next_step)
Exemplo n.º 3
0
def cancel_run():
	try:
		Display.root().after_cancel(Settings.AFTER_ID)
	except Exception as e:
		pass
	Settings.AFTER_ID = None