Skip to content

Commit cf80dee

Browse files
committed
Add logger and update dev version
Add logger and update dev version
1 parent c103db2 commit cf80dee

19 files changed

+282
-189
lines changed

.idea/AutoControl.iml

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

.idea/misc.xml

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

.idea/workspace.xml

Lines changed: 19 additions & 123 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

je_auto_control/linux_with_x11/core/utils/x11_linux_display.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
from je_auto_control.utils.exception.exception_tags import linux_import_error
44
from je_auto_control.utils.exception.exceptions import AutoControlException
5+
from je_auto_control.utils.logging.loggin_instance import auto_control_logger
56

67
if sys.platform not in ["linux", "linux2"]:
78
raise AutoControlException(linux_import_error)
89

910
import os
1011
from Xlib.display import Display
1112

13+
1214
# get x system display
1315
display = Display(os.environ['DISPLAY'])
16+

je_auto_control/linux_with_x11/core/utils/x11_linux_vk.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from je_auto_control.utils.exception.exception_tags import linux_import_error
44
from je_auto_control.utils.exception.exceptions import AutoControlException
5+
from je_auto_control.utils.logging.loggin_instance import auto_control_logger
56

67
if sys.platform not in ["linux", "linux2"]:
78
raise AutoControlException(linux_import_error)
@@ -194,3 +195,4 @@
194195
x11_linux_key_8 = display.keysym_to_keycode(XK.string_to_keysym("8"))
195196
x11_linux_key_9 = display.keysym_to_keycode(XK.string_to_keysym("9"))
196197
x11_linux_key_0 = display.keysym_to_keycode(XK.string_to_keysym("0"))
198+

je_auto_control/linux_with_x11/keyboard/x11_linux_keyboard_control.py

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

44
from je_auto_control.utils.exception.exception_tags import linux_import_error
55
from je_auto_control.utils.exception.exceptions import AutoControlException
6+
from je_auto_control.utils.logging.loggin_instance import auto_control_logger
67

78
if sys.platform not in ["linux", "linux2"]:
89
raise AutoControlException(linux_import_error)
@@ -16,21 +17,16 @@ def press_key(keycode: int) -> None:
1617
"""
1718
:param keycode which keycode we want to press
1819
"""
19-
try:
20-
time.sleep(0.01)
21-
fake_input(display, X.KeyPress, keycode)
22-
display.sync()
23-
except Exception as error:
24-
print(repr(error), file=sys.stderr)
20+
time.sleep(0.01)
21+
fake_input(display, X.KeyPress, keycode)
22+
display.sync()
2523

2624

2725
def release_key(keycode: int) -> None:
2826
"""
2927
:param keycode which keycode we want to release
3028
"""
31-
try:
32-
time.sleep(0.01)
33-
fake_input(display, X.KeyRelease, keycode)
34-
display.sync()
35-
except Exception as error:
36-
print(repr(error), file=sys.stderr)
29+
time.sleep(0.01)
30+
fake_input(display, X.KeyRelease, keycode)
31+
display.sync()
32+

je_auto_control/utils/exception/exception_tags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
# HTML
4949
html_generate_no_data_tag: str = "record is None"
5050
# add command
51-
add_command_exception_tag: str = "command value type should be as method or function"
51+
add_command_exception: str = "command value type should be as method or function"
5252
# executor
5353
executor_list_error: str = "executor receive wrong data list is none or wrong type"
5454
# argparse

je_auto_control/utils/executor/action_executor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import types
44
from inspect import getmembers, isbuiltin
55

6-
from je_auto_control.utils.exception.exception_tags import action_is_null_error, add_command_exception_tag, \
6+
from je_auto_control.utils.exception.exception_tags import action_is_null_error, add_command_exception, \
77
executor_list_error
88
from je_auto_control.utils.exception.exception_tags import cant_execute_action_error
99
from je_auto_control.utils.exception.exceptions import AutoControlActionException, AutoControlAddCommandException
@@ -163,7 +163,7 @@ def add_command_to_executor(command_dict: dict):
163163
if isinstance(command, (types.MethodType, types.FunctionType)):
164164
executor.event_dict.update({command_name: command})
165165
else:
166-
raise AutoControlAddCommandException(add_command_exception_tag)
166+
raise AutoControlAddCommandException(add_command_exception)
167167

168168

169169
def execute_action(action_list: list) -> dict:

je_auto_control/utils/logging/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)