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
5 changes: 3 additions & 2 deletions src/tagstudio/qt/controllers/changelog_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
QTextFormat,
)
from PySide6.QtNetwork import QNetworkAccessManager, QNetworkReply, QNetworkRequest
from PySide6.QtWidgets import QDialogButtonBox

from tagstudio.core.constants import DOCS_URL, GITHUB_REPO_URL
from tagstudio.core.utils.types import unwrap
Expand Down Expand Up @@ -313,8 +314,8 @@ def parent_post_init(self) -> None:
assert isinstance(modal_view, ModalView)
close_button = unwrap(self.done_button)
close_button.setText(Translations["generic.close"])
modal_view.button_layout.insertWidget(
modal_view.button_layout.indexOf(close_button), self.layout().view_more_button
modal_view.button_box.addButton(
self.layout().view_more_button, QDialogButtonBox.ButtonRole.ActionRole
)

# NOTE: A lot of the styling is similar to the "About" window, which eventually needs to be
Expand Down
6 changes: 3 additions & 3 deletions src/tagstudio/qt/controllers/edit_field_template_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# TODO: Use newer MVC style guidelines
class EditFieldTemplateModal(EditFieldTemplateModalView):
field_type_map: dict[str, str] = {
"TextFieldTemplate": Translations["field_type.text"],
"DatetimeFieldTemplate": Translations["field_type.datetime"],
"TextFieldTemplate": "field_type.text",
"DatetimeFieldTemplate": "field_type.datetime",
}
DEFAULT_TYPE_INDEX = 0

Expand All @@ -32,7 +32,7 @@ def __init__(self, field_template: BaseFieldTemplate | None = None) -> None:
self.old_field_type: str = ""

for k, v in EditFieldTemplateModal.field_type_map.items():
self._type_combobox.addItem(v, k)
self._type_combobox.addItem(Translations[v], k)

self.__connect_callbacks()
self.set_field_template(field_template)
Expand Down
9 changes: 8 additions & 1 deletion src/tagstudio/qt/controllers/field_template_search_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,18 @@ def _on_item_remove(self, item: BaseFieldTemplate) -> None:
return

message_box = QMessageBox(
QMessageBox.Icon.Question,
QMessageBox.Icon.Warning,
Translations["field_template.delete"],
Translations.format("field_template.confirm_delete", field_template_name=item.name),
QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel,
)
unwrap(message_box.button(QMessageBox.StandardButton.Ok)).setText(
Translations["generic.delete_alt"]
)
unwrap(message_box.button(QMessageBox.StandardButton.Cancel)).setText(
Translations["generic.cancel_alt"]
)
message_box.setDefaultButton(QMessageBox.StandardButton.Cancel)

result = message_box.exec()

Expand Down
12 changes: 6 additions & 6 deletions src/tagstudio/qt/controllers/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,11 @@ def rebuild_open_recent_library_menu(
# View Component
class MainWindow(QMainWindow):
THUMB_SIZES: list[tuple[str, int]] = [
(Translations["home.thumbnail_size.extra_large"], 256),
(Translations["home.thumbnail_size.large"], 192),
(Translations["home.thumbnail_size.medium"], 128),
(Translations["home.thumbnail_size.small"], 96),
(Translations["home.thumbnail_size.mini"], 76),
("home.thumbnail_size.extra_large", 256),
("home.thumbnail_size.large", 192),
("home.thumbnail_size.medium", 128),
("home.thumbnail_size.small", 96),
("home.thumbnail_size.mini", 76),
]

def __init__(self, driver: QtDriver, parent: QWidget | None = None) -> None:
Expand Down Expand Up @@ -656,7 +656,7 @@ def setup_extra_input_bar(self):
self.thumb_size_combobox.setMaximumWidth(352)
self.extra_input_layout.addWidget(self.thumb_size_combobox)
for size in MainWindow.THUMB_SIZES:
self.thumb_size_combobox.addItem(size[0], size[1])
self.thumb_size_combobox.addItem(Translations[size[0]], size[1])
self.thumb_size_combobox.setCurrentIndex(2) # Default: Medium

def setup_content(self, driver: QtDriver):
Expand Down
21 changes: 11 additions & 10 deletions src/tagstudio/qt/controllers/splash.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@
class SplashScreen:
"""The custom splash screen widget for TagStudio."""

VERSION_STR: str = " ".join(
[
f"{Translations['about.version']}",
f"{VERSION} {(' (' + Translations[BUILD_TYPE] + ')') if BUILD_TYPE else ''}",
]
)
DEFAULT_SPLASH = Splash.AURORA

def __init__(
Expand Down Expand Up @@ -68,6 +62,13 @@ def get_pixmap(self) -> QPixmap:
case _:
pass

version_str = " ".join(
[
f"{Translations['about.version']}",
f"{VERSION} {(' (' + Translations[BUILD_TYPE] + ')') if BUILD_TYPE else ''}",
]
)

# TODO: Store any differing data elsewhere and load dynamically instead of hardcoding.
match self.splash_name:
case Splash.CLASSIC:
Expand All @@ -88,7 +89,7 @@ def get_pixmap(self) -> QPixmap:
painter.drawText(
QRect(0, -50, 960, 540),
int(Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignHCenter),
SplashScreen.VERSION_STR,
version_str,
)

case Splash.GOO_GEARS:
Expand All @@ -110,7 +111,7 @@ def get_pixmap(self) -> QPixmap:
painter.setPen(pen)
painter.drawText(
QRect(40, 420, 960, 540),
SplashScreen.VERSION_STR,
version_str,
)

case Splash.NINETY_FIVE:
Expand All @@ -136,7 +137,7 @@ def get_pixmap(self) -> QPixmap:
painter.drawText(
QRect(-30, 25, 960, 540),
int(Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignRight),
SplashScreen.VERSION_STR,
version_str,
)

case Splash.AURORA:
Expand All @@ -157,7 +158,7 @@ def get_pixmap(self) -> QPixmap:
painter.drawText(
QRect(0, -50, 960, 540),
int(Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignHCenter),
SplashScreen.VERSION_STR,
version_str,
)

case _:
Expand Down
9 changes: 8 additions & 1 deletion src/tagstudio/qt/controllers/tag_search_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,18 @@ def _on_item_remove(self, item: Tag) -> None:
return

message_box = QMessageBox(
QMessageBox.Icon.Question,
QMessageBox.Icon.Warning,
Translations["tag.remove"],
Translations.format("tag.confirm_delete", tag_name=self._lib.tag_display_name(item)),
QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel,
)
unwrap(message_box.button(QMessageBox.StandardButton.Ok)).setText(
Translations["generic.delete_alt"]
)
unwrap(message_box.button(QMessageBox.StandardButton.Cancel)).setText(
Translations["generic.cancel_alt"]
)
message_box.setDefaultButton(QMessageBox.StandardButton.Cancel)

result = message_box.exec()

Expand Down
14 changes: 7 additions & 7 deletions src/tagstudio/qt/controllers/tiles/color_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def set_colors(self, colors: Iterable[TagColorGroup]):
TagColorGroup(
slug="slug",
namespace=self.namespace,
name="Color",
name=Translations["color.placeholder"],
primary="#FFFFFF",
secondary=None,
)
Expand All @@ -108,7 +108,7 @@ def edit_color(self, color_group: TagColorGroup):

self.edit_modal = Modal(
build_color_panel,
"Edit Color",
Translations["color.edit"],
is_savable=True,
)

Expand All @@ -126,13 +126,13 @@ def delete_color(self, color_group: TagColorGroup):
cancel_button = message_box.addButton(
Translations["generic.cancel_alt"], QMessageBox.ButtonRole.RejectRole
)
message_box.addButton(
Translations["generic.delete_alt"], QMessageBox.ButtonRole.DestructiveRole
delete_button = message_box.addButton(
Translations["generic.delete_alt"], QMessageBox.ButtonRole.AcceptRole
)
message_box.setEscapeButton(cancel_button)
result = message_box.exec_()
logger.info(QMessageBox.ButtonRole.DestructiveRole.value)
if result != QMessageBox.ButtonRole.ActionRole.value:
message_box.setDefaultButton(cancel_button)
message_box.exec()
if message_box.clickedButton() != delete_button:
return

logger.info("[ColorData] Removing color", color=color_group)
Expand Down
21 changes: 12 additions & 9 deletions src/tagstudio/qt/controllers/tiles/tile_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,17 +418,20 @@ def update_datetime_field(self, field: DatetimeField, name: str, value: str) ->
self.lib.update_datetime_field(entry_ids, field, name, dt.fromisoformat(value))

def remove_message_box(self, prompt: str, callback: Callable[..., None]) -> None:
remove_mb = QMessageBox()
remove_mb.setText(prompt)
remove_mb.setWindowTitle(Translations["Remove Field"])
remove_mb.setIcon(QMessageBox.Icon.Warning)
cancel_button = remove_mb.addButton(
message_box = QMessageBox()
message_box.setText(prompt)
message_box.setWindowTitle(Translations["field.remove"])
message_box.setIcon(QMessageBox.Icon.Warning)
cancel_button = message_box.addButton(
Translations["generic.cancel_alt"], QMessageBox.ButtonRole.RejectRole
)
remove_mb.addButton("&Remove", QMessageBox.ButtonRole.DestructiveRole)
remove_mb.setEscapeButton(cancel_button)
result = remove_mb.exec_()
if result == QMessageBox.ButtonRole.ActionRole.value:
remove_button = message_box.addButton(
Translations["generic.remove_alt"], QMessageBox.ButtonRole.AcceptRole
)
message_box.setEscapeButton(cancel_button)
message_box.setDefaultButton(cancel_button)
message_box.exec()
if message_box.clickedButton() == remove_button:
callback()

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def __init__(self):
partial(QDesktopServices.openUrl, GITHUB_RELEASE_URL)
)
self.button(QMessageBox.StandardButton.Ignore).setText(Translations["generic.dont_remind"])
self.button(QMessageBox.StandardButton.Close).setText(Translations["generic.close"])

red = get_ui_color(ColorType.PRIMARY, UiColor.RED)
green = get_ui_color(ColorType.PRIMARY, UiColor.GREEN)
Expand Down
15 changes: 7 additions & 8 deletions src/tagstudio/qt/mixed/about_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@
class AboutModal(QWidget):
"""Modal window showing information about the TagStudio application."""

VERSION_STR: str = " ".join(
[
f"{Translations['about.version']}",
f"{VERSION} {(' (' + Translations[BUILD_TYPE] + ')') if BUILD_TYPE else ''}",
]
)

def __init__(self, config_path: Path | str):
super().__init__()
self.setWindowTitle(Translations["about.title"])
Expand Down Expand Up @@ -89,7 +82,13 @@ def __init__(self, config_path: Path | str):
self.logo_widget.setAlignment(Qt.AlignmentFlag.AlignCenter)

# Version --------------------------------------------------------------
self.version_label = QLabel(header(AboutModal.VERSION_STR, 2))
version_str = " ".join(
[
f"{Translations['about.version']}",
f"{VERSION} {(' (' + Translations[BUILD_TYPE] + ')') if BUILD_TYPE else ''}",
]
)
self.version_label = QLabel(header(version_str, 2))
self.version_label.setAlignment(Qt.AlignmentFlag.AlignCenter)

# Copyright ------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions src/tagstudio/qt/mixed/drop_import_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def __init__(self, driver: QtDriver):
self.button_layout.setContentsMargins(6, 6, 6, 6)
self.button_layout.addStretch(1)

self.cancel_button = QPushButton(Translations["generic.cancel_alt"])
self.cancel_button.clicked.connect(lambda: self.begin_transfer(DuplicateChoice.CANCEL))
self.button_layout.addWidget(self.cancel_button)

self.skip_button = QPushButton(Translations["generic.skip_alt"])
self.skip_button.setDefault(True)
self.skip_button.clicked.connect(lambda: self.begin_transfer(DuplicateChoice.SKIP))
Expand All @@ -78,10 +82,6 @@ def __init__(self, driver: QtDriver):
self.rename_button.clicked.connect(lambda: self.begin_transfer(DuplicateChoice.RENAME))
self.button_layout.addWidget(self.rename_button)

self.cancel_button = QPushButton(Translations["generic.cancel_alt"])
self.cancel_button.clicked.connect(lambda: self.begin_transfer(DuplicateChoice.CANCEL))
self.button_layout.addWidget(self.cancel_button)

# Layout =====================
self.root_layout.addWidget(self.desc_widget)
self.root_layout.addWidget(self.list_view)
Expand Down
6 changes: 1 addition & 5 deletions src/tagstudio/qt/mixed/folders_to_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,9 @@ def __init__(self, library: Library, driver: QtDriver):
self.title_widget.setWordWrap(True)
self.title_widget.setAlignment(Qt.AlignmentFlag.AlignCenter)

self.desc_widget = QLabel()
self.desc_widget = QLabel(Translations["folders_to_tags.description"])
self.desc_widget.setObjectName("descriptionLabel")
self.desc_widget.setWordWrap(True)
self.desc_widget.setText(
"""Creates tags based on your folder structure and applies them to your entries.
This tree shows all tags to be created and which entries they will be applied to."""
)
self.desc_widget.setAlignment(Qt.AlignmentFlag.AlignCenter)

self.open_close_button_w = QWidget()
Expand Down
1 change: 1 addition & 0 deletions src/tagstudio/qt/mixed/migration_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ def update_sql_value_ui(self, show_msg_box: bool = True):
Translations["json_migration.discrepancies_found.description"],
)
msg_box.setDetailedText("\n".join(self.discrepancies))
msg_box.addButton(Translations["generic.close"], QMessageBox.ButtonRole.AcceptRole)
msg_box.exec()

def finish_migration(self):
Expand Down
Loading
Loading