Skip to content

Commit

Permalink
update pve.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fllesser committed Jan 11, 2025
1 parent 83e3dbf commit 9f83143
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions nonebot_plugin_fortnite/pve.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,14 @@ async def take_screenshot(locator, path):
return vb_file

def combine_imgs():
# 打开截图文件(如果存在)
combined_image = None
img_paths = [hot_info_1_path, container_hidden_xs_path, hot_info_2_path]
img_paths = [i for i in img_paths if i.exists()]
if not img_paths:
raise Exception('所有选择器的截图文件均不存在')
try:
# 打开截图文件(如果存在)
images = []
combined_image = None
image_paths = [hot_info_1_path, container_hidden_xs_path, hot_info_2_path]
for img_path in image_paths:
if img_path.exists():
images.append(Image.open(img_path))

if not images:
return
images = [Image.open(img_path) for img_path in img_paths]
# 获取尺寸并创建新图像
widths, heights = zip(*(img.size for img in images))
total_width = max(widths)
Expand All @@ -81,8 +78,7 @@ def combine_imgs():
# 关闭并删除所有截图文件
for img in images:
img.close()
for img_path in image_paths:
if img_path.exists():
img_path.unlink()
for img_path in img_paths:
img_path.unlink()
if combined_image:
combined_image.close()

0 comments on commit 9f83143

Please sign in to comment.