Skip to content

Commit 1f29bfc

Browse files
authored
Merge pull request #19 from JE-Chen/dev
Dev
2 parents adcec2a + 8970258 commit 1f29bfc

File tree

33 files changed

+418
-188
lines changed

33 files changed

+418
-188
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ jobs:
175175
- run:
176176
command: python ./test/unit_test/argparse/argparse_test.py
177177
name: argparse_test
178-
178+
179179
workflows:
180180
main:
181181
jobs:

.idea/workspace.xml

Lines changed: 49 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="je_auto_control_dev",
8-
version="0.0.06",
8+
version="0.0.07",
99
author="JE-Chen",
1010
author_email="[email protected]",
1111
description="auto testing",

docs/source/critical_exit/critical_exit.rst

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
AutoControlGUI Critical Exit
2+
==========================
3+
4+
.. code-block:: python
5+
6+
def locate_all_image(image, detect_threshold: [float, int] = 1, draw_image: bool = False, **kwargs):
7+
"""
8+
use to locate all image that detected and then return detected images list
9+
:param image which image we want to find on screen (png or PIL ImageGrab.grab())
10+
:param detect_threshold detect precision 0.0 ~ 1.0; 1 is absolute equal (float or int)
11+
:param draw_image draw detect tag on return image (bool)
12+
"""
13+
14+
def locate_image_center(image, detect_threshold: [float, int] = 1, draw_image: bool = False, **kwargs):
15+
"""
16+
use to locate image and return image center position
17+
:param image which image we want to find on screen (png or PIL ImageGrab.grab())
18+
:param detect_threshold detect precision 0.0 ~ 1.0; 1 is absolute equal (float or int)
19+
:param draw_image draw detect tag on return image (bool)
20+
"""
21+
22+
def locate_and_click(image, mouse_keycode: [int, str], detect_threshold: [float, int] = 1, draw_image: bool = False, **kwargs):
23+
"""
24+
use to locate image and click image center position and the return image center position
25+
:param image which image we want to find on screen (png or PIL ImageGrab.grab())
26+
:param mouse_keycode which mouse keycode we want to click
27+
:param detect_threshold detect precision 0.0 ~ 1.0; 1 is absolute equal (float or int)
28+
:param draw_image draw detect tag on return image (bool)
29+
"""
30+
31+
def screenshot(file_path: str = None, region: list = None):
32+
"""
33+
use to get now screen image return image
34+
:param file_path save screenshot path (None is no save)
35+
:param region screenshot region (screenshot region on screen)
36+
"""
37+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
AutoControlGUI Critical Exit
2+
==========================
3+
4+
5+
.. code-block:: python
6+
7+
def press_key(keycode: [int, str], is_shift: bool = False):
8+
"""
9+
use to press a key still press to use release key
10+
or use critical exit
11+
return keycode
12+
:param keycode which keycode we want to press
13+
:param is_shift press shift True or False
14+
"""
15+
16+
def release_key(keycode: [int, str], is_shift: bool = False):
17+
"""
18+
use to release pressed key return keycode
19+
:param keycode which keycode we want to release
20+
:param is_shift press shift True or False
21+
"""
22+
23+
def type_key(keycode: [int, str], is_shift: bool = False):
24+
"""
25+
press and release key return keycode
26+
:param keycode which keycode we want to type
27+
:param is_shift press shift True or False
28+
"""
29+
30+
def check_key_is_press(keycode: [int, str]):
31+
"""
32+
use to check key is press return True or False
33+
:param keycode check key is press or not
34+
"""
35+
36+
def write(write_string: str, is_shift: bool = False):
37+
"""
38+
use to press and release whole we get this function str
39+
return all press and release str
40+
:param write_string while string not on write_string+1 type_key(string)
41+
:param is_shift press shift True or False
42+
"""
43+
44+
def hotkey(key_code_list: list, is_shift: bool = False):
45+
"""
46+
use to press and release all key on key_code_list
47+
then reverse list press and release again
48+
return [press_str_list, release_str_list]
49+
:param key_code_list press and release all key on list and reverse
50+
:param is_shift press shift True or False
51+
"""
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
AutoControlGUI Critical Exit
2+
==========================
3+
4+
5+
.. code-block:: python
6+
7+
def mouse_preprocess(mouse_keycode: [int, str], x: int, y: int):
8+
"""
9+
check mouse keycode is verified or not
10+
and then check current mouse position
11+
if x or y is None set x, y is current position
12+
:param mouse_keycode which mouse keycode we want to click
13+
:param x mouse click x position
14+
:param y mouse click y position
15+
"""
16+
17+
def position():
18+
"""
19+
get mouse current position
20+
return mouse_x, mouse_y
21+
"""
22+
23+
def set_position(x: int, y: int):
24+
"""
25+
:param x set mouse position x
26+
:param y set mouse position y
27+
return x, y
28+
"""
29+
30+
def press_mouse(mouse_keycode: [int, str], x: int = None, y: int = None):
31+
"""
32+
press mouse keycode on x, y
33+
return keycode, x, y
34+
:param mouse_keycode which mouse keycode we want to press
35+
:param x mouse click x position
36+
:param y mouse click y position
37+
"""
38+
39+
def release_mouse(mouse_keycode: [int, str], x: int = None, y: int = None):
40+
"""
41+
release mouse keycode on x, y
42+
return keycode, x, y
43+
:param mouse_keycode which mouse keycode we want to release
44+
:param x mouse click x position
45+
:param y mouse click y position
46+
"""
47+
48+
def click_mouse(mouse_keycode: [int, str], x: int = None, y: int = None):
49+
"""
50+
press and release mouse keycode on x, y
51+
return keycode, x, y
52+
:param mouse_keycode which mouse keycode we want to click
53+
:param x mouse click x position
54+
:param y mouse click y position
55+
"""
56+
57+
def scroll(scroll_value: int, x: int = None, y: int = None, scroll_direction: str = "scroll_down"):
58+
""""
59+
:param scroll_value scroll count
60+
:param x mouse click x position
61+
:param y mouse click y position
62+
:param scroll_direction which direction we want
63+
scroll_direction = scroll_up : direction up
64+
scroll_direction = scroll_down : direction down
65+
scroll_direction = scroll_left : direction left
66+
scroll_direction = scroll_right : direction right
67+
"""

