feat: 内置并统一使用项目 ADB (#149)
This commit is contained in:
+24
-1
@@ -17,16 +17,18 @@
|
||||
|
||||
import sys
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtCore import Qt, QTimer
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
from qfluentwidgets import (
|
||||
FluentIcon as FIF,
|
||||
FluentWindow,
|
||||
MessageBox,
|
||||
NavigationItemPosition,
|
||||
Theme,
|
||||
setTheme,
|
||||
)
|
||||
|
||||
from .adb_runtime import BundledAdbError, configure_bundled_adb_environment
|
||||
from .pdd_ui import PDDTaskPage
|
||||
from .pdd_ui_event import PDDTaskPageEvent
|
||||
from .pdd_u2_purchase_adapter import (
|
||||
@@ -147,8 +149,19 @@ def ui_main():
|
||||
app = QApplication(sys.argv)
|
||||
setTheme(Theme.AUTO)
|
||||
|
||||
adb_error = ""
|
||||
try:
|
||||
configure_bundled_adb_environment()
|
||||
except BundledAdbError as exc:
|
||||
adb_error = str(exc)
|
||||
|
||||
window = MainWindow()
|
||||
window.showMaximized()
|
||||
if adb_error:
|
||||
QTimer.singleShot(
|
||||
0,
|
||||
lambda: _show_adb_missing_dialog(window, adb_error),
|
||||
)
|
||||
try:
|
||||
mark_current_version_healthy()
|
||||
except OSError:
|
||||
@@ -157,5 +170,15 @@ def ui_main():
|
||||
return app.exec_()
|
||||
|
||||
|
||||
def _show_adb_missing_dialog(parent: MainWindow, message: str) -> None:
|
||||
"""在主窗口中央提示内置 ADB 缺失,用户可用大按钮关闭。"""
|
||||
|
||||
dialog = MessageBox("Android 调试组件缺失", message, parent)
|
||||
dialog.yesButton.setText("知道了")
|
||||
dialog.yesButton.setMinimumSize(120, 40)
|
||||
dialog.cancelButton.hide()
|
||||
dialog.exec()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(ui_main())
|
||||
|
||||
Reference in New Issue
Block a user