Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tagstudio/src/qt/modals/tag_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, library: Library, exclude: list[int] = None, is_tag_chooser:
self.search_field.setObjectName("searchField")
self.search_field.setMinimumSize(QSize(0, 32))
Translations.translate_with_setter(self.search_field.setPlaceholderText, "home.search_tags")
self.search_field.textEdited.connect(lambda: self.update_tags(self.search_field.text()))
self.search_field.textEdited.connect(lambda text: self.update_tags(text))
self.search_field.returnPressed.connect(lambda: self.on_return(self.search_field.text()))

self.scroll_contents = QWidget()
Expand Down Expand Up @@ -119,7 +119,7 @@ def __build_row_item_widget(self, tag: Tag):
row.addWidget(add_button)
return container

def construct_tag_button(self, query: str | None):
def build_create_tag_button(self, query: str | None):
"""Constructs a Create Tag Button."""
container = QWidget()
row = QHBoxLayout(container)
Expand Down Expand Up @@ -208,7 +208,7 @@ def update_tags(self, query: str | None = None):
else:
# If query doesnt exist add create button
self.first_tag_id = None
c = self.construct_tag_button(query)
c = self.build_create_tag_button(query)
self.scroll_layout.addWidget(c)
self.search_field.setFocus()

Expand Down
18 changes: 7 additions & 11 deletions tagstudio/src/qt/widgets/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@


import math
from pathlib import Path
from types import FunctionType

from PIL import Image
from PySide6.QtCore import QEvent, Qt, Signal
from PySide6.QtGui import QAction, QEnterEvent, QFontMetrics
from PySide6.QtWidgets import (
Expand Down Expand Up @@ -93,10 +91,6 @@ def leaveEvent(self, event: QEvent) -> None: # noqa: N802


class TagWidget(QWidget):
edit_icon_128: Image.Image = Image.open(
str(Path(__file__).parents[3] / "resources/qt/images/edit_icon_128.png")
).resize((math.floor(14 * 1.25), math.floor(14 * 1.25)))
edit_icon_128.load()
on_remove = Signal()
on_click = Signal()
on_edit = Signal()
Expand Down Expand Up @@ -126,20 +120,22 @@ def __init__(
self.bg_button.setText(tag.name)
if has_edit:
edit_action = QAction(self)
Translations.translate_qobject(edit_action, "generic.edit")
edit_action.setText(Translations.translate_formatted("generic.edit"))
edit_action.triggered.connect(on_edit_callback)
edit_action.triggered.connect(self.on_edit.emit)
self.bg_button.addAction(edit_action)
# if on_click_callback:
self.bg_button.setContextMenuPolicy(Qt.ContextMenuPolicy.ActionsContextMenu)

# TODO: This currently doesn't work in "Add Tag" menus. Either fix this or
# disable it in that context.
search_for_tag_action = QAction(self)
Translations.translate_qobject(search_for_tag_action, "tag.search_for_tag")
search_for_tag_action.setText(Translations.translate_formatted("tag.search_for_tag"))
search_for_tag_action.triggered.connect(self.on_click.emit)
self.bg_button.addAction(search_for_tag_action)
add_to_search_action = QAction(self)
Translations.translate_qobject(add_to_search_action, "tag.add_to_search")
self.bg_button.addAction(add_to_search_action)
# add_to_search_action = QAction(self)
# add_to_search_action.setText(Translations.translate_formatted("tag.add_to_search"))
# self.bg_button.addAction(add_to_search_action)

self.inner_layout = QHBoxLayout()
self.inner_layout.setObjectName("innerLayout")
Expand Down
Loading