Skip to content

Commit d2f6227

Browse files
committed
_selected_tags(): make it a generator
1 parent c8a295c commit d2f6227

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

picard/ui/metadatabox.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def _get_editor_value(editor):
362362
def contextMenuEvent(self, event):
363363
menu = QtWidgets.QMenu(self)
364364
if self.objects:
365-
tags = self._selected_tags()
365+
tags = list(self._selected_tags())
366366
single_tag = len(tags) == 1
367367
if single_tag:
368368
selected_tag = tags[0]
@@ -461,7 +461,7 @@ def _edit_tag(self, tag):
461461
EditTagDialog(self.parent, tag).exec()
462462

463463
def _edit_selected_tag(self):
464-
tags = self._selected_tags(filter_func=self._tag_is_editable)
464+
tags = list(self._selected_tags(filter_func=self._tag_is_editable))
465465
if len(tags) == 1:
466466
self._edit_tag(tags[0])
467467

@@ -500,11 +500,10 @@ def _tag_is_editable(self, tag):
500500
return self.tag_diff.status[tag] & TagStatus.READONLY == 0
501501

502502
def _selected_tags(self, filter_func=None):
503-
tags = set(self.tag_diff.tag_names[item.row()]
504-
for item in self.selectedItems())
505-
if filter_func:
506-
tags = filter(filter_func, tags)
507-
return list(tags)
503+
for tag in set(self.tag_diff.tag_names[item.row()]
504+
for item in self.selectedItems()):
505+
if filter_func is None or filter_func(tag):
506+
yield tag
508507

509508
def _update_selection(self):
510509
files = set()

0 commit comments

Comments
 (0)