Skip to content

Commit

Permalink
Fix use old color
Browse files Browse the repository at this point in the history
  • Loading branch information
JE-Chen committed Sep 7, 2023
1 parent 56428df commit bb4d57b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 31 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,7 @@ dmypy.json

# Mailthunder
**/mail_thunder_content.json

# JEditor
.jeditor
**/.jeditor
35 changes: 12 additions & 23 deletions automation_editor/extend/process_executor/task_process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from threading import Thread

from PySide6.QtCore import QTimer
from je_editor import error_color, output_color
from je_editor import user_setting_color_dict

from automation_editor.automation_editor_ui.show_code_window.code_window import CodeWindow
from automation_editor.utils.exception.exception_tags import compiler_not_found_error
Expand Down Expand Up @@ -77,7 +77,8 @@ def start_test_process(self, package: str, exec_str: str):
exec_str
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
stderr=subprocess.PIPE,
shell=True
)
self.still_run_program = True
# program output message queue thread
Expand All @@ -104,18 +105,19 @@ 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(error_color)
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(output_color)
self.main_window.code_result.setTextColor(user_setting_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(user_setting_color_dict.get("error_output_color"))
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(user_setting_color_dict.get("normal_output_color"))
except queue.Empty:
pass
if self.process is not None:
Expand Down Expand Up @@ -144,23 +146,10 @@ def exit_program(self):
self.print_and_clear_queue()
if self.process is not None:
self.process.terminate()
print(f"Task exit with code {self.process.returncode}")
self.main_window.code_result.append(f"Task exit with code {self.process.returncode}")
self.process = None

def print_and_clear_queue(self):
try:
for std_output in iter(self.run_output_queue.get_nowait, None):
std_output = str(std_output).strip()
if std_output:
self.main_window.code_result.append(std_output)
self.main_window.code_result.setTextColor(error_color)
for std_err in iter(self.run_error_queue.get_nowait, None):
std_err = str(std_err).strip()
if std_err:
self.main_window.code_result.append(std_err)
self.main_window.code_result.setTextColor(output_color)
except queue.Empty:
pass
self.run_output_queue = queue.Queue()
self.run_error_queue = queue.Queue()

Expand Down
8 changes: 4 additions & 4 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_editor"
version = "0.0.25"
name = "automation_editor_dev"
version = "0.0.26"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
Expand Down
8 changes: 4 additions & 4 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_editor_dev"
version = "0.0.25"
name = "automation_editor"
version = "0.0.26"
authors = [
{ name = "JE-Chen", email = "jechenmailman@gmail.com" },
]
Expand Down

0 comments on commit bb4d57b

Please sign in to comment.