feat: 内置并统一使用项目 ADB (#149)
This commit is contained in:
@@ -15,6 +15,7 @@ from PyQt5.QtCore import (
|
||||
pyqtSlot,
|
||||
)
|
||||
|
||||
from .adb_runtime import BundledAdbError, validate_bundled_adb
|
||||
from .android_device_service import (
|
||||
AndroidDeviceConversionCancelled,
|
||||
AndroidDeviceSearchError,
|
||||
@@ -359,6 +360,12 @@ class SettingsPageEventBinder(QObject):
|
||||
self._live_purchase_adapter_ready = bool(
|
||||
live_purchase_adapter_ready
|
||||
)
|
||||
self._adb_unavailable_message = ""
|
||||
if android_device_service is None:
|
||||
try:
|
||||
validate_bundled_adb()
|
||||
except BundledAdbError as exc:
|
||||
self._adb_unavailable_message = str(exc)
|
||||
self._android_device_service = (
|
||||
android_device_service or AndroidDeviceService()
|
||||
)
|
||||
@@ -416,8 +423,12 @@ class SettingsPageEventBinder(QObject):
|
||||
|
||||
self._load_current_client()
|
||||
self._load_selected_android_device()
|
||||
if self._adb_unavailable_message:
|
||||
self._page.deviceStatusLabel.setText(
|
||||
self._adb_unavailable_message
|
||||
)
|
||||
self._sync_button_state()
|
||||
if self._saved_android_serial:
|
||||
if self._saved_android_serial and not self._adb_unavailable_message:
|
||||
QTimer.singleShot(0, self._request_restore_saved_android_device)
|
||||
|
||||
@pyqtSlot()
|
||||
@@ -910,7 +921,8 @@ class SettingsPageEventBinder(QObject):
|
||||
and not self._android_setting_busy
|
||||
)
|
||||
device_commands_enabled = (
|
||||
not self._busy
|
||||
not self._adb_unavailable_message
|
||||
and not self._busy
|
||||
and not self._search_busy
|
||||
and not self._wifi_conversion_busy
|
||||
and not self._android_setting_busy
|
||||
|
||||
Reference in New Issue
Block a user