Skip to content

Commit 1da7b18

Browse files
committed
Fix enable Connect when autoselect serail
1 parent d6e79aa commit 1da7b18

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from helpers.colors import color_names_sweet16 as COLORS
77
################################################################################################################################
88
# Constants General
9-
VERSION = "1.5.0" # this version
9+
VERSION = "1.5.1" # this version
1010
AUTHOR = "Urs Utzinger" # me
1111
DATE = "2026" # year of last update
1212
################################################################################################################################

helpers/Qserial_helper.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,20 +916,27 @@ def on_newPortListReady(self, ports: list, portNames: list, portHWIDs: list) ->
916916
self.serialPortHWIDs = portHWIDs
917917

918918
lenPortNames = len(self.serialPortNames)
919+
selected_index = -1
919920
self.ui.comboBoxDropDown_SerialPorts.blockSignals(True) # block the box from emitting changed index signal when items are added
920921
# populate new items
921922
self.ui.comboBoxDropDown_SerialPorts.clear()
922923
self.ui.comboBoxDropDown_SerialPorts.addItems(self.serialPorts + ["None"])
923924
index = self.ui.comboBoxDropDown_SerialPorts.findText(self.serialPort)
924925
if index > -1: # if we found previously selected item
926+
selected_index = index
925927
self.ui.comboBoxDropDown_SerialPorts.setCurrentIndex(index)
926928
elif self.serialPorts: # default to the first available real port
929+
selected_index = 0
927930
self.ui.comboBoxDropDown_SerialPorts.setCurrentIndex(0)
928931
else: # no serial ports available, keep box on "None"
932+
selected_index = lenPortNames
929933
self.ui.comboBoxDropDown_SerialPorts.setCurrentIndex(lenPortNames)
930934
self.serialPort_previous = ""
931935
# enable signals again
932936
self.ui.comboBoxDropDown_SerialPorts.blockSignals(False)
937+
self.ui.pushButton_SerialOpenClose.setEnabled(
938+
self.serialConnected or 0 <= selected_index < len(self.serialPorts)
939+
)
933940

934941
self.logSignal.emit(logging.DEBUG,
935942
f"[{self.instance_name[:15]:<15}]: Port list received."

0 commit comments

Comments
 (0)