From 56992b1d7fc5cb8f93680ec809a440442c1b09b6 Mon Sep 17 00:00:00 2001 From: LmeSzinc Date: Wed, 27 May 2020 02:42:25 +0800 Subject: [PATCH] Fix: dev_tools import error - Use `python -m dev_tools.button_extract` to run --- dev_tools/button_extract.py | 6 ++---- dev_tools/emulator_test.py | 5 ++++- doc/development.md | 4 ++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dev_tools/button_extract.py b/dev_tools/button_extract.py index 7d2ac6244..fc9848b41 100644 --- a/dev_tools/button_extract.py +++ b/dev_tools/button_extract.py @@ -3,8 +3,6 @@ import os import numpy as np from PIL import Image -os.chdir('../') - from module.base.button import get_color from module.config.config import AzurLaneConfig from module.logger import logger @@ -179,5 +177,5 @@ class AssetExtractor: me = ModuleExtractor(name=module, config=config) me.write() - -ae = AssetExtractor(AzurLaneConfig()) +if __name__ == '__main__': + ae = AssetExtractor(AzurLaneConfig('template')) diff --git a/dev_tools/emulator_test.py b/dev_tools/emulator_test.py index 591109622..62bba5ac3 100644 --- a/dev_tools/emulator_test.py +++ b/dev_tools/emulator_test.py @@ -1,6 +1,9 @@ import time import numpy as np +import module.config.server as server + +server.server = 'cn' # Don't need to edit, it's used to avoid error. from module.config.config import AzurLaneConfig from module.device.device import Device @@ -33,5 +36,5 @@ class Config: USE_ADB_SCREENSHOT = False -az = EmulatorChecker(AzurLaneConfig().merge(Config())) +az = EmulatorChecker(AzurLaneConfig('template').merge(Config())) az.stress_test() diff --git a/doc/development.md b/doc/development.md index 9cce14dd5..86a3bc822 100644 --- a/doc/development.md +++ b/doc/development.md @@ -78,6 +78,10 @@ BATTLE_PREPARATION = Button(area=(1043, 607, 1241, 667), color=(234, 179, 97), b button_extract.py会自动提取按钮的属性, 免去了人工输入的烦恼 + ``` + python -m dev_tools.button_extract + ``` + 8. **使用按钮** 继承 module.base.base 下的 ModuleBase 类, 可以调用以下方法: