Skip to content

Commit 9c7b717

Browse files
committed
Update --ui
1 parent fc69a0a commit 9c7b717

1 file changed

Lines changed: 4 additions & 38 deletions

File tree

src/HwCodecDetect/run_tests.py

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -806,40 +806,6 @@ def launch_gui(args):
806806
root.mainloop()
807807

808808

809-
def get_launch_method():
810-
if PSUTIL_AVAILABLE:
811-
try:
812-
current_process = psutil.Process(os.getpid())
813-
parent = current_process.parent()
814-
if parent is None:
815-
print("launch_method: unknown")
816-
return "unknown"
817-
print("parent name:", parent.name())
818-
parent_name = parent.name().lower()
819-
shell_procs = ["cmd.exe", "powershell.exe", "pwsh.exe", "windows terminal", "wt.exe"]
820-
if parent_name == "explorer.exe" or "hwcodecdetect" in parent_name:
821-
print("launch_method: double_click")
822-
return "double_click"
823-
elif any(shell in parent_name for shell in shell_procs):
824-
print("launch_method: terminal")
825-
return "terminal"
826-
else:
827-
print("launch_method: other")
828-
return f"other ({parent_name})"
829-
except Exception as e:
830-
print(f"error: {e}")
831-
return f"error: {e}"
832-
else:
833-
import ctypes
834-
kernel32 = ctypes.windll.kernel32
835-
h_std_out = kernel32.GetStdHandle(-11)
836-
pids = (ctypes.c_uint * 10)()
837-
count = kernel32.GetConsoleProcessList(pids, 10)
838-
if count <= 1:
839-
return "double_click"
840-
return "terminal"
841-
842-
843809
def main():
844810
"""Parses arguments and runs the test suite."""
845811

@@ -900,10 +866,10 @@ def main():
900866
)
901867

902868
parser.add_argument(
903-
"-ui", "--ui",
904-
action="store_true",
905-
default=(get_launch_method() == "double_click"),
906-
help="Launch GUI"
869+
"--ui",
870+
action='store_true',
871+
default=True,
872+
help="Launch GUI(Default: True)"
907873
)
908874

909875
args = parser.parse_args()

0 commit comments

Comments
 (0)