44from pathlib import Path
55from sys import getdefaultencoding
66from typing import Optional , Sequence , Union
7+ from warnings import warn
78
89from PySide6 .QtCore import QIODeviceBase , QObject , QProcess , Signal
910
@@ -160,9 +161,9 @@ def _handle_state(self, state: QProcess.ProcessState) -> None:
160161 """
161162
162163 states = {
163- QProcess .ProcessState .NotRunning : "非运行 " ,
164- QProcess .ProcessState .Starting : "启动中…… " ,
165- QProcess .ProcessState .Running : "正在运行中…… " ,
164+ QProcess .ProcessState .NotRunning : "The process is not running. " ,
165+ QProcess .ProcessState .Starting : "The process is starting... " ,
166+ QProcess .ProcessState .Running : "The process is running... " ,
166167 }
167168 state_name = states [state ]
168169 self .output .emit ((self .STATE , state_name ))
@@ -174,16 +175,17 @@ def _handle_error(self, error: QProcess.ProcessError) -> None:
174175 """
175176
176177 process_error = {
177- QProcess .ProcessError .FailedToStart : "进程启动失败 " ,
178- QProcess .ProcessError .Crashed : "进程崩溃 " ,
179- QProcess .ProcessError .Timedout : "超时 " ,
180- QProcess .ProcessError .WriteError : "写入错误 " ,
181- QProcess .ProcessError .ReadError : "读取错误 " ,
182- QProcess .ProcessError .UnknownError : "未知错误 " ,
178+ QProcess .ProcessError .FailedToStart : "The process failed to start. " ,
179+ QProcess .ProcessError .Crashed : "The process has crashed. " ,
180+ QProcess .ProcessError .Timedout : "The process has timed out. " ,
181+ QProcess .ProcessError .WriteError : "A write error occurred in the process. " ,
182+ QProcess .ProcessError .ReadError : "A read error occurred in the process " ,
183+ QProcess .ProcessError .UnknownError : "An unknown error has occurred in the process. " ,
183184 }
184185 error_type = process_error [error ]
185186
186187 if self ._process :
187188 self .abort_process (0 )
188189 self .output .emit ((self .ERROR , error_type ))
190+ warn (error_type , category = Warning , stacklevel = 3 )
189191 self ._process = None
0 commit comments