mirror of
https://github.com/YaoFANGUK/video-subtitle-remover.git
synced 2026-05-07 10:07:30 +08:00
在代码中添加管理员权限请求功能
- 在gui.py中添加Windows管理员权限检测和请求代码 - 使用ctypes.windll.shell32.ShellExecuteW实现UAC权限提升 - 移除PyInstaller的uac_admin配置避免启动问题 - 优化spec文件确保interface文件正确复制 - 程序现在会在启动时自动请求管理员权限 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
7
gui.py
7
gui.py
@@ -11,9 +11,16 @@ import os
|
||||
import configparser
|
||||
import cv2
|
||||
import multiprocessing
|
||||
import ctypes
|
||||
from PySide6.QtCore import Qt, QTranslator
|
||||
from PySide6 import QtCore, QtWidgets, QtGui
|
||||
from PySide6.QtWidgets import QApplication, QFrame, QStackedWidget, QHBoxLayout, QLabel
|
||||
|
||||
# 请求管理员权限(Windows)
|
||||
if sys.platform == 'win32' and not ctypes.windll.shell32.IsUserAnAdmin():
|
||||
params = ' '.join([f'"{arg}"' for arg in sys.argv])
|
||||
ctypes.windll.shell32.ShellExecuteW(None, 'runas', sys.executable, params, None, 1)
|
||||
sys.exit(0)
|
||||
from qfluentwidgets import (FluentWindow, PushButton, Slider, ProgressBar, PlainTextEdit,
|
||||
setTheme, Theme, FluentIcon, CardWidget, SettingCardGroup,
|
||||
ComboBoxSettingCard, SwitchSettingCard, setThemeColor, OptionsConfigItem,
|
||||
|
||||
Reference in New Issue
Block a user