Neutree / COMTool

Cross platform communicate assistant(Serial/network/terminal tool)( 跨平台 串口调试助手 网络调试助手 终端工具 linux windows mac Raspberry Pi )支持插件和二次开发
https://neucrack.com/p/186
GNU Lesser General Public License v3.0
1.8k stars 330 forks source link

串口列表Combobox的显示问题 #23

Closed Luxni closed 5 years ago

Luxni commented 5 years ago

当把所有的串口都拔掉后,串口列表Combobox还是会显示有一个串口?

是否需要在方法detectSerialPortProcess()中添加一个


else
      self.serialPortCombobox.clear()

来清除Combobox里的内容

Neutree commented 5 years ago

emmm感觉不需要吧,这个扫描的动作只是在点击combobox后才触发的,平时是没有扫描的。

点击combobox后那个拔掉的也还在么

Luxni commented 5 years ago

是的呢,因为只会在检测到有串口的情况下才会更新Combobox,所以在拔最后一个串口后,就不会去更新Combobox了

def detectSerialPortProcess(self): while(1): portList = self.findSerialPort() if len(portList)>0: currText = self.serialPortCombobox.currentText() self.serialPortCombobox.clear() for i in portList: showStr = str(i[0])+" "+str(i[1]) self.serialPortCombobox.addItem(showStr)
index = self.serialPortCombobox.findText(currText) if index>=0: self.serialPortCombobox.setCurrentIndex(index) else: self.serialPortCombobox.setCurrentIndex(0) break

else:

        #     self.serialPortCombobox.clear()
        time.sleep(1)
    self.showSerialComboboxSignal.emit()
    self.isDetectSerialPort = False

------------------ 原始邮件 ------------------ 发件人: "Neucrack"notifications@github.com; 发送时间: 2019年5月28日(星期二) 上午10:24 收件人: "Neutree/COMTool"COMTool@noreply.github.com; 抄送: "丶"307993459@qq.com;"Author"author@noreply.github.com; 主题: Re: [Neutree/COMTool] 串口列表Combobox的显示问题 (#23)

emmm感觉不需要吧,这个扫描的动作只是在点击combobox后才触发的,平时是没有扫描的。

点击combobox后那个拔掉的也还在么

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Neutree commented 5 years ago

因为用的pyserial在拔掉串口后是没有触发什么事件的,也有可能是我没看到api,所以检测串口丢失也只能不停去扫描,这就需要后台一直驻留一个线程来工作,所以我没这样一直扫描

Luxni commented 5 years ago

好的,谢谢您的回复,打扰了。

------------------ 原始邮件 ------------------ 发件人: "Neucrack"notifications@github.com; 发送时间: 2019年5月28日(星期二) 上午10:46 收件人: "Neutree/COMTool"COMTool@noreply.github.com; 抄送: "丶"307993459@qq.com;"Author"author@noreply.github.com; 主题: Re: [Neutree/COMTool] 串口列表Combobox的显示问题 (#23)

因为用的pyserial在拔掉串口后是没有触发什么事件的,也有可能是我没看到api,所以检测串口丢失也只能不停取扫描,这就需要后台一直驻留一个线程来工作,所以我没这样一直扫描

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Neutree commented 5 years ago

嗯,没事儿~最好是串口断开有事件触发就好了