Linter fixes for new GUI handle_window function

This commit is contained in:
deajan 2025-06-27 18:26:25 +02:00
parent 4afa8f38d1
commit 3916e4ec9f

View file

@ -33,26 +33,31 @@ def handle_current_window(action: str = "minimize") -> None:
import win32con import win32con
import ctypes import ctypes
kernel32 = ctypes.WinDLL('kernel32') kernel32 = ctypes.WinDLL("kernel32")
# get the console window # get the console window
# pylint: disable=I1101 (c-extension-no-member)
hWnd = kernel32.GetConsoleWindow() hWnd = kernel32.GetConsoleWindow()
# set it as foreground # set it as foreground
# pylint: disable=I1101 (c-extension-no-member)
win32gui.SetForegroundWindow(hWnd) win32gui.SetForegroundWindow(hWnd)
# get the foreground window # get the foreground window
# pylint: disable=I1101 (c-extension-no-member)
hWnd = win32gui.GetForegroundWindow() hWnd = win32gui.GetForegroundWindow()
# hide it # hide it
if action == "minimize": if action == "minimize":
# pylint: disable=I1101 (c-extension-no-member)
win32gui.ShowWindow(hWnd, win32con.SW_MINIMIZE) win32gui.ShowWindow(hWnd, win32con.SW_MINIMIZE)
elif action == "hide": elif action == "hide":
# pylint: disable=I1101 (c-extension-no-member)
win32gui.ShowWindow(hWnd, win32con.SW_HIDE) win32gui.ShowWindow(hWnd, win32con.SW_HIDE)
elif action == "show": elif action == "show":
# pylint: disable=I1101 (c-extension-no-member)
win32gui.ShowWindow(hWnd, win32con.SW_SHOW) win32gui.ShowWindow(hWnd, win32con.SW_SHOW)
else: else:
raise ValueError( raise ValueError(
f"Bad action parameter for handling current window: {action}" f"Bad action parameter for handling current window: {action}"
) )