ui: fix - typed text was not recognised as valid

This commit is contained in:
Vinícius 2022-01-20 20:29:33 -03:00 committed by Peter F. Patel-Schneider
parent 7dd9609942
commit 573cb6e985
1 changed files with 2 additions and 2 deletions

View File

@ -827,13 +827,13 @@ class SmartComboBox(Gtk.ComboBox):
t = self.get_model()[tree_iter]
number = t[0]
return self._all_values[int(number)][0] if number != '' and (accept_hidden or t[2]) else None
elif self.get_has_entry() and invalid_as_str:
elif self.get_has_entry():
text = self.get_child().get_text().strip()
if text == self._blank:
return None
idx = self._find_idx(text)
if idx is None:
return text
return text if invalid_as_str else None
item = self._all_values[idx]
return item[0] if len(item) > 1 else str(item[0])
return None