mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
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:
@@ -528,9 +528,7 @@ class OptionList(ScrollView, can_focus=True):
|
|||||||
self._contents.extend(content)
|
self._contents.extend(content)
|
||||||
# Pull out the content that is genuine options and add them to the
|
# Pull out the content that is genuine options and add them to the
|
||||||
# list of options.
|
# list of options.
|
||||||
options = [item for item in content if isinstance(item, Option)]
|
self._options.extend([item for item in content if isinstance(item, Option)])
|
||||||
if options:
|
|
||||||
self._options.extend(options)
|
|
||||||
self._refresh_content_tracking(force=True)
|
self._refresh_content_tracking(force=True)
|
||||||
self.refresh()
|
self.refresh()
|
||||||
return self
|
return self
|
||||||
|
|||||||
Reference in New Issue
Block a user