Skip to content

Dev #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Mar 19, 2022
Merged

Dev #19

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ jobs:
- run:
command: python ./test/unit_test/argparse/argparse_test.py
name: argparse_test

workflows:
main:
jobs:
Expand Down
79 changes: 49 additions & 30 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="je_auto_control_dev",
version="0.0.06",
version="0.0.07",
author="JE-Chen",
author_email="zenmailman@gmail.com",
description="auto testing",
Expand Down
64 changes: 0 additions & 64 deletions docs/source/critical_exit/critical_exit.rst

This file was deleted.

37 changes: 37 additions & 0 deletions docs/source/doc/auto_control_image/auto_control_image.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
AutoControlGUI Critical Exit
==========================

.. code-block:: python

def locate_all_image(image, detect_threshold: [float, int] = 1, draw_image: bool = False, **kwargs):
"""
use to locate all image that detected and then return detected images list
:param image which image we want to find on screen (png or PIL ImageGrab.grab())
: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
:param image which image we want to find on screen (png or PIL ImageGrab.grab())
: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)
"""

51 changes: 51 additions & 0 deletions docs/source/doc/auto_control_keyboard/auto_control_keyboard.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
AutoControlGUI Critical Exit
==========================


.. code-block:: python

def press_key(keycode: [int, str], is_shift: bool = False):
"""
use to press a key still press to use release key
or use critical exit
return keycode
:param keycode which keycode we want to press
:param is_shift press shift True or False
"""

def release_key(keycode: [int, str], is_shift: bool = False):
"""
use to release pressed key return keycode
:param keycode which keycode we want to release
:param is_shift press shift True or False
"""

def type_key(keycode: [int, str], is_shift: bool = False):
"""
press and release key return keycode
:param keycode which keycode we want to type
:param is_shift press shift True or False
"""

def check_key_is_press(keycode: [int, str]):
"""
use to check key is press return True or False
:param keycode check key is press or not
"""

def write(write_string: str, is_shift: bool = False):
"""
use to press and release whole we get this function str
return all press and release str
:param write_string while string not on write_string+1 type_key(string)
:param is_shift press shift True or False
"""

def hotkey(key_code_list: list, is_shift: bool = False):
"""
use to press and release all key on key_code_list
then reverse list press and release again
return [press_str_list, release_str_list]
:param key_code_list press and release all key on list and reverse
:param is_shift press shift True or False
"""
67 changes: 67 additions & 0 deletions docs/source/doc/auto_control_mouse/auto_control_mouse.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
AutoControlGUI Critical Exit
==========================


.. code-block:: python

def mouse_preprocess(mouse_keycode: [int, str], x: int, y: int):
"""
check mouse keycode is verified or not
and then check current mouse position
if x or y is None set x, y is current position
:param mouse_keycode which mouse keycode we want to click
:param x mouse click x position
:param y mouse click y position
"""

def position():
"""
get mouse current position
return mouse_x, mouse_y
"""

def set_position(x: int, y: int):
"""
:param x set mouse position x
:param y set mouse position y
return x, y
"""

def press_mouse(mouse_keycode: [int, str], x: int = None, y: int = None):
"""
press mouse keycode on x, y
return keycode, x, y
:param mouse_keycode which mouse keycode we want to press
:param x mouse click x position
:param y mouse click y position
"""

def release_mouse(mouse_keycode: [int, str], x: int = None, y: int = None):
"""
release mouse keycode on x, y
return keycode, x, y
:param mouse_keycode which mouse keycode we want to release
:param x mouse click x position
:param y mouse click y position
"""

def click_mouse(mouse_keycode: [int, str], x: int = None, y: int = None):
"""
press and release mouse keycode on x, y
return keycode, x, y
:param mouse_keycode which mouse keycode we want to click
:param x mouse click x position
:param y mouse click y position
"""

def scroll(scroll_value: int, x: int = None, y: int = None, scroll_direction: str = "scroll_down"):
""""
:param scroll_value scroll count
:param x mouse click x position
:param y mouse click y position
:param scroll_direction which direction we want
scroll_direction = scroll_up : direction up
scroll_direction = scroll_down : direction down
scroll_direction = scroll_left : direction left
scroll_direction = scroll_right : direction right
"""
10 changes: 10 additions & 0 deletions docs/source/doc/doc_index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
==================
Doc
==================

.. toctree::
:maxdepth: 2

auto_control_image/auto_control_image.rst
auto_control_keyboard/auto_control_keyboard.rst
auto_control_mouse/auto_control_mouse.rst
37 changes: 37 additions & 0 deletions docs/source/example/critical_exit/critical_exit.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
AutoControlGUI Critical Exit
==========================

| critical exit
| if you want to click keyboard key to exit program you can use this module
| when you click what you set on set_critical_key will make program exit
| this example is how to auto use CriticalExit
.. code-block:: python

from je_auto_control import CriticalExit
from je_auto_control import keys_table
from je_auto_control import press_key
try:
"""
Create critical exit listener default exit key is keyboard f7
"""
critical_exit_thread = CriticalExit()
"""
set exit key you can use any key in keys_table
"""
print(keys_table.keys())
critical_exit_thread.set_critical_key("f2")
"""
Start listener
"""
critical_exit_thread.init_critical_exit()

"""
now auto press f2 will stop this program
"""
while True:
press_key("f2")
except KeyboardInterrupt:
pass



Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ Editor
| you can use editor, a simple python editor
| Github : https://github.com/JE-Chen/je_editor

.. code-block:: python

pip install je_editor


.. code-block:: python

from je_editor import start_editor
Expand Down
17 changes: 17 additions & 0 deletions docs/source/example/example_index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
==================
Example
==================

.. toctree::
:maxdepth: 2

installation/installation.rst
critical_exit/critical_exit.rst
mouse/mouse.rst
keyboard/keyboard.rst
screen/screen.rst
image_detect/image_detect.rst
record/record.rst
execute_action/execute_action.rst
editor/editor.rst
test/test.rst
Loading