Simplify the adding of genuine options

Extending a list with an empty list is petty much a no-op so don't bother to
faff around testing for what Python will be testing for anyway.
This commit is contained in:
Dave Pearson
2023-05-07 18:11:14 +01:00
parent e526a32220
commit b3b98f1089

View File

@@ -528,9 +528,7 @@ class OptionList(ScrollView, can_focus=True):
self._contents.extend(content)
# Pull out the content that is genuine options and add them to the
# list of options.
options = [item for item in content if isinstance(item, Option)]
if options:
self._options.extend(options)
self._options.extend([item for item in content if isinstance(item, Option)])
self._refresh_content_tracking(force=True)
self.refresh()
return self