Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
修复远程主机扫描和检测理智的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
basket-ball committed May 2, 2020
1 parent 827f851 commit 072be6b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion MissionLocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def checklizhi(self, eq: str, size: list):
system('adb -s '+eq+' pull /sdcard/lizhi.png Data\\lizhi.png 1>nul 2>nul')
system('adb -s '+eq+' shell rm /sdcard/lizhi.png')
lizhiImg = imread('Data\\lizhi.png')
if lizhiImg[int(size[1]*(5/36)), int(size[0]*(75/144))][2] == 255 or lizhiImg[int(size[1]*(5/36)), int(size[0]*(106/144))][2] == 255:
if lizhiImg[int(size[1]*(5/9)), int(size[0]*(120/144))][2] != 130:
if self.lizhi['buhuifu']:
return 'buhuifu'
else:
Expand Down
35 changes: 18 additions & 17 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def LoopMission(self, runMission=None, M_location=None):
return
pass
elif lizhi == 'buhuifu':
self.setLog(self.tabname, logging.INFO, '不自动恢复理智,停止自动刷')
self.setLog(self.tabname, logging.INFO, '不自动恢复理智,停止自动刷=======================')
if self.end:
self.setLog(self.tabname, logging.INFO,'结束运行=======================================')
return
Expand All @@ -127,11 +127,11 @@ def LoopMission(self, runMission=None, M_location=None):
if self.end:
self.setLog(self.tabname, logging.INFO,'结束运行=======================================')
return
self.setLog(self.tabname, logging.INFO, '开始运行,60秒后循环检测运行状态,60秒内不能结束')
sleep(60)
if self.end:
self.setLog(self.tabname, logging.INFO,'结束运行=======================================')
return
self.setLog(self.tabname, logging.INFO, '开始运行,60秒后循环检测运行状态')
if self.end:
self.setLog(self.tabname, logging.INFO,'结束运行=======================================')
return
Expand All @@ -150,7 +150,7 @@ def LoopMission(self, runMission=None, M_location=None):
if 'N' in three:
three_times += 1
if three_times == 3:
self.setLog(self.tabname, logging.ERROR, '非三星次数过多,已停止')
self.setLog(self.tabname, logging.ERROR, '非三星次数过多,已停止===================')
return
self.setLog(self.tabname, logging.WARN, '检测到未三星')
if self.end:
Expand Down Expand Up @@ -178,7 +178,7 @@ def LoopMission(self, runMission=None, M_location=None):
self.setLog(self.tabname, logging.INFO, '理智自动执行成功')
pass
elif lizhi == 'buhuifu':
self.setLog(self.tabname, logging.INFO, '不自动恢复理智,停止自动刷')
self.setLog(self.tabname, logging.INFO, '不自动恢复理智,停止自动刷=======================')
return
else:
return
Expand All @@ -192,7 +192,7 @@ def LoopMission(self, runMission=None, M_location=None):
self.setLog(self.tabname, logging.INFO,
'结束运行=======================================')
return
self.setLog(self.tabname, logging.INFO, '开始运行,60秒后循环检测运行状态')
self.setLog(self.tabname, logging.INFO, '开始运行,60秒后循环检测运行状态,60秒内不能结束')
if self.end:
self.setLog(self.tabname, logging.INFO,
'结束运行=======================================')
Expand All @@ -212,7 +212,7 @@ def LoopMission(self, runMission=None, M_location=None):
three_times += 1
if three_times == 3:
self.setLog(
self.tabname, logging.ERROR, '非三星次数过多,已停止')
self.tabname, logging.ERROR, '非三星次数过多,已停止===================')
return
self.setLog(self.tabname, logging.WARN, '检测到未三星')
break
Expand Down Expand Up @@ -247,7 +247,7 @@ def testEq(self):
Tlist = []
def Connect(port,host='127.0.0.1'):
run(['adb.exe', 'connect', f'{host}:{port}'], stdout=PIPE)
hosts=eval(con.get('Nox','host'))
hosts=con.get('Nox','rhost')
if not hosts:
ports = eval(con.get('Nox', 'portlist'))
for port in ports:
Expand All @@ -274,7 +274,8 @@ def Connect(port,host='127.0.0.1'):
else:
self.Eqlist.addItems(eq_list)
else:
ports=eval(con.get('Nox','Rport'))
host=eval(host)
ports=eval(con.get('Nox','rport'))
for port in ports:
for host in hosts:
t = threading.Thread(target=Connect, args=(port,host))
Expand Down Expand Up @@ -355,15 +356,15 @@ def RS(self):
if not host:
QMessageBox.warning(self, '错误', '未输入主机名或IP地址')
else:
if not con.get('Nox','Rport'):
if not con.get('Nox','rport'):
result=LAN.Connect(host,portlist)
if not result:
QMessageBox.warning(self,'错误','未开启模拟器')
elif 'unknow' in result:
QMessageBox.warning(self,'错误','未知的主机名或IP地址')
else:
con.set('Nox','Rhost','[\''+host+'\']')
con.set('Nox','Rport',str(list(set(result))))
con.set('Nox','rhost','[\''+host+'\']')
con.set('Nox','rport',str(list(set(result))))
con.write(open('config.ini','w'))
QMessageBox.information(self,'完成','远程主机扫描完成,刷新设备会检测链接')
else:
Expand All @@ -373,12 +374,12 @@ def RS(self):
elif 'unknow' in result:
QMessageBox.warning(self,'错误','未知的主机名或IP地址')
else:
lasthost+=eval(con.get('Nox','Rhost'))
lasthost+=eval(con.get('Nox','rhost'))
lasthost.append(host)
lastport+=eval(con.get('Nox','Rport'))
lastport+=eval(con.get('Nox','rport'))
lastport+=(list(set(result)))
con.set('Nox','Rhost',str(list(set(lasthost))))
con.set('Nox','Rport',str(list(set(lastport))))
con.set('Nox','rhost',str(list(set(lasthost))))
con.set('Nox','rport',str(list(set(lastport))))
con.write(open('config.ini','w'))
QMessageBox.information(self,'完成','远程主机扫描完成,刷新设备会检测链接')
else:
Expand All @@ -390,8 +391,8 @@ def delConfig(self):
if con.get('Nox','dir'):
con.set('Nox','dir','')
con.set('Nox','portlist','')
con.set('Nox','Rhost','')
con.set('Nox','Rport','')
con.set('Nox','rhost','')
con.set('Nox','rport','')
con.write(open('config.ini','w'))
QMessageBox.information(self,'通知','已经删除config.ini配置')

Expand Down

0 comments on commit 072be6b

Please sign in to comment.