docs/source/doc/doc_index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
==================
2+
Doc
3+
==================
4+
5+
.. toctree::
6+
:maxdepth: 2
7+
8+
auto_control_image/auto_control_image.rst
9+
auto_control_keyboard/auto_control_keyboard.rst
10+
auto_control_mouse/auto_control_mouse.rst
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
AutoControlGUI Critical Exit
2+
==========================
3+
4+
| critical exit
5+
| if you want to click keyboard key to exit program you can use this module
6+
| when you click what you set on set_critical_key will make program exit
7+
| this example is how to auto use CriticalExit
8+
.. code-block:: python
9+
10+
from je_auto_control import CriticalExit
11+
from je_auto_control import keys_table
12+
from je_auto_control import press_key
13+
try:
14+
"""
15+
Create critical exit listener default exit key is keyboard f7
16+
"""
17+
critical_exit_thread = CriticalExit()
18+
"""
19+
set exit key you can use any key in keys_table
20+
"""
21+
print(keys_table.keys())
22+
critical_exit_thread.set_critical_key("f2")
23+
"""
24+
Start listener
25+
"""
26+
critical_exit_thread.init_critical_exit()
27+
28+
"""
29+
now auto press f2 will stop this program
30+
"""
31+
while True:
32+
press_key("f2")
33+
except KeyboardInterrupt:
34+
pass
35+
36+
37+

docs/source/editor/editor.rst renamed to docs/source/example/editor/editor.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ Editor
55
| you can use editor, a simple python editor
66
| Github : https://github.com/JE-Chen/je_editor
77
8+
.. code-block:: python
9+
10+
pip install je_editor
11+
12+
813
.. code-block:: python
914
1015
from je_editor import start_editor

0 commit comments

Comments
 (0)