mirror of
https://github.com/netinvent/npbackup.git
synced 2025-10-04 02:36:33 +08:00
Linter fixes for new GUI handle_window function
This commit is contained in:
parent
4afa8f38d1
commit
3916e4ec9f
1 changed files with 9 additions and 4 deletions
|
@ -33,26 +33,31 @@ def handle_current_window(action: str = "minimize") -> None:
|
|||
import win32con
|
||||
import ctypes
|
||||
|
||||
kernel32 = ctypes.WinDLL('kernel32')
|
||||
kernel32 = ctypes.WinDLL("kernel32")
|
||||
|
||||
# get the console window
|
||||
# pylint: disable=I1101 (c-extension-no-member)
|
||||
hWnd = kernel32.GetConsoleWindow()
|
||||
|
||||
# set it as foreground
|
||||
win32gui.SetForegroundWindow(hWnd)
|
||||
# pylint: disable=I1101 (c-extension-no-member)
|
||||
win32gui.SetForegroundWindow(hWnd)
|
||||
|
||||
# get the foreground window
|
||||
hWnd = win32gui.GetForegroundWindow()
|
||||
# pylint: disable=I1101 (c-extension-no-member)
|
||||
hWnd = win32gui.GetForegroundWindow()
|
||||
|
||||
# hide it
|
||||
if action == "minimize":
|
||||
# pylint: disable=I1101 (c-extension-no-member)
|
||||
win32gui.ShowWindow(hWnd, win32con.SW_MINIMIZE)
|
||||
elif action == "hide":
|
||||
# pylint: disable=I1101 (c-extension-no-member)
|
||||
win32gui.ShowWindow(hWnd, win32con.SW_HIDE)
|
||||
elif action == "show":
|
||||
# pylint: disable=I1101 (c-extension-no-member)
|
||||
win32gui.ShowWindow(hWnd, win32con.SW_SHOW)
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Bad action parameter for handling current window: {action}"
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue