Skip to content
Merged

Dev #99

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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from je_auto_control.gui.main_widget import AutoControlGUIWidget
from je_editor import EditorWidget, language_wrapper
from je_editor.pyside_ui.main_ui.save_settings.user_color_setting_file import actually_color_dict

from automation_ide.automation_editor_ui.menu.menu_utils import open_web_browser

Expand All @@ -12,7 +13,7 @@
import sys

import je_auto_control
from PySide6.QtGui import QAction
from PySide6.QtGui import QAction, QTextCharFormat

from automation_ide.extend.process_executor.auto_control.auto_control_process import \
call_auto_control, call_auto_control_with_send, call_auto_control_multi_file, \
Expand Down Expand Up @@ -155,7 +156,11 @@ def create_project() -> None:
def stop_record(editor_instance: AutomationEditor):
widget = editor_instance.tab_widget.currentWidget()
if isinstance(widget, EditorWidget):
widget.code_edit.appendPlainText(str(je_auto_control.stop_record()))
text_cursor = widget.code_edit.textCursor()
text_format = QTextCharFormat()
text_format.setForeground(actually_color_dict.get("normal_output_color"))
text_cursor.insertText(str(je_auto_control.stop_record()), text_format)
text_cursor.insertBlock()


def add_autocontrol_gui(ui_we_want_to_set: AutomationEditor) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
from pathlib import Path
from queue import Queue
from threading import Thread
from typing import Union

from PySide6.QtCore import QTimer
from PySide6.QtGui import QTextCharFormat
from je_editor.pyside_ui.main_ui.save_settings.user_color_setting_file import actually_color_dict
from je_editor.utils.venv_check.check_venv import check_and_choose_venv

