99
1010screenshot_backup_dir = 'screenshot_backups/'
1111
12+
1213def make_debug_dir (screenshot_backup_dir ):
1314 '''
1415 创建备份文件夹
1516 '''
1617 if not os .path .isdir (screenshot_backup_dir ):
1718 os .mkdir (screenshot_backup_dir )
1819
20+
1921def backup_screenshot (ts ):
2022 '''
2123 为了方便失败的时候 debug
2224 '''
2325 make_debug_dir (screenshot_backup_dir )
2426 shutil .copy ('autojump.png' , '{}{}.png' .format (screenshot_backup_dir , ts ))
2527
28+
2629def save_debug_screenshot (ts , im , piece_x , piece_y , board_x , board_y ):
2730 '''
28- 对debug图片加上详细的注释
31+ 对 debug 图片加上详细的注释
2932 '''
3033 make_debug_dir (screenshot_backup_dir )
3134 draw = ImageDraw .Draw (im )
@@ -39,23 +42,25 @@ def save_debug_screenshot(ts, im, piece_x, piece_y, board_x, board_y):
3942 del draw
4043 im .save ('{}{}_d.png' .format (screenshot_backup_dir , ts ))
4144
45+
4246def dump_device_info ():
4347 '''
4448 显示设备信息
4549 '''
4650 size_str = os .popen ('adb shell wm size' ).read ()
4751 device_str = os .popen ('adb shell getprop ro.product.model' ).read ()
4852 density_str = os .popen ('adb shell wm density' ).read ()
49- print ("如果你的脚本无法工作,上报issue时请copy如下信息:\n **********\
50- \n Screen: {size}\
51- \n Density: {dpi}\
52- \n DeviceType: {type}\
53- \n OS: {os}\
54- \n Python: {python}\n **********" .format (
55- size = size_str .strip (),
56- type = device_str .strip (),
57- dpi = density_str .strip (),
58- os = sys .platform ,
59- python = sys .version
60- )
61- )
53+ print ("""如果你的脚本无法工作,上报 issue 时请 copy 如下信息:
54+ **********
55+ Screen: {size}
56+ Density: {dpi}
57+ DeviceType: {type}
58+ OS: {os}
59+ Python: {python}
60+ **********""" .format (
61+ size = size_str .strip (),
62+ type = device_str .strip (),
63+ dpi = density_str .strip (),
64+ os = sys .platform ,
65+ python = sys .version
66+ ))
0 commit comments