Skip to content

Commit

Permalink
Revert incorrect changes made in last refactor
Browse files Browse the repository at this point in the history
- TagEditorDelegate is subclassed in https://github.com/metabrainz/picard/blob/f96d4cc2f03441876c11c6e6460b5d32f5405322/picard/ui/metadatabox.py#L193
- restore get_tag_name() method (revert 4d8bcc3)
- and use passed parent (reverting 6d820db)
  • Loading branch information
zas committed Mar 8, 2025
1 parent be1f9a8 commit 61d9322
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions picard/ui/edittagdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,23 @@ def createEditor(self, parent, option, index):
if not index.isValid():
return None

tag = self.parent().tag
editor = self._create_editor_based_on_tag_type(tag, option, index)
tag = self.get_tag_name(index)
editor = self._create_editor_based_on_tag_type(parent, tag, option, index)
self._configure_editor_for_tag(editor, tag)
return editor

def _create_editor_based_on_tag_type(self, tag, option, index):
def _create_editor_based_on_tag_type(self, parent, tag, option, index):
"""Create appropriate editor widget based on tag type.
Args:
parent: Parent widget
tag: Tag name
option: Style options
index: Model index
Returns:
QWidget subclass appropriate for editing the tag
"""
parent = self.parent()
if tag.partition(':')[0] in MULTILINE_TAGS:
editor = QtWidgets.QPlainTextEdit(parent)
editor.setFrameStyle(editor.style().styleHint(
Expand Down Expand Up @@ -166,6 +166,9 @@ def _create_completer_for_tag(self, editor, tag):
return COMPLETER_CONFIG[tag].create_completer(editor)
return None

def get_tag_name(self, index):
return self.parent().tag


class EditTagDialog(PicardDialog):

Expand Down Expand Up @@ -463,7 +466,9 @@ def value_edited(self, item):
Args:
item: The QListWidgetItem that was edited
"""
print(item)
row = self.value_list.row(item)
print(row)
value = item.text()
if row == 0 and self.is_grouped:
self.modified_tags[self.tag] = [value]
Expand Down

0 comments on commit 61d9322

Please sign in to comment.