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
4 changes: 3 additions & 1 deletion tagstudio/src/qt/modals/tag_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TagSearchPanel(PanelWidget):
tag_chosen = Signal(int)
lib: Library
is_initialized: bool = False
first_tag_id: int = None
first_tag_id: int | None = None
is_tag_chooser: bool
exclude: list[int]

Expand Down Expand Up @@ -202,10 +202,12 @@ def update_tags(self, query: str | None = None):
results_2.append(tag)
results_1.sort(key=lambda tag: len(tag.name))
results_2.sort()
self.first_tag_id = results_1[0].id if len(results_1) > 0 else tag_results[0].id
for tag in results_1 + results_2:
self.scroll_layout.addWidget(self.__build_row_item_widget(tag))
else:
# If query doesnt exist add create button
self.first_tag_id = None
c = self.construct_tag_button(query)
self.scroll_layout.addWidget(c)
self.search_field.setFocus()
Expand Down
2 changes: 1 addition & 1 deletion tagstudio/src/qt/widgets/preview_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, library: Library, driver: "QtDriver"):
self.file_attrs = FileAttributes(library, driver)
self.fields = FieldContainers(library, driver)

self.tag_search_panel = TagSearchPanel(self.driver.lib)
self.tag_search_panel = TagSearchPanel(self.driver.lib, is_tag_chooser=True)
self.add_tag_modal = PanelModal(
self.tag_search_panel, Translations.translate_formatted("tag.add.plural")
)
Expand Down
Loading