Skip to content

refactor and update version #6

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 9 commits into from
Nov 14, 2021
Merged
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
60 changes: 20 additions & 40 deletions .idea/workspace.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException
from je_auto_control.utils.je_auto_control_exception.exception_tag import linux_import_error

if sys.platform not in ["linux", "linux2"]:
raise Exception("should be only loaded on linux")
raise AutoControlException(linux_import_error)

import os
from Xlib.display import Display
Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/linux_with_x11/core/utils/x11_linux_vk.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException
from je_auto_control.utils.je_auto_control_exception.exception_tag import linux_import_error

if sys.platform not in ["linux", "linux2"]:
raise Exception("should be only loaded on linux")
raise AutoControlException(linux_import_error)

import Xlib
from Xlib import XK
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException
from je_auto_control.utils.je_auto_control_exception.exception_tag import linux_import_error

if sys.platform not in ["linux", "linux2"]:
raise Exception("should be only loaded on linux")
raise AutoControlException(linux_import_error)

from je_auto_control.linux_with_x11.core.utils.x11_linux_display import display
from Xlib.ext.xtest import fake_input
Expand Down
15 changes: 10 additions & 5 deletions je_auto_control/linux_with_x11/listener/x11_linux_listener.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException
from je_auto_control.utils.je_auto_control_exception.exception_tag import linux_import_error
from je_auto_control.utils.je_auto_control_exception.exception_tag import listener_error


if sys.platform not in ["linux", "linux2"]:
raise Exception("should be only loaded on linux")
raise AutoControlException(linux_import_error)

import Xlib.threaded

Expand Down Expand Up @@ -62,8 +67,8 @@ def run(self, reply):
if self.record_flag is True:
temp = (event.type, event.detail, event.root_x, event.root_y)
self.record_queue.put(temp)
except Exception:
raise Exception
except AutoControlException:
raise AutoControlException(listener_error)

def record(self, record_queue):
"""
Expand Down Expand Up @@ -128,8 +133,8 @@ def run(self):
current_display.record_free_context(self.context)
# keep running this to get event
next_event = self.root.display.next_event()
except Exception:
raise Exception
except AutoControlException:
raise AutoControlException(listener_error)
finally:
self.handler.still_listener = False
self.still_listener = False
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException
from je_auto_control.utils.je_auto_control_exception.exception_tag import linux_import_error

if sys.platform not in ["linux", "linux2"]:
raise Exception("should be only loaded on linux")
raise AutoControlException(linux_import_error)

from Xlib import X
from Xlib.ext.xtest import fake_input
Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/linux_with_x11/record/x11_linux_record.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException
from je_auto_control.utils.je_auto_control_exception.exception_tag import linux_import_error

if sys.platform not in ["linux", "linux2"]:
raise Exception("should be only loaded on linux")
raise AutoControlException(linux_import_error)

from Xlib import X

Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/linux_with_x11/screen/x11_linux_screen.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException
from je_auto_control.utils.je_auto_control_exception.exception_tag import linux_import_error

if sys.platform not in ["linux", "linux2"]:
raise Exception("should be only loaded on linux")
raise AutoControlException(linux_import_error)

from je_auto_control.linux_with_x11.core.utils.x11_linux_display import display

Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/osx/core/utils/osx_vk.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import osx_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["darwin"]:
raise Exception("should be only loaded on MacOS")
raise AutoControlException(osx_import_error)

"""
osx keyboard virtual keycode
Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/osx/keyboard/osx_keyboard.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import osx_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["darwin"]:
raise Exception("should be only loaded on MacOS")
raise AutoControlException(osx_import_error)

import time

Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/osx/keyboard/osx_keyboard_check.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import osx_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["darwin"]:
raise Exception("should be only loaded on MacOS")
raise AutoControlException(osx_import_error)

import Quartz

Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/osx/listener/osx_listener.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import osx_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["darwin"]:
raise Exception("should be only loaded on MacOS")
raise AutoControlException(osx_import_error)


from Cocoa import *
Expand Down
6 changes: 5 additions & 1 deletion je_auto_control/osx/mouse/osx_mouse.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import sys


from je_auto_control.utils.je_auto_control_exception.exception_tag import osx_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["darwin"]:
raise Exception("should be only loaded on MacOS")
raise AutoControlException(osx_import_error)

import time

Expand Down
6 changes: 5 additions & 1 deletion je_auto_control/osx/record/osx_record.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import sys


