代码拉取完成,页面将自动刷新
同步操作将从 调试中.../Minicontrol 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import os
from PyQt4 import QtGui
from PyQt4.QtGui import QButtonGroup
from AdbUtils import adb_execute, adb_get_devices
from Dialog_Choose_Device import Ui_Choose_Device
class DialogChooseDevice(QtGui.QDialog):
def __init__(self, parent=None, device_serial=None):
super(DialogChooseDevice, self).__init__(parent)
self.dialog = Ui_Choose_Device()
self.dialog.setupUi(self)
self.info_list = []
self.device_serial = device_serial
self.button_group = QButtonGroup()
self.update_device(self.device_serial)
def update_device(self, device_serial=None):
self.info_list, has = adb_get_devices()
item = self.dialog.verticalLayout_2.takeAt(0)
while item:
self.dialog.verticalLayout_2.removeItem(item)
item.widget().setParent(None)
item = self.dialog.verticalLayout_2.takeAt(0)
if len(self.info_list) > 0:
if device_serial is None or len(device_serial) <= 1:
device_serial = self.info_list[0]["serial"]
else:
label = QtGui.QLabel()
label.setText("No device")
self.dialog.verticalLayout_2.insertWidget(0, label)
return
for index in range(len(self.info_list)):
info = self.info_list[index]
radio_button = QtGui.QRadioButton()
radio_button.setText(info["info"])
self.dialog.verticalLayout_2.insertWidget(index, radio_button)
self.button_group.addButton(radio_button)
if device_serial == info["serial"]:
radio_button.setChecked(True)
def get_select_item(self):
index = 0
item = self.dialog.verticalLayout_2.takeAt(0)
while item:
widget = item.widget()
if isinstance(widget, QtGui.QRadioButton):
if widget.isChecked():
return self.info_list[index]
index = index + 1
item = self.dialog.verticalLayout_2.takeAt(0)
return None
def on_refresh_click(self):
self.update_device(self.device_serial)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。