Closed Cathyhjj closed 2 weeks ago
Thanks for the report @Cathyhjj.
The selector uses the comboBox's currentText()
which returns the line-edit's text. If nothing is entered, this should be an empty string. I would expect the registry to then throw and error because such a device doesn't exist.
I'll look into this further soon.
I'm not able to reproduce this bug. In my test, if the combobox is empty, then combo_box.currentText()
return an empty string. This causes a keyerror when trying to find the "" device in the registry, but does not return an incorrect device. @Cathyhjj, do you have a reliable way to reproduce this bug?
I can't seem to reproduce this bug. If I leave the combo box blank, then the result of QComboBox.currentText()
is an empty string. That empty string triggers a KeyError when trying to look it up in the registry, but does not return an item. I put in a PR to check for this condition and return None
as the selected component.
@Cathyhjj, can you provide any more information about how to reproduce this error?
I'm wondering if that robot device you're seeing has an empty string in its _ophyd_labels_
set? If so, it should be fixed in the PR I submitted that checks for an empty string before querying the registry.
I noticed that if you put a try statement in front, this will return the "A" motor for me
try:
motor = self.motor_box.current_component()
print(motor)
when doing
motor = self.motor_box.current_component()
, even though the combo box is empty, it tried to get the first motorwhen doing
`