from je_auto_control.utils.je_auto_control_exception.exception_tag import osx_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["darwin"]:
raise Exception("should be only loaded on MacOS")
raise AutoControlException(osx_import_error)

from je_auto_control.osx.listener.osx_listener import osx_record
from je_auto_control.osx.listener.osx_listener import osx_stop_record
Expand Down
8 changes: 8 additions & 0 deletions je_auto_control/osx/screen/osx_screen.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import osx_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["darwin"]:
raise AutoControlException(osx_import_error)

import Quartz


Expand Down
3 changes: 2 additions & 1 deletion je_auto_control/utils/action_file/json_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlJsonActionException
from je_auto_control.utils.je_auto_control_exception.exception_tag import cant_save_json_error
from je_auto_control.utils.je_auto_control_exception.exception_tag import cant_find_json_error

lock = Lock()

Expand All @@ -19,7 +20,7 @@ def read_action_json(json_file_path: str):
with open(json_file_path) as read_file:
return read_file.read()
except AutoControlJsonActionException:
raise AutoControlJsonActionException
raise AutoControlJsonActionException(cant_find_json_error)
finally:
lock.release()

Expand Down
10 changes: 10 additions & 0 deletions je_auto_control/utils/je_auto_control_exception/exception_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
je_auto_control_error = "Auto control error"
je_auto_control_critical_exit_error = "Auto control critical exit error"
"""
os tags
"""
linux_import_error = "should be only loaded on linux"
osx_import_error = "should be only loaded on MacOS"
windows_import_error = "should be only loaded on windows"
"""
keyboard tags
"""
keyboard_error = "Auto control keyboard error"
Expand Down Expand Up @@ -39,6 +45,10 @@
cant_find_image = "can't find image"
find_image_error_variable = "variable error"
"""
listener tags
"""
listener_error = "Auto control listener error"
"""
record tags
"""
record_queue_error = "can't get record queue it's none are you using stop record before record"
Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/windows/core/utils/win32_ctype_input.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import windows_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["win32", "cygwin", "msys"]:
raise Exception("should be only loaded on windows")
raise AutoControlException(windows_import_error)

import ctypes
from ctypes import wintypes
Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/windows/core/utils/win32_vk.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import windows_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["win32", "cygwin", "msys"]:
raise Exception("should be only loaded on windows")
raise AutoControlException(windows_import_error)

"""
windows mouse virtual keycode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import windows_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["win32", "cygwin", "msys"]:
raise Exception("should be only loaded on windows")
raise AutoControlException(windows_import_error)

from je_auto_control.windows.core.utils.win32_ctype_input import Input
from je_auto_control.windows.core.utils.win32_ctype_input import Keyboard
Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/windows/keyboard/win32_keyboard_check.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import windows_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["win32", "cygwin", "msys"]:
raise Exception("should be only loaded on windows")
raise AutoControlException(windows_import_error)

import ctypes

Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/windows/listener/win32_keyboard_listener.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import windows_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["win32", "cygwin", "msys"]:
raise Exception("should be only loaded on windows")
raise AutoControlException(windows_import_error)

from ctypes import *
from ctypes.wintypes import MSG
Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/windows/listener/win32_mouse_listener.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import windows_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["win32", "cygwin", "msys"]:
raise Exception("should be only loaded on windows")
raise AutoControlException(windows_import_error)

from ctypes import *
from ctypes.wintypes import MSG
Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/windows/mouse/win32_ctype_mouse_control.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import windows_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["win32", "cygwin", "msys"]:
raise Exception("should be only loaded on windows")
raise AutoControlException(windows_import_error)

from je_auto_control.windows.core.utils.win32_ctype_input import Input
from je_auto_control.windows.core.utils.win32_ctype_input import win32_LEFTDOWN
Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/windows/record/win32_record.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import windows_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["win32", "cygwin", "msys"]:
raise Exception("should be only loaded on windows")
raise AutoControlException(windows_import_error)

from je_auto_control.windows.listener.win32_keyboard_listener import Win32KeyboardListener
from je_auto_control.windows.listener.win32_mouse_listener import Win32MouseListener
Expand Down
5 changes: 4 additions & 1 deletion je_auto_control/windows/screen/win32_screen.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import sys

from je_auto_control.utils.je_auto_control_exception.exception_tag import windows_import_error
from je_auto_control.utils.je_auto_control_exception.exceptions import AutoControlException

if sys.platform not in ["win32", "cygwin", "msys"]:
raise Exception("should be only loaded on windows")
raise AutoControlException(windows_import_error)

import ctypes

Expand Down
Loading