feat: 检测 Android 设备 PDD 安装状态 (#29)

This commit is contained in:
chengma
2026-08-07 15:54:12 +08:00
parent a6e3fe0417
commit 6d863a1a8a
5 changed files with 569 additions and 79 deletions
+29 -18
View File
@@ -240,16 +240,11 @@ class SettingsPage(QWidget):
"设备信息尚未保存", self
)
self.currentDeviceStatusLabel.setAccessibleName("当前设备保存状态")
self.currentDeviceStatusLabel.setWordWrap(True)
self.currentDeviceCard = self._build_current_device_card()
self.addressInput = LineEdit(self)
self.addressInput.setPlaceholderText("例如 192.168.0.173:5555")
self.addressInput.setClearButtonEnabled(True)
self.addressInput.setAccessibleName("Android 无线调试地址")
self.searchButton = PushButton(FIF.SEARCH, "搜索", self)
self.connectButton = PushButton(FIF.LINK, "连接", self)
self.convertWifiButton = PushButton(FIF.WIFI, "转为 Wi-Fi", self)
self.convertWifiButton.setAccessibleName(
"将勾选的 USB Android 设备转为 Wi-Fi 连接"
@@ -288,6 +283,10 @@ class SettingsPage(QWidget):
self.deviceStatusLabel = CaptionLabel("当前使用设备:未选择", self)
self.deviceStatusLabel.setAccessibleName("Android 设备搜索和选择状态")
self.deviceStatusLabel.setWordWrap(True)
self.pddAppStatusLabel = CaptionLabel("未检测", self)
self.pddAppStatusLabel.setAccessibleName("PDD 应用安装状态")
self.pddAppStatusLabel.setWordWrap(True)
self.androidDeviceCard = self._build_android_device_card()
content = QWidget(self)
@@ -329,7 +328,13 @@ class SettingsPage(QWidget):
layout = QVBoxLayout(card)
layout.setContentsMargins(24, 20, 24, 22)
layout.setSpacing(12)
layout.addWidget(SubtitleLabel("当前设备", card))
titleLayout = QHBoxLayout()
titleLayout.setSpacing(12)
titleLayout.addWidget(SubtitleLabel("当前设备", card))
titleLayout.addStretch(1)
titleLayout.addWidget(self.currentDeviceStatusLabel, 1)
layout.addLayout(titleLayout)
form = QFormLayout()
form.setHorizontalSpacing(16)
@@ -346,7 +351,6 @@ class SettingsPage(QWidget):
commandLayout.addStretch(1)
commandLayout.addWidget(self.currentDeviceSaveButton)
layout.addLayout(commandLayout)
layout.addWidget(self.currentDeviceStatusLabel)
return card
def _build_android_device_card(self) -> CardWidget:
@@ -354,16 +358,19 @@ class SettingsPage(QWidget):
layout = QVBoxLayout(card)
layout.setContentsMargins(24, 20, 24, 22)
layout.setSpacing(12)
layout.addWidget(SubtitleLabel("Android 设备", card))
addressLayout = QHBoxLayout()
addressLayout.setSpacing(12)
addressLabel = CaptionLabel("无线地址", card)
addressLabel.setBuddy(self.addressInput)
addressLayout.addWidget(addressLabel)
addressLayout.addWidget(self.addressInput, 1)
addressLayout.addWidget(self.connectButton)
layout.addLayout(addressLayout)
titleLayout = QHBoxLayout()
titleLayout.setSpacing(12)
titleLayout.addWidget(SubtitleLabel("Android 设备", card))
titleLayout.addStretch(1)
titleLayout.addWidget(self.deviceStatusLabel, 1)
layout.addLayout(titleLayout)
pddStatusLayout = QHBoxLayout()
pddStatusLayout.setSpacing(12)
pddStatusLayout.addWidget(CaptionLabel("PDD 应用", card))
pddStatusLayout.addWidget(self.pddAppStatusLabel, 1)
layout.addLayout(pddStatusLayout)
commandLayout = QHBoxLayout()
commandLayout.setSpacing(10)
@@ -374,7 +381,6 @@ class SettingsPage(QWidget):
commandLayout.addWidget(self.deleteButton)
layout.addLayout(commandLayout)
layout.addWidget(self.deviceTable, 1)
layout.addWidget(self.deviceStatusLabel)
return card
def set_client_info(self, device_id: str, device_name: str) -> None:
@@ -394,6 +400,11 @@ class SettingsPage(QWidget):
self.deviceTableModel.set_devices(devices)
self._update_device_placeholder_rows()
def set_pdd_app_status(self, message: str) -> None:
"""显示当前勾选设备上的 PDD 安装检测结果。"""
self.pddAppStatusLabel.setText(message)
def set_saved_android_device(self, serial: str) -> None:
"""显示已经保存并实际用于自动化的 Android 设备。"""