本文整理汇总了Python中Output.debug方法的典型用法代码示例。如果您正苦于以下问题:Python Output.debug方法的具体用法?Python Output.debug怎么用?Python Output.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output.debug方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_single_photo
# 需要导入模块: import Output [as 别名]
# 或者: from Output import debug [as 别名]
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()
示例2: start_run
# 需要导入模块: import Output [as 别名]
# 或者: from Output import debug [as 别名]
def start_run(script):
"""Starts a new run. Is called whenever someone pushes the button (when the script is waiting for it, of course)."""
global filename_schema
global download_id
Settings.runs += 1
download_id = ''.join(["%s" % randint(0, 9) for num in range(0, 8)])
filename_schema = time.strftime("photos/%Y%m%d-%H%M%S---" + download_id + "---{}.jpg")
Output.debug("start_run results: download_id=" + download_id + " filename_schema=" + filename_schema)
script.next_step()
示例3: run
# 需要导入模块: import Output [as 别名]
# 或者: from Output import debug [as 别名]
def run(self):
Output.debug("PhotoLoadThread " + str(self.index) + " starting...")
# Load the photo
Output.debug("PhotoLoadThread " + str(self.index) + ": Opening...")
self.image = Image.open(self.filename)
Output.debug("PhotoLoadThread " + str(self.index) + ": Fitting...")
self.image = ImageOps.fit(self.image, (Display.image_size(self.fullsize), Display.image_size(self.fullsize)))
Output.debug("PhotoLoadThread " + str(self.index) + ": TKing...")
images()[self.index] = ImageTk.PhotoImage(self.image)
Output.debug("PhotoLoadThread " + str(self.index) + " finished.")
示例4: next_step
# 需要导入模块: import Output [as 别名]
# 或者: from Output import debug [as 别名]
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)
示例5: reset
# 需要导入模块: import Output [as 别名]
# 或者: from Output import debug [as 别名]
def reset():
"""Calls usbreset to reset the USB port."""
Output.debug("In USBDevice.reset()")
if Settings.SIMULATE_USB_DEVICE:
Output.debug("Simulation. Resetting nothing.")
return
cmd = os.path.abspath(os.path.dirname(sys.argv[0])) + "/usbreset " + get_path()
Output.debug("Executing: " + cmd)
subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True).stdout.read()
示例6: button_pressed
# 需要导入模块: import Output [as 别名]
# 或者: from Output import debug [as 别名]
def button_pressed(some_var=None):
if Settings.WAIT_FOR_BUTTON_PRESS:
Settings.WAIT_FOR_BUTTON_PRESS = False
if Settings.ON_BUTTON_PRESS is not None:
Output.debug("Button pressed. Running code")
temp = Settings.ON_BUTTON_PRESS
Settings.ON_BUTTON_PRESS = None
cancel_run()
temp()
else:
Output.debug("Button pressed, but Settings.ON_BUTTON_PRESS is None.")
else:
Output.debug("Button pressed, but we are not waiting for this event.")
示例7: call_photo_thread
# 需要导入模块: import Output [as 别名]
# 或者: from Output import debug [as 别名]
def call_photo_thread(number, is_temp_photo=False):
"""Tells PhotoThread to take a photo and waits for it to return."""
Output.debug("This is call_photo_thread().")
global photo_thread
global filename_schema
Output.debug("photo_thread: " + str(photo_thread))
if is_temp_photo:
photo_thread.set_data("temp.jpg", number, fullsize=True)
else:
photo_thread.set_data(filename_schema.format(number), number)
photo_thread.run()
while True:
Output.debug("Warte auf photo_taken...")
if photo_thread.photo_taken:
break
time.sleep(0.1)
示例8: find
# 需要导入模块: import Output [as 别名]
# 或者: from Output import debug [as 别名]
def find():
"""Returns the USB port address of the camera."""
global __path
Output.debug("In USBDevice.find()")
if Settings.SIMULATE_USB_DEVICE:
__path = "/dev/bus/usb/042/023"
Output.debug("Simulation! Pretending the device is " + __path + ".")
return __path
result = subprocess.Popen("gphoto2 --auto-detect", stdout=subprocess.PIPE, shell=True).stdout.read()
Output.debug("Result of `gphoto2 --auto-detect`: " + result)
match = re.compile("(?P<camera>[^\n]+?) +usb:(?P<device>[0-9]{3}),(?P<port>[0-9]{3})",re.MULTILINE).search(result)
if match != None:
Output.notice("Found camera: " + match.group('camera') + " on USB port " + match.group('device') + "," + match.group('port'))
__path = "/dev/bus/usb/" + match.group('device') + "/" + match.group('port')
Output.notice("Path is now: " + __path)
return __path
raise "Camera not found. Connect it to the Pi, switch it on and verify that `gphoto2 --auto-detect` finds it."
示例9: single_photo
# 需要导入模块: import Output [as 别名]
# 或者: from Output import debug [as 别名]
def single_photo(some_var=None):
cancel_run()
Output.debug("single_photo started")
call_photo_thread(1, is_temp_photo=True)
Output.debug("call_photo_thread() returned")
show_single_photo()