From e1f4d343f6af9f1fc477bfc897ea3036d60793ad Mon Sep 17 00:00:00 2001
From: JE-Chen <33644111+JE-Chen@users.noreply.github.com>
Date: Sat, 4 Jan 2025 05:15:47 +0800
Subject: [PATCH 1/3] Update logger and Now testing will output
Update logger and Now testing will output
---
.github/workflows/dev_python3_10.yml | 5 +
.github/workflows/dev_python3_11.yml | 5 +
.github/workflows/dev_python3_8.yml | 95 -------------------
.github/workflows/dev_python3_9.yml | 5 +
.github/workflows/stable_python3_10.yml | 5 +
.github/workflows/stable_python3_11.yml | 5 +
.github/workflows/stable_python3_8.yml | 95 -------------------
.github/workflows/stable_python3_9.yml | 5 +
.idea/workspace.xml | 39 +++++---
dev_requirements.txt | 2 +-
.../utils/logging/loggin_instance.py | 20 ++--
pyproject.toml | 12 +--
requirements.txt | 2 +-
dev.toml => stable.toml | 12 +--
14 files changed, 81 insertions(+), 226 deletions(-)
delete mode 100644 .github/workflows/dev_python3_8.yml
delete mode 100644 .github/workflows/stable_python3_8.yml
rename dev.toml => stable.toml (90%)
diff --git a/.github/workflows/dev_python3_10.yml b/.github/workflows/dev_python3_10.yml
index 3836c61..fc27958 100644
--- a/.github/workflows/dev_python3_10.yml
+++ b/.github/workflows/dev_python3_10.yml
@@ -30,6 +30,11 @@ jobs:
run: python ./test/unit_test/screen/screen_test.py
- name: Test Screenshot
run: python ./test/unit_test/screen/screenshot_test.py
+ - name: Save Screenshot Image
+ uses: actions/upload-artifact@v4
+ with:
+ name: screenshot_png
+ path: test.png
- name: Test Keyboard type Function
run: python ./test/unit_test/keyboard/keyboard_type_test.py
diff --git a/.github/workflows/dev_python3_11.yml b/.github/workflows/dev_python3_11.yml
index 2fbb559..85d2359 100644
--- a/.github/workflows/dev_python3_11.yml
+++ b/.github/workflows/dev_python3_11.yml
@@ -30,6 +30,11 @@ jobs:
run: python ./test/unit_test/screen/screen_test.py
- name: Test Screenshot
run: python ./test/unit_test/screen/screenshot_test.py
+ - name: Save Screenshot Image
+ uses: actions/upload-artifact@v4
+ with:
+ name: screenshot_png
+ path: test.png
- name: Test Keyboard type Function
run: python ./test/unit_test/keyboard/keyboard_type_test.py
diff --git a/.github/workflows/dev_python3_8.yml b/.github/workflows/dev_python3_8.yml
deleted file mode 100644
index 1eaa071..0000000
--- a/.github/workflows/dev_python3_8.yml
+++ /dev/null
@@ -1,95 +0,0 @@
-name: AutoControl Dev Python3.8
-
-on:
- push:
- branches: [ "dev" ]
- pull_request:
- branches: [ "dev" ]
- schedule:
- - cron: "0 1 * * *"
-
-permissions:
- contents: read
-
-jobs:
- build_dev_version:
- runs-on: windows-2019
-
- steps:
- - uses: actions/checkout@v3
- - name: Set up Python 3.8
- uses: actions/setup-python@v3
- with:
- python-version: "3.8"
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip wheel
- pip install -r dev_requirements.txt
-
- - name: Test Screen Module
- run: python ./test/unit_test/screen/screen_test.py
- - name: Test Screenshot
- run: python ./test/unit_test/screen/screenshot_test.py
-
- - name: Test Keyboard type Function
- run: python ./test/unit_test/keyboard/keyboard_type_test.py
- - name: Test Keyboard write Function
- run: |
- python ./test/unit_test/keyboard/keyboard_write_test.py
- - name: Test Keyboard is_press Function
- run: python ./test/unit_test/keyboard/keyboard_is_press_test.py
- - name: Test Keyboard hotkey Function
- run: python ./test/unit_test/keyboard/hotkey_test.py
-
- - name: Test Mouse Module
- run: python ./test/unit_test/mouse/mouse_test.py
- - name: Test Scroll Module
- run: python ./test/unit_test/exception/auto_control_exception_test.py
-
- - name: Test Exceptions
- run: python ./test/unit_test/exception/auto_control_exception_test.py
-
- - name: Test Critical Exit
- run: python ./test/unit_test/critical_exit/critical_exit_test.py
- - name: Test Real Critical Situation
- run: |
- python ./test/unit_test/critical_exit/real_critical_test.py
- exit 0
-
- - name: Test Record Module
- run: python ./test/unit_test/record/record_test.py
- - name: Test Total Record
- run: python ./test/unit_test/total_record/total_record_test.py
-
- - name: Test Execute Action
- run: python ./test/unit_test/execute_action/execute_action_test.py
-
- - name: Test Json Module
- run: python ./test/unit_test/json/json_test.py
- - name: Test Generate Json Report
- run: python ./test/unit_test/generate_report/json_report.py
- - name: Test Timeout Module
- run: python ./test/unit_test/timeout/timeout_test.py
- - name: Test Generate HTML Report
- run: python ./test/unit_test/generate_report/html_report_test.py
-
- - name: Test Argparse
- run: python ./test/unit_test/argparse/argparse_test.py
-
- - name: Test Callback Module
- run: python ./test/unit_test/callback/callback_test.py
-
- - name: Test Create Project Function
- run: python ./test/unit_test/create_project_file/create_project_test.py
-
- - name: Test Interval Scheduler
- run: python ./test/unit_test/scheduler_test/sec_interval_test.py
- - name: Test Cron Scheduler
- run: python ./test/unit_test/scheduler_test/sec_cron_test.py
-
- - name: Test Get Mouse Info
- run: python ./test/unit_test/get_info/mouse_info.py
- - name: Test Get Special Info
- run: python ./test/unit_test/get_info/special_info.py
- - name: Test Get Keyboard Info
- run: python ./test/unit_test/get_info/keyboard_info.py
diff --git a/.github/workflows/dev_python3_9.yml b/.github/workflows/dev_python3_9.yml
index e85c3fd..82a6b92 100644
--- a/.github/workflows/dev_python3_9.yml
+++ b/.github/workflows/dev_python3_9.yml
@@ -30,6 +30,11 @@ jobs:
run: python ./test/unit_test/screen/screen_test.py
- name: Test Screenshot
run: python ./test/unit_test/screen/screenshot_test.py
+ - name: Save Screenshot Image
+ uses: actions/upload-artifact@v4
+ with:
+ name: screenshot_png
+ path: test.png
- name: Test Keyboard type Function
run: python ./test/unit_test/keyboard/keyboard_type_test.py
diff --git a/.github/workflows/stable_python3_10.yml b/.github/workflows/stable_python3_10.yml
index f1b826b..0cbbd5e 100644
--- a/.github/workflows/stable_python3_10.yml
+++ b/.github/workflows/stable_python3_10.yml
@@ -30,6 +30,11 @@ jobs:
run: python ./test/unit_test/screen/screen_test.py
- name: Test Screenshot
run: python ./test/unit_test/screen/screenshot_test.py
+ - name: Save Screenshot Image
+ uses: actions/upload-artifact@v4
+ with:
+ name: screenshot_png
+ path: test.png
- name: Test Keyboard type Function
run: python ./test/unit_test/keyboard/keyboard_type_test.py
diff --git a/.github/workflows/stable_python3_11.yml b/.github/workflows/stable_python3_11.yml
index 23ff5d4..d869749 100644
--- a/.github/workflows/stable_python3_11.yml
+++ b/.github/workflows/stable_python3_11.yml
@@ -30,6 +30,11 @@ jobs:
run: python ./test/unit_test/screen/screen_test.py
- name: Test Screenshot
run: python ./test/unit_test/screen/screenshot_test.py
+ - name: Save Screenshot Image
+ uses: actions/upload-artifact@v4
+ with:
+ name: screenshot_png
+ path: test.png
- name: Test Keyboard type Function
run: python ./test/unit_test/keyboard/keyboard_type_test.py
diff --git a/.github/workflows/stable_python3_8.yml b/.github/workflows/stable_python3_8.yml
deleted file mode 100644
index b98fe4f..0000000
--- a/.github/workflows/stable_python3_8.yml
+++ /dev/null
@@ -1,95 +0,0 @@
-name: AutoControl Stable Python3.8
-
-on:
- push:
- branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
- schedule:
- - cron: "0 1 * * *"
-
-permissions:
- contents: read
-
-jobs:
- build_stable_version:
- runs-on: windows-2019
-
- steps:
- - uses: actions/checkout@v3
- - name: Set up Python 3.8
- uses: actions/setup-python@v3
- with:
- python-version: "3.8"
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip wheel
- pip install -r requirements.txt
-
- - name: Test Screen Module
- run: python ./test/unit_test/screen/screen_test.py
- - name: Test Screenshot
- run: python ./test/unit_test/screen/screenshot_test.py
-
- - name: Test Keyboard type Function
- run: python ./test/unit_test/keyboard/keyboard_type_test.py
- - name: Test Keyboard write Function
- run: |
- python ./test/unit_test/keyboard/keyboard_write_test.py
- - name: Test Keyboard is_press Function
- run: python ./test/unit_test/keyboard/keyboard_is_press_test.py
- - name: Test Keyboard hotkey Function
- run: python ./test/unit_test/keyboard/hotkey_test.py
-
- - name: Test Mouse Module
- run: python ./test/unit_test/mouse/mouse_test.py
- - name: Test Scroll Module
- run: python ./test/unit_test/exception/auto_control_exception_test.py
-
- - name: Test Exceptions
- run: python ./test/unit_test/exception/auto_control_exception_test.py
-
- - name: Test Critical Exit
- run: python ./test/unit_test/critical_exit/critical_exit_test.py
- - name: Test Real Critical Situation
- run: |
- python ./test/unit_test/critical_exit/real_critical_test.py
- exit 0
-
- - name: Test Record Module
- run: python ./test/unit_test/record/record_test.py
- - name: Test Total Record
- run: python ./test/unit_test/total_record/total_record_test.py
-
- - name: Test Execute Action
- run: python ./test/unit_test/execute_action/execute_action_test.py
-
- - name: Test Json Module
- run: python ./test/unit_test/json/json_test.py
- - name: Test Generate Json Report
- run: python ./test/unit_test/generate_report/json_report.py
- - name: Test Timeout Module
- run: python ./test/unit_test/timeout/timeout_test.py
- - name: Test Generate HTML Report
- run: python ./test/unit_test/generate_report/html_report_test.py
-
- - name: Test Argparse
- run: python ./test/unit_test/argparse/argparse_test.py
-
- - name: Test Callback Module
- run: python ./test/unit_test/callback/callback_test.py
-
- - name: Test Create Project Function
- run: python ./test/unit_test/create_project_file/create_project_test.py
-
- - name: Test Interval Scheduler
- run: python ./test/unit_test/scheduler_test/sec_interval_test.py
- - name: Test Cron Scheduler
- run: python ./test/unit_test/scheduler_test/sec_cron_test.py
-
- - name: Test Get Mouse Info
- run: python ./test/unit_test/get_info/mouse_info.py
- - name: Test Get Special Info
- run: python ./test/unit_test/get_info/special_info.py
- - name: Test Get Keyboard Info
- run: python ./test/unit_test/get_info/keyboard_info.py
diff --git a/.github/workflows/stable_python3_9.yml b/.github/workflows/stable_python3_9.yml
index b2922df..5a7eb03 100644
--- a/.github/workflows/stable_python3_9.yml
+++ b/.github/workflows/stable_python3_9.yml
@@ -30,6 +30,11 @@ jobs:
run: python ./test/unit_test/screen/screen_test.py
- name: Test Screenshot
run: python ./test/unit_test/screen/screenshot_test.py
+ - name: Save Screenshot Image
+ uses: actions/upload-artifact@v4
+ with:
+ name: screenshot_png
+ path: test.png
- name: Test Keyboard type Function
run: python ./test/unit_test/keyboard/keyboard_type_test.py
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c09cef7..570dd68 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,8 +5,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -77,7 +87,7 @@
"WebServerToolWindowFactoryState": "false",
"git-widget-placeholder": "dev",
"ignore.virus.scanning.warn.message": "true",
- "last_opened_file_path": "C:/CodeWorkspace/Python/FileAutomation",
+ "last_opened_file_path": "C:/CodeWorkspace/Python/AutoControlGUI",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
@@ -232,8 +242,8 @@
-
-
+
+
@@ -540,7 +550,12 @@
-
+
+
+
+
+
+
@@ -562,16 +577,16 @@
-
-
-
-
-
+
-
+
+
+
-
+
+
+
\ No newline at end of file
diff --git a/dev_requirements.txt b/dev_requirements.txt
index ce53eec..592f790 100644
--- a/dev_requirements.txt
+++ b/dev_requirements.txt
@@ -4,5 +4,5 @@ build
twine
sphinx
sphinx-rtd-theme
-Pyside6
+Pyside6==6.8.1
qt-material
diff --git a/je_auto_control/utils/logging/loggin_instance.py b/je_auto_control/utils/logging/loggin_instance.py
index 55157da..874e1c5 100644
--- a/je_auto_control/utils/logging/loggin_instance.py
+++ b/je_auto_control/utils/logging/loggin_instance.py
@@ -1,25 +1,25 @@
import logging
+from logging.handlers import RotatingFileHandler
logging.root.setLevel(logging.DEBUG)
autocontrol_logger = logging.getLogger("AutoControlGUI")
formatter = logging.Formatter('%(asctime)s | %(name)s | %(levelname)s | %(message)s')
-# File handler
-file_handler = logging.FileHandler(filename="AutoControlGUI.log", mode="w")
-file_handler.setFormatter(formatter)
-autocontrol_logger.addHandler(file_handler)
-class AutoControlLoggingHandler(logging.Handler):
+
+class AutoControlGUILoggingHandler(RotatingFileHandler):
# redirect logging stderr output to queue
- def __init__(self):
- super().__init__()
+ def __init__(self, filename: str = "AutoControlGUI.log", mode="w",
+ maxBytes:int=1073741824, backupCount:int=0):
+ super().__init__(filename=filename, mode=mode, maxBytes=maxBytes, backupCount=backupCount)
self.formatter = formatter
self.setLevel(logging.DEBUG)
def emit(self, record: logging.LogRecord) -> None:
- print(self.format(record))
+ super().emit(record)
-# Stream handler
-autocontrol_logger.addHandler(AutoControlLoggingHandler())
+# File handler
+file_handler = AutoControlGUILoggingHandler()
+autocontrol_logger.addHandler(file_handler)
diff --git a/pyproject.toml b/pyproject.toml
index b56032b..69d0193 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,12 +1,12 @@
-# Rename to build stable version
-# This is stable version
+# Rename to build dev version
+# This is dev version
[build-system]
-requires = ["setuptools>=61.0"]
+requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control"
-version = "0.0.162"
+name = "je_auto_control_dev"
+version = "0.0.105"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
@@ -16,8 +16,8 @@ license = { text = "MIT" }
dependencies = [
"je_open_cv",
"pillow",
- "Pyside6",
"APScheduler",
+ "Pyside6",
"pyobjc-core;platform_system=='Darwin'",
"pyobjc;platform_system=='Darwin'",
"python-Xlib;platform_system=='Linux'",
diff --git a/requirements.txt b/requirements.txt
index ad1f2c5..c278ddd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
je_auto_control
-Pyside6
+Pyside6==6.8.1
qt-material
diff --git a/dev.toml b/stable.toml
similarity index 90%
rename from dev.toml
rename to stable.toml
index 3cd70eb..b56032b 100644
--- a/dev.toml
+++ b/stable.toml
@@ -1,12 +1,12 @@
-# Rename to build dev version
-# This is dev version
+# Rename to build stable version
+# This is stable version
[build-system]
-requires = ["setuptools"]
+requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control_dev"
-version = "0.0.104"
+name = "je_auto_control"
+version = "0.0.162"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
@@ -16,8 +16,8 @@ license = { text = "MIT" }
dependencies = [
"je_open_cv",
"pillow",
- "APScheduler",
"Pyside6",
+ "APScheduler",
"pyobjc-core;platform_system=='Darwin'",
"pyobjc;platform_system=='Darwin'",
"python-Xlib;platform_system=='Linux'",
From 0b0908b565c75e5479735a1bf84ac32c8db56178 Mon Sep 17 00:00:00 2001
From: JE-Chen <33644111+JE-Chen@users.noreply.github.com>
Date: Sun, 5 Jan 2025 09:31:14 +0800
Subject: [PATCH 2/3] Remove not use dependency And add recording
Remove not use dependency And add recording
---
.idea/workspace.xml | 17 +------
dev_requirements.txt | 1 +
je_auto_control/__init__.py | 5 ++-
je_auto_control/gui/main_widget.py | 20 ---------
je_auto_control/gui/main_window.py | 44 -------------------
.../core/utils/x11_linux_display.py | 1 -
.../utils/cv2_utils/video_recording.py | 35 +++++++++++++++
.../{gui => utils/downloading}/__init__.py | 0
.../utils/downloading/file_download.py | 12 +++++
.../utils/logging/loggin_instance.py | 2 +-
.../utils/start_exe/start_another_process.py | 3 +-
pyproject.toml | 3 +-
requirements.txt | 2 +-
stable.toml | 1 +
14 files changed, 59 insertions(+), 87 deletions(-)
delete mode 100644 je_auto_control/gui/main_widget.py
delete mode 100644 je_auto_control/gui/main_window.py
create mode 100644 je_auto_control/utils/cv2_utils/video_recording.py
rename je_auto_control/{gui => utils/downloading}/__init__.py (100%)
create mode 100644 je_auto_control/utils/downloading/file_download.py
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 570dd68..aca0929 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,20 +4,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -555,7 +542,7 @@
-
+
diff --git a/dev_requirements.txt b/dev_requirements.txt
index 592f790..588b9e5 100644
--- a/dev_requirements.txt
+++ b/dev_requirements.txt
@@ -6,3 +6,4 @@ sphinx
sphinx-rtd-theme
Pyside6==6.8.1
qt-material
+mss
diff --git a/je_auto_control/__init__.py b/je_auto_control/__init__.py
index 7ef5d99..0206913 100644
--- a/je_auto_control/__init__.py
+++ b/je_auto_control/__init__.py
@@ -60,6 +60,8 @@
package_manager
from je_auto_control.utils.project.create_project_structure import \
create_project_dir
+# Scheduler
+from je_auto_control.utils.scheduler.extend_apscheduler import SchedulerManager
# Shell command
from je_auto_control.utils.shell_process.shell_exec import ShellManager
from je_auto_control.utils.shell_process.shell_exec import default_shell_manager
@@ -102,8 +104,7 @@
# import screen
from je_auto_control.wrapper.auto_control_screen import screen_size
from je_auto_control.wrapper.auto_control_screen import screenshot
-# Scheduler
-from je_auto_control.utils.scheduler.extend_apscheduler import SchedulerManager
+
__all__ = [
"click_mouse", "mouse_keys_table", "get_mouse_position", "press_mouse", "release_mouse",
"mouse_scroll", "set_mouse_position", "special_mouse_keys_table",
diff --git a/je_auto_control/gui/main_widget.py b/je_auto_control/gui/main_widget.py
deleted file mode 100644
index 999b0e7..0000000
--- a/je_auto_control/gui/main_widget.py
+++ /dev/null
@@ -1,20 +0,0 @@
-from __future__ import annotations
-
-from typing import TYPE_CHECKING
-
-if TYPE_CHECKING:
- from je_auto_control.gui.main_window import AutoControlGUI
-
-from PySide6.QtWidgets import QWidget, QGridLayout
-
-
-class AutoControlWidget(QWidget):
-
- def __init__(self, main_ui: AutoControlGUI):
- super().__init__()
- # Variable
- self.main_ui = main_ui
- # UI component
- # Grid layout
- self.grid_layout = QGridLayout()
- self.setLayout(self.grid_layout)
diff --git a/je_auto_control/gui/main_window.py b/je_auto_control/gui/main_window.py
deleted file mode 100644
index 791490f..0000000
--- a/je_auto_control/gui/main_window.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import os
-import sys
-from pathlib import Path
-
-from PySide6.QtCore import QCoreApplication, QTimer
-from PySide6.QtGui import QIcon
-from PySide6.QtWidgets import QMainWindow, QApplication
-from qt_material import apply_stylesheet
-
-from je_auto_control.gui.main_widget import AutoControlWidget
-
-
-class AutoControlGUI(QMainWindow):
-
- def __init__(self, debug_mode: bool = False):
- super().__init__()
- self.debug_mode = debug_mode
- self.central_widget = AutoControlWidget(self)
- self.setCentralWidget(self.central_widget)
- self.setWindowTitle("AutoControlGUI")
- # Set Icon
- self.icon_path = Path(os.getcwd() + "/je_driver_icon.ico")
- self.icon = QIcon(str(self.icon_path))
- if self.icon.isNull() is False:
- self.setWindowIcon(self.icon)
- if self.debug_mode:
- close_timer = QTimer(self)
- close_timer.setInterval(10000)
- close_timer.timeout.connect(self.debug_close)
- close_timer.start()
-
- @classmethod
- def debug_close(cls):
- sys.exit(0)
-
-
-def start_autocontrol_gui(debug_mode: bool = False) -> None:
- autocontrol_gui = QCoreApplication.instance()
- if autocontrol_gui is None:
- autocontrol_gui = QApplication(sys.argv)
- window = AutoControlGUI(debug_mode)
- apply_stylesheet(autocontrol_gui, theme='dark_amber.xml')
- window.showMaximized()
- sys.exit(autocontrol_gui.exec())
diff --git a/je_auto_control/linux_with_x11/core/utils/x11_linux_display.py b/je_auto_control/linux_with_x11/core/utils/x11_linux_display.py
index 9395355..3014e1b 100644
--- a/je_auto_control/linux_with_x11/core/utils/x11_linux_display.py
+++ b/je_auto_control/linux_with_x11/core/utils/x11_linux_display.py
@@ -9,6 +9,5 @@
import os
from Xlib.display import Display
-
# get x system display
display = Display(os.environ['DISPLAY'])
diff --git a/je_auto_control/utils/cv2_utils/video_recording.py b/je_auto_control/utils/cv2_utils/video_recording.py
new file mode 100644
index 0000000..17bbb54
--- /dev/null
+++ b/je_auto_control/utils/cv2_utils/video_recording.py
@@ -0,0 +1,35 @@
+import threading
+
+import cv2
+import numpy as np
+from mss import mss
+
+from je_auto_control.utils.logging.loggin_instance import autocontrol_logger
+
+
+class RecordingThread(threading.Thread):
+
+ def __init__(self, video_name: str = "autocontrol_recoding"):
+ autocontrol_logger.info("Init RecordingThread")
+ super().__init__()
+ self.recoding_flag = True
+ self.video_name = video_name
+
+ def set_recoding_flag(self, recoding_flag: bool):
+ autocontrol_logger.info(f"RecordingThread set_recoding_flag recoding_flag: {recoding_flag}")
+ self.recoding_flag = recoding_flag
+
+ def run(self):
+ with mss() as sct:
+ resolution = sct.monitors[0]
+ self.video_name = self.video_name + '.mp4'
+ fourcc = cv2.VideoWriter_fourcc(*'mp4v')
+ desired_fps = 20
+ video_writer = cv2.VideoWriter(self.video_name, fourcc, desired_fps,
+ (resolution['width'], resolution['height']))
+ while self.recoding_flag:
+ screen_image = sct.grab(resolution)
+ image_rgb = cv2.cvtColor(np.array(screen_image), cv2.COLOR_BGRA2BGR)
+ video_writer.write(image_rgb)
+ else:
+ video_writer.release()
diff --git a/je_auto_control/gui/__init__.py b/je_auto_control/utils/downloading/__init__.py
similarity index 100%
rename from je_auto_control/gui/__init__.py
rename to je_auto_control/utils/downloading/__init__.py
diff --git a/je_auto_control/utils/downloading/file_download.py b/je_auto_control/utils/downloading/file_download.py
new file mode 100644
index 0000000..8662154
--- /dev/null
+++ b/je_auto_control/utils/downloading/file_download.py
@@ -0,0 +1,12 @@
+import urllib.request
+import shutil
+
+from je_auto_control.utils.logging.loggin_instance import autocontrol_logger
+
+
+def download_file(url: str, file_name: str):
+ autocontrol_logger.info("file_download.py download_file"
+ f" url: {url} "
+ f" file_name: {file_name}")
+ with urllib.request.urlopen(url) as response, open(file_name, 'wb') as out_file:
+ shutil.copyfileobj(response, out_file)
\ No newline at end of file
diff --git a/je_auto_control/utils/logging/loggin_instance.py b/je_auto_control/utils/logging/loggin_instance.py
index 874e1c5..80288ea 100644
--- a/je_auto_control/utils/logging/loggin_instance.py
+++ b/je_auto_control/utils/logging/loggin_instance.py
@@ -11,7 +11,7 @@ class AutoControlGUILoggingHandler(RotatingFileHandler):
# redirect logging stderr output to queue
def __init__(self, filename: str = "AutoControlGUI.log", mode="w",
- maxBytes:int=1073741824, backupCount:int=0):
+ maxBytes: int = 1073741824, backupCount: int = 0):
super().__init__(filename=filename, mode=mode, maxBytes=maxBytes, backupCount=backupCount)
self.formatter = formatter
self.setLevel(logging.DEBUG)
diff --git a/je_auto_control/utils/start_exe/start_another_process.py b/je_auto_control/utils/start_exe/start_another_process.py
index ef38102..da8ff76 100644
--- a/je_auto_control/utils/start_exe/start_another_process.py
+++ b/je_auto_control/utils/start_exe/start_another_process.py
@@ -3,12 +3,11 @@
from je_auto_control.utils.exception.exception_tags import can_not_find_file
from je_auto_control.utils.exception.exceptions import AutoControlException
from je_auto_control.utils.logging.loggin_instance import autocontrol_logger
-
from je_auto_control.utils.shell_process.shell_exec import ShellManager
def start_exe(exe_path: str) -> None:
- autocontrol_logger.info(f"start_exe, exe_path: {exe_path}")
+ autocontrol_logger.info(f"start_another_process.py start_exe, exe_path: {exe_path}")
exe_path = Path(exe_path)
if exe_path.exists() and exe_path.is_file():
process_manager = ShellManager()
diff --git a/pyproject.toml b/pyproject.toml
index 69d0193..fb8a3b2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "je_auto_control_dev"
-version = "0.0.105"
+version = "0.0.106"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
@@ -21,6 +21,7 @@ dependencies = [
"pyobjc-core;platform_system=='Darwin'",
"pyobjc;platform_system=='Darwin'",
"python-Xlib;platform_system=='Linux'",
+ "mss"
]
classifiers = [
"Programming Language :: Python :: 3.9",
diff --git a/requirements.txt b/requirements.txt
index c278ddd..4d53ec2 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
je_auto_control
-Pyside6==6.8.1
qt-material
+mss
diff --git a/stable.toml b/stable.toml
index b56032b..a41c07a 100644
--- a/stable.toml
+++ b/stable.toml
@@ -21,6 +21,7 @@ dependencies = [
"pyobjc-core;platform_system=='Darwin'",
"pyobjc;platform_system=='Darwin'",
"python-Xlib;platform_system=='Linux'",
+ "mss"
]
classifiers = [
"Programming Language :: Python :: 3.9",
From fbea06b3b01e3e7b925070027c86985f6a9e394e Mon Sep 17 00:00:00 2001
From: JE-Chen <33644111+JE-Chen@users.noreply.github.com>
Date: Sun, 5 Jan 2025 09:43:48 +0800
Subject: [PATCH 3/3] Update stable version
Update stable version
---
stable.toml => dev.toml | 12 ++++++------
pyproject.toml | 12 ++++++------
2 files changed, 12 insertions(+), 12 deletions(-)
rename stable.toml => dev.toml (90%)
diff --git a/stable.toml b/dev.toml
similarity index 90%
rename from stable.toml
rename to dev.toml
index a41c07a..fb8a3b2 100644
--- a/stable.toml
+++ b/dev.toml
@@ -1,12 +1,12 @@
-# Rename to build stable version
-# This is stable version
+# Rename to build dev version
+# This is dev version
[build-system]
-requires = ["setuptools>=61.0"]
+requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control"
-version = "0.0.162"
+name = "je_auto_control_dev"
+version = "0.0.106"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
@@ -16,8 +16,8 @@ license = { text = "MIT" }
dependencies = [
"je_open_cv",
"pillow",
- "Pyside6",
"APScheduler",
+ "Pyside6",
"pyobjc-core;platform_system=='Darwin'",
"pyobjc;platform_system=='Darwin'",
"python-Xlib;platform_system=='Linux'",
diff --git a/pyproject.toml b/pyproject.toml
index fb8a3b2..efe2223 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,12 +1,12 @@
-# Rename to build dev version
-# This is dev version
+# Rename to build stable version
+# This is stable version
[build-system]
-requires = ["setuptools"]
+requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
-name = "je_auto_control_dev"
-version = "0.0.106"
+name = "je_auto_control"
+version = "0.0.163"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
@@ -16,8 +16,8 @@ license = { text = "MIT" }
dependencies = [
"je_open_cv",
"pillow",
- "APScheduler",
"Pyside6",
+ "APScheduler",
"pyobjc-core;platform_system=='Darwin'",
"pyobjc;platform_system=='Darwin'",
"python-Xlib;platform_system=='Linux'",