修复bug

This commit is contained in:
2025-10-21 16:55:40 +08:00
parent ac92747892
commit bb8029b498
4 changed files with 8 additions and 2 deletions

4
.idea/workspace.xml generated
View File

@@ -4,7 +4,9 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="eceeff5e-51c1-459c-a911-d21ec090a423" name="Changes" comment="20250904-初步功能已完成" />
<list default="true" id="eceeff5e-51c1-459c-a911-d21ec090a423" name="Changes" comment="20250904-初步功能已完成">
<change beforePath="$PROJECT_DIR$/Module/DeviceInfo.py" beforeDir="false" afterPath="$PROJECT_DIR$/Module/DeviceInfo.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />

View File

@@ -78,15 +78,19 @@ class DeviceInfo:
if w == 0 or h == 0 or s == 0:
print("未获取到设备屏幕信息")
return
print("获取设备信息成功")
port = self._alloc_port()
proc = self._start_iproxy(udid, port)
if not proc:
print("启动iproxy失败")
return
model = DeviceModel(deviceId=udid, screenPort=port,
width=w, height=h, scale=s, type=1)
model.ready = True
self._models[udid] = model
self._procs[udid] = proc
print("准备添加设备")
self._manager_send(model)
# ---------------- 移除设备 ----------------
@@ -150,7 +154,7 @@ class DeviceInfo:
flags = subprocess.CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP
return subprocess.Popen(
[self._iproxy_path, "-u", udid, str(port), wdaScreenPort],
[self._iproxy_path, "-u", udid, str(port), str(wdaScreenPort)],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
creationflags=flags