Skip to content

Commit fff1320

Browse files
committed
refactor code style
refactor code style
1 parent 0e2fcd5 commit fff1320

38 files changed

+176
-154
lines changed

.idea/workspace.xml

Lines changed: 35 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LEARN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
## Pls read README.md, thanks.
1+
# Pls Read README Thanks

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# je_auto_control
1+
# AutoControl
22

33
---
44

5-
### JE Auto Control as a tool for GUI Testing
6-
#### Features
7-
* Image Detect
8-
* Keyboard Event
9-
* Mouse Event
10-
* Screen
11-
* Action file and executor
12-
* Record Event
13-
* CLI with action file
14-
* Generate HTML Report
15-
* Timeout
5+
## AutoControl as a tool for GUI Testing
6+
### Features
7+
* Image Detect
8+
* Keyboard Event
9+
* Mouse Event
10+
* Screen
11+
* Action file and executor
12+
* Record Event
13+
* CLI with action file
14+
* Generate HTML Report
15+
* Timeout
1616

1717
---
1818

@@ -36,19 +36,19 @@ pip install je_auto_control
3636

3737
## Info
3838

39-
* requirement
40-
* Python 3.7 & later
41-
* pip 19.3 & later
39+
* requirement
40+
* Python 3.7 & later
41+
* pip 19.3 & later
4242

4343

44-
* Dev env
45-
* windows 11
46-
* osx 11 big sur
47-
* ubuntu 20.0.4
44+
* Dev env
45+
* windows 11
46+
* osx 11 big sur
47+
* ubuntu 20.0.4
4848

4949

50-
* Test on
51-
* windows 10 ~ 11
52-
* osx 10.5 ~ 11 big sur
53-
* ubuntu 20.0.4
54-
* raspberry pi 3B and 4B
50+
* Test on
51+
* windows 10 ~ 11
52+
* osx 10.5 ~ 11 big sur
53+
* ubuntu 20.0.4
54+
* raspberry pi 3B and 4B

autocontrol_driver/generate_autocontrol_driver.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
server = start_autocontrol_socket_server()
77
while not server.close_flag:
88
pass
9-
else:
10-
sys.exit(0)
9+
sys.exit(0)
1110
except Exception as error:
1211
print(repr(error))

je_auto_control/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
from je_auto_control.utils.test_record.record_test_class import test_record_instance
8888

8989
# utils image
90-
from je_auto_control.wrapper.auto_control_image import screenshot
90+
from je_auto_control.utils.image.screenshot import pil_screenshot
9191

9292
# html report
9393
from je_auto_control.utils.html_report.html_report_generate import generate_html

je_auto_control/linux_with_x11/core/utils/x11_linux_display.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import os
1010
from Xlib.display import Display
11-
"""
12-
get x system display
13-
"""
11+
12+
# get x system display
1413
display = Display(os.environ['DISPLAY'])

je_auto_control/linux_with_x11/core/utils/x11_linux_vk.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@
77
raise AutoControlException(linux_import_error)
88

99
import Xlib
10-
from Xlib import XK
1110
from je_auto_control.linux_with_x11.core.utils.x11_linux_display import display
1211

13-
"""
14-
x11 linux virtual keycode
15-
"""
12+
13+
# x11 linux virtual keycode
14+
1615
x11_linux_key_backspace = display.keysym_to_keycode(Xlib.XK.string_to_keysym("BackSpace"))
1716
x11_linux_key_slash_b = display.keysym_to_keycode(Xlib.XK.string_to_keysym("BackSpace"))
1817
x11_linux_key_tab = display.keysym_to_keycode(Xlib.XK.string_to_keysym("Tab"))

je_auto_control/linux_with_x11/keyboard/x11_linux_keyboard_control.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def press_key(keycode: int) -> None:
2020
time.sleep(0.01)
2121
fake_input(display, X.KeyPress, keycode)
2222
display.sync()
23-
except struct.error as error:
23+
except Exception as error:
2424
print(repr(error), file=sys.stderr)
2525

2626

@@ -32,5 +32,5 @@ def release_key(keycode: int) -> None:
3232
time.sleep(0.01)
3333
fake_input(display, X.KeyRelease, keycode)
3434
display.sync()
35-
except struct.error as error:
35+
except Exception as error:
3636
print(repr(error), file=sys.stderr)

je_auto_control/linux_with_x11/listener/x11_linux_listener.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from je_auto_control.utils.exception.exception_tag import linux_import_error
66
from je_auto_control.utils.exception.exception_tag import listener_error
77

8-
98
if sys.platform not in ["linux", "linux2"]:
109
raise AutoControlException(linux_import_error)
1110

@@ -71,7 +70,7 @@ def run(self, reply) -> None:
7170
except AutoControlException:
7271
raise AutoControlException(listener_error)
7372

74-
def record(self, record_queue)-> None:
73+
def record(self, record_queue) -> None:
7574
"""
7675
:param record_queue the queue test_record action
7776
"""
@@ -133,7 +132,7 @@ def run(self) -> None:
133132
current_display.record_enable_context(self.context, self.handler.run)
134133
current_display.record_free_context(self.context)
135134
# keep running this to get event
136-
next_event = self.root.display.next_event()
135+
self.root.display.next_event()
137136
except AutoControlException:
138137
raise AutoControlException(listener_error)
139138
finally:
@@ -165,9 +164,8 @@ def x11_linux_record(record_queue) -> None:
165164
xwindows_listener.record(record_queue)
166165

167166

168-
def x11_linux_stop_record() -> None:
167+
def x11_linux_stop_record() -> Queue:
169168
"""
170169
stop test_record action
171170
"""
172171
return xwindows_listener.stop_record()
173-

je_auto_control/linux_with_x11/mouse/x11_linux_mouse_control.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ def scroll(scroll_value: int, scroll_direction: int) -> None:
7979
scroll_direction = 6 : direction left
8080
scroll_direction = 7 : direction right
8181
"""
82+
total = 0
8283
for i in range(scroll_value):
8384
click_mouse(scroll_direction)
84-
85+
total = total + i
86+
print("Scroll Value:" + total)

0 commit comments

Comments
 (0)