-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from JE-Chen/dev
Dev
- Loading branch information
Showing
54 changed files
with
1,151 additions
and
212 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...it_doc/auto_control_critical_exit_doc.rst → ...it_doc/auto_control_critical_exit_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...xecutor_doc/auto_control_executor_doc.rst → ...xecutor_doc/auto_control_executor_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
AutoControlGUI Executor Doc | ||
AutoControl Executor Doc | ||
========================== | ||
|
||
.. code-block:: python | ||
|
2 changes: 1 addition & 1 deletion
2
...ess_doc/auto_control_file_process_doc.rst → ...ess_doc/auto_control_file_process_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
AutoControlGUI File Process Doc | ||
AutoControl File Process Doc | ||
========================== | ||
|
||
|
||
|
2 changes: 1 addition & 1 deletion
2
...trol_image_doc/auto_control_image_doc.rst → ...trol_image_doc/auto_control_image_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
AutoControlGUI Image Doc | ||
AutoControl Image Doc | ||
========================== | ||
|
||
.. code-block:: python | ||
|
2 changes: 1 addition & 1 deletion
2
...eyboard_doc/auto_control_keyboard_doc.rst → ...eyboard_doc/auto_control_keyboard_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
AutoControlGUI Keyboard Doc | ||
AutoControl Keyboard Doc | ||
========================== | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ol_record_doc/auto_control_record_doc.rst → ...ol_record_doc/auto_control_record_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
AutoControlGUI Record Doc | ||
AutoControl Record Doc | ||
========================== | ||
|
||
|
||
|
2 changes: 1 addition & 1 deletion
2
...ol_screen_doc/auto_control_screen_doc.rst → ...ol_screen_doc/auto_control_screen_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
AutoControlGUI Screen Doc | ||
AutoControl Screen Doc | ||
========================== | ||
|
||
|
||
|
2 changes: 1 addition & 1 deletion
2
...cord_doc/auto_control_test_record_doc.rst → ...cord_doc/auto_control_test_record_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
AutoControlGUI Test Record Doc | ||
AutoControl Test Record Doc | ||
========================== | ||
|
||
|
||
|
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...c/generate_html_doc/generate_html_doc.rst → ...c/generate_html_doc/generate_html_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
==================================== | ||
AutoControl ENG DOC | ||
==================================== | ||
|
||
.. toctree:: | ||
:maxdepth: 4 | ||
|
||
example/example_index.rst | ||
doc/doc_index.rst |
2 changes: 1 addition & 1 deletion
2
...e/critical_exit_example/critical_exit.rst → ...e/critical_exit_example/critical_exit.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
AutoControlGUI Critical Exit | ||
AutoControl Critical Exit | ||
========================== | ||
|
||
| critical exit | ||
|
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ample/executor_example/execute_action.rst → ...ample/executor_example/execute_action.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...te_html_example/generate_html_example.rst → ...te_html_example/generate_html_example.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ple/image_detect_example/image_detect.rst → ...ple/image_detect_example/image_detect.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ple/installation_example/installation.rst → ...ple/installation_example/installation.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rce/example/keyboard_example/keyboard.rst → ...Eng/example/keyboard_example/keyboard.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
======================== | ||
AutoControlGUI Keyboard | ||
AutoControl Keyboard | ||
======================== | ||
|
||
| Keyboard type | ||
|
2 changes: 1 addition & 1 deletion
2
docs/source/example/mouse_example/mouse.rst → ...ource/Eng/example/mouse_example/mouse.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
======================== | ||
AutoControlGUI Mouse | ||
AutoControl Mouse | ||
======================== | ||
|
||
| Get location | ||
|
2 changes: 1 addition & 1 deletion
2
.../source/example/record_example/record.rst → ...rce/Eng/example/record_example/record.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../source/example/screen_example/screen.rst → ...rce/Eng/example/screen_example/screen.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...source/Zh/doc/auto_control_critical_exit_doc/auto_control_critical_exit_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
==================================================== | ||
AutoControl 緊急退出 文件 | ||
==================================================== | ||
|
||
.. code-block:: python | ||
class CriticalExit(Thread): | ||
"當程式需要緊急退出時可使用此類別" | ||
def __init__(self, default_daemon: bool = True): | ||
""" | ||
預設使用鍵盤 F7 來緊急中斷 | ||
是否隨著主程式關閉監聽 預設 True | ||
:param default_daemon bool thread setDaemon | ||
""" | ||
def set_critical_key(self, keycode: [int, str] = None): | ||
""" | ||
設置中斷按鈕用 | ||
keycode 為中斷的偵測按鈕 | ||
:param keycode interrupt key | ||
""" | ||
def run(self): | ||
""" | ||
本質上還是thread | ||
listener keycode _exit_check_key to interrupt | ||
""" | ||
def init_critical_exit(self): | ||
""" | ||
應該使用這方法開始監聽而不是原始 thread start | ||
should only use this to start critical exit | ||
may this function will add more | ||
""" |
78 changes: 78 additions & 0 deletions
78
docs/source/Zh/doc/auto_control_executor_doc/auto_control_executor_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
==================================================== | ||
AutoControl 執行器 文件 | ||
==================================================== | ||
|
||
.. code-block:: python | ||
def execute_action(action_list: list): | ||
""" | ||
執行所有在 list 裡的指令 | ||
:param action_list the list include action | ||
for loop the list and execute action | ||
""" | ||
""" | ||
執行範例 可以使用 指令檔(json) 或是程式給予資料方式 | ||
指令檔適合已經固定化的測試流程 (當然也可以用程式產生) 使用者取捨使用 | ||
指令檔格式如下所示 example_list (不同平台keycode不同,請注意) | ||
程式格式也使用一樣的方式 | ||
Executor example | ||
on program or action file | ||
use format like bottom | ||
[function_name, {param: value,...}] | ||
if no param use [function_name] | ||
""" | ||
from je_auto_control import execute_action | ||
from je_auto_control import test_record | ||
"windows" | ||
example_list = [ | ||
["type_key", {"keycode": 65}], | ||
["mouse_left", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], | ||
["position"], | ||
["press_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], | ||
["release_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}] | ||
] | ||
"macos" | ||
example_list = [ | ||
["type_key", {"keycode": 0x00}], | ||
["mouse_left", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], | ||
["position"], | ||
["press_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], | ||
["release_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], | ||
["type_key", {"mouse_keycode": "dwadwawda", "dwadwad": 500, "wdawddwawad": 500}] | ||
] | ||
"linux" | ||
example_list = [ | ||
["type_key", {"keycode": 38}], | ||
["mouse_left", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], | ||
["position"], | ||
["press_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], | ||
["release_mouse", {"mouse_keycode": "mouse_left", "x": 500, "y": 500}], | ||
["type_key", {"mouse_keycode": "dwadwawda", "dwadwad": 500, "wdawddwawad": 500}] | ||
] | ||
execute_action(example_list) | ||
def read_action_json(json_file_path: str): | ||
""" | ||
讀取json指令檔用 | ||
use to read action file | ||
:param json_file_path json file's path to read | ||
""" | ||
def write_action_json(json_save_path: str, action_json: list): | ||
""" | ||
儲存json指令檔用 | ||
use to save action file | ||
:param json_save_path json save path | ||
:param action_json the json str include action to write | ||
""" | ||
.. code-block:: python | ||
def execute_files(execute_files_list: list): | ||
""" | ||
執行所有在list裡的指令檔 循序讀取然後執行 | ||
execute_files_list 含所有要執行指令檔路徑的 list | ||
:param execute_files_list: list include execute files path | ||
:return: every execute detail as list | ||
""" |
23 changes: 23 additions & 0 deletions
23
docs/source/Zh/doc/auto_control_file_process_doc/auto_control_file_process_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
==================================================== | ||
AutoControl 檔案處理 文件 | ||
==================================================== | ||
|
||
|
||
.. code-block:: python | ||
def get_dir_files_as_list(dir_path: str = getcwd(), default_search_file_extension: str = ".json"): | ||
""" | ||
取得指定資料夾路徑下的 所有 default_search_file_extension 附檔名的檔案的 list | ||
可以跟 執行器 模塊的 execute_files 一起使用 | ||
get dir file when end with default_search_file_extension | ||
dir_path 是要搜尋檔案的資料夾路徑 | ||
:param dir_path: which dir we want to walk and get file list | ||
default_search_file_extension 搜尋的附檔名 | ||
:param default_search_file_extension: which extension we want to search | ||
:return: [] if nothing searched or [file1, file2.... files] file was searched | ||
""" | ||
return [ | ||
abspath(join(dir_path, file)) for root, dirs, files in walk(dir_path) | ||
for file in files | ||
if file.endswith(default_search_file_extension.lower()) | ||
] |
50 changes: 50 additions & 0 deletions
50
docs/source/Zh/doc/auto_control_image_doc/auto_control_image_doc.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
==================================================== | ||
AutoControl 圖片處理 文件 | ||
==================================================== | ||
|
||
.. code-block:: python | ||
def locate_all_image(image, detect_threshold: [float, int] = 1, draw_image: bool = False, **kwargs): | ||
""" | ||
定位所有一樣的圖片 並回傳所有圖片的 list | ||
use to locate all image that detected and then return detected images list | ||
給予圖片路徑或者給予 PIL 的 ImageGrab.grab() | ||
:param image which image we want to find on screen (png or PIL ImageGrab.grab()) | ||
偵測辨別度 0.0 ~ 1.0 1.0 是絕對相同 | ||
:param detect_threshold detect precision 0.0 ~ 1.0; 1 is absolute equal (float or int) | ||
是否劃出偵測到圖片的範圍 | ||
:param draw_image draw detect tag on return image (bool) | ||
""" | ||
def locate_image_center(image, detect_threshold: [float, int] = 1, draw_image: bool = False, **kwargs): | ||
""" | ||
定位圖片並取得其中心點 | ||
use to locate image and return image center position | ||
給予圖片路徑或者給予 PIL 的 ImageGrab.grab() | ||
:param image which image we want to find on screen (png or PIL ImageGrab.grab()) | ||
偵測辨別度 0.0 ~ 1.0 1.0 是絕對相同 | ||
:param detect_threshold detect precision 0.0 ~ 1.0; 1 is absolute equal (float or int) | ||
是否劃出偵測到圖片的範圍 | ||
:param draw_image draw detect tag on return image (bool) | ||
""" | ||
def locate_and_click(image, mouse_keycode: [int, str], detect_threshold: [float, int] = 1, draw_image: bool = False, **kwargs): | ||
""" | ||
定位圖片並點擊其中心點 | ||
use to locate image and click image center position and the return image center position | ||
:param image which image we want to find on screen (png or PIL ImageGrab.grab()) | ||
:param mouse_keycode which mouse keycode we want to click | ||
:param detect_threshold detect precision 0.0 ~ 1.0; 1 is absolute equal (float or int) | ||
:param draw_image draw detect tag on return image (bool) | ||
""" | ||
def screenshot(file_path: str = None, region: list = None): | ||
""" | ||
截圖並存檔 可指定範圍 | ||
use to get now screen image return image | ||
存檔路徑 | ||
:param file_path save screenshot path (None is no save) | ||
截圖範圍 | ||
:param region screenshot region (screenshot region on screen) | ||
""" | ||
Oops, something went wrong.