eric6/MicroPython/MicroPythonReplWidget.py

branch
micropython
changeset 7120
89ee83fadec9
parent 7111
62191d1aeeed
child 7123
94948e2aa0a5
--- a/eric6/MicroPython/MicroPythonReplWidget.py	Sat Aug 03 12:14:37 2019 +0200
+++ b/eric6/MicroPython/MicroPythonReplWidget.py	Sat Aug 03 13:37:17 2019 +0200
@@ -246,6 +246,8 @@
         """
         Private method to populate the device type selector.
         """
+        currentDevice = self.deviceTypeComboBox.currentText()
+        
         self.deviceTypeComboBox.clear()
         self.deviceInfoLabel.clear()
         
@@ -269,7 +271,17 @@
             self.deviceInfoLabel.setText(
                 self.tr("No supported devices detected."))
         
-        self.on_deviceTypeComboBox_activated(0)
+        index = self.deviceTypeComboBox.findText(currentDevice,
+                                                 Qt.MatchExactly)
+        if index == -1:
+            # entry is no longer present
+            index = 0
+            if self.__connected:
+                # we are still connected, so disconnect
+                self.on_connectButton_clicked()
+        
+        self.on_deviceTypeComboBox_activated(index)
+        self.deviceTypeComboBox.setCurrentIndex(index)
     
     def __handlePreferencesChanged(self):
         """
@@ -466,13 +478,12 @@
         if self.__connected:
             self.__disconnectFromDevice()
             
-            self.replButton.setChecked(False)
+            if self.replButton.isChecked():
+                self.on_replButton_clicked(False)
             if self.filesButton.isChecked():
                 self.on_filesButton_clicked(False)
-                self.filesButton.setChecked(False)
             if self.chartButton.isChecked():
                 self.on_chartButton_clicked(False)
-                self.chartButton.setChecked(False)
         else:
             self.__connectToDevice()
     

eric ide

mercurial