Expand All @@ -27,15 +29,15 @@ def __init__(
super().__init__()
self.compiler_path = None
# ite_instance param
self.read_program_error_output_from_thread: [threading.Thread, None] = None
self.read_program_output_from_thread: [threading.Thread, None] = None
self.read_program_error_output_from_thread: Union[threading.Thread, None] = None
self.read_program_output_from_thread: Union[threading.Thread, None] = None
self.main_window: CodeWindow = main_window
self.timer: QTimer = QTimer(self.main_window)
self.still_run_program: bool = True
self.program_encoding: str = program_encoding
self.run_output_queue: Queue = Queue()
self.run_error_queue: Queue = Queue()
self.process: [subprocess.Popen, None] = None
self.process: Union[subprocess.Popen, None] = None

self.task_done_trigger_function: typing.Callable = task_done_trigger_function
self.error_trigger_function: typing.Callable = error_trigger_function
Expand Down Expand Up @@ -98,19 +100,24 @@ def start_test_process(self, package: str, exec_str: str):
# Pyside UI update method
def pull_text(self):
try:
self.main_window.code_result.setTextColor(actually_color_dict.get("normal_output_color"))
if not self.run_output_queue.empty():
output_message = self.run_output_queue.get_nowait()
output_message = str(output_message).strip()
if output_message:
self.main_window.code_result.append(output_message)
self.main_window.code_result.setTextColor(actually_color_dict.get("error_output_color"))
text_cursor = self.main_window.code_result.textCursor()
text_format = QTextCharFormat()
text_format.setForeground(actually_color_dict.get("normal_output_color"))
text_cursor.insertText(output_message, text_format)
text_cursor.insertBlock()
if not self.run_error_queue.empty():
error_message = self.run_error_queue.get_nowait()
error_message = str(error_message).strip()
if error_message:
self.main_window.code_result.append(error_message)
self.main_window.code_result.setTextColor(actually_color_dict.get("normal_output_color"))
text_cursor = self.main_window.code_result.textCursor()
text_format = QTextCharFormat()
text_format.setForeground(actually_color_dict.get("error_output_color"))
text_cursor.insertText(error_message, text_format)
text_cursor.insertBlock()
except queue.Empty:
pass
if self.process is not None:
Expand Down Expand Up @@ -139,7 +146,11 @@ def exit_program(self):
self.print_and_clear_queue()
if self.process is not None:
self.process.terminate()
self.main_window.code_result.append(f"Task exit with code {self.process.returncode}")
text_cursor = self.main_window.code_result.textCursor()
text_format = QTextCharFormat()
text_format.setForeground(actually_color_dict.get("normal_output_color"))
text_cursor.insertText(f"Task exit with code {self.process.returncode}", text_format)
text_cursor.insertBlock()
self.process = None

def print_and_clear_queue(self):
Expand All @@ -149,15 +160,17 @@ def print_and_clear_queue(self):
def read_program_output_from_process(self):
while self.still_run_program:
self.process: subprocess.Popen
program_output_data = self.process.stdout.read(self.program_buffer_size)
program_output_data = self.process.stdout.readline(self.program_buffer_size)\
.decode("utf-8", "replace")
if self.process:
self.process.stdout.flush()
if program_output_data.strip() != "":
self.run_output_queue.put(program_output_data)

def read_program_error_output_from_process(self):
while self.still_run_program:
program_error_output_data = self.process.stderr.read(self.program_buffer_size)
program_error_output_data = self.process.stderr.readline(self.program_buffer_size)\
.decode("utf-8", "replace")
if self.process:
self.process.stderr.flush()
if program_error_output_data.strip() != "":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import threading
from pathlib import Path
from queue import Queue
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Union

from PySide6.QtCore import QTimer
from PySide6.QtGui import QTextCharFormat
from PySide6.QtWidgets import QWidget
from je_editor.pyside_ui.main_ui.save_settings.user_color_setting_file import actually_color_dict
from je_editor.utils.venv_check.check_venv import check_and_choose_venv
Expand Down Expand Up @@ -38,8 +39,8 @@ def __init__(
self._program_buffer_size = program_buffer
self._run_output_queue: Queue = Queue()
self._run_error_queue: Queue = Queue()
self._read_program_error_output_from_thread: [threading.Thread, None] = None
self._read_program_output_from_thread: [threading.Thread, None] = None
self._read_program_error_output_from_thread: Union[threading.Thread, None] = None
self._read_program_output_from_thread: Union[threading.Thread, None] = None
self._timer: QTimer = QTimer(self._code_window)
if self._main_window.python_compiler is None:
# Renew compiler path
Expand Down Expand Up @@ -74,19 +75,24 @@ def __init__(
# Pyside UI update method
def pull_text(self):
try:
self._code_window.code_result.setTextColor(actually_color_dict.get("normal_output_color"))
if not self._run_output_queue.empty():
output_message = self._run_output_queue.get_nowait()
output_message = str(output_message).strip()
if output_message:
self._code_window.code_result.append(output_message)
self._code_window.code_result.setTextColor(actually_color_dict.get("error_output_color"))
text_cursor = self._code_window.code_result.textCursor()
text_format = QTextCharFormat()
text_format.setForeground(actually_color_dict.get("normal_output_color"))
text_cursor.insertText(output_message, text_format)
text_cursor.insertBlock()
if not self._run_error_queue.empty():
error_message = self._run_error_queue.get_nowait()
error_message = str(error_message).strip()
if error_message:
self._code_window.code_result.append(error_message)
self._code_window.code_result.setTextColor(actually_color_dict.get("normal_output_color"))
text_cursor = self._code_window.code_result.textCursor()
text_format = QTextCharFormat()
text_format.setForeground(actually_color_dict.get("error_output_color"))
text_cursor.insertText(error_message, text_format)
text_cursor.insertBlock()
except queue.Empty:
pass
if self._process is not None:
Expand Down Expand Up @@ -115,7 +121,11 @@ def exit_program(self):
self.print_and_clear_queue()
if self._process is not None:
self._process.terminate()
self._code_window.code_result.append(f"Task exit with code {self._process.returncode}")
text_cursor = self._code_window.code_result.textCursor()
text_format = QTextCharFormat()
text_format.setForeground(actually_color_dict.get("normal_output_color"))
text_cursor.insertText(f"Task exit with code {self._process.returncode}", text_format)
text_cursor.insertBlock()
self._process = None

def print_and_clear_queue(self):
Expand All @@ -125,15 +135,17 @@ def print_and_clear_queue(self):
def read_program_output_from_process(self):
while self._still_run_program:
self.process: subprocess.Popen
program_output_data = self._process.stdout.read(self._program_buffer_size)
program_output_data = self._process.stdout.readline(self._program_buffer_size)\
.decode("utf-8", "replace")
if self._process:
self._process.stdout.flush()
if program_output_data.strip() != "":
self._run_output_queue.put(program_output_data)

def read_program_error_output_from_process(self):
while self._still_run_program:
program_error_output_data = self._process.stderr.read(self._program_buffer_size)
program_error_output_data = self._process.stderr.readline(self._program_buffer_size)\
.decode("utf-8", "replace")
if self._process:
self._process.stderr.flush()
if program_error_output_data.strip() != "":
Expand Down
11 changes: 6 additions & 5 deletions stable.toml → dev.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Rename to build stable version
# This is stable version
# Rename to dev version
# This is dev version
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "automation_ide"
version = "0.0.44"
name = "automation_ide_dev"
version = "0.0.52"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
Expand All @@ -16,7 +16,7 @@ license-files = ["LICENSE"]
dependencies = [
"je-editor", "je_auto_control", "je_web_runner",
"je_load_density", "je_api_testka", "je-mail-thunder",
"automation-file", "PySide6==6.9.1", "test_pioneer"
"automation-file", "PySide6==6.9.2", "test_pioneer"
]
classifiers = [
"Programming Language :: Python :: 3.10",
Expand All @@ -35,5 +35,6 @@ Code = "https://github.com/Intergration-Automation-Testing/AutomationEditor"
file = "README.md"
content-type = "text/markdown"


[tool.setuptools.packages]
find = { namespaces = false }
2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ je-mail-thunder
automation_ide_dev
sphinx
sphinx-rtd-theme
PySide6==6.9.1
PySide6==6.9.2
auto-py-to-exe
test_pioneer
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Rename to dev version
# This is dev version
# Rename to build stable version
# This is stable version
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "automation_ide_dev"
version = "0.0.49"
name = "automation_ide"
version = "0.0.46"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
Expand All @@ -16,7 +16,7 @@ license-files = ["LICENSE"]
dependencies = [
"je-editor", "je_auto_control", "je_web_runner",
"je_load_density", "je_api_testka", "je-mail-thunder",
"automation-file", "PySide6==6.9.1", "test_pioneer"
"automation-file", "PySide6==6.9.2", "test_pioneer"
]
classifiers = [
"Programming Language :: Python :: 3.10",
Expand All @@ -35,6 +35,5 @@ Code = "https://github.com/Intergration-Automation-Testing/AutomationEditor"
file = "README.md"
content-type = "text/markdown"


[tool.setuptools.packages]
find = { namespaces = false }
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
automation_ide
PySide6==6.9.1
PySide6==6.9.2
Loading