Skip to content

Commit c13583c

Browse files
committed
refactor: typing and docstring tweaks
1 parent fa40912 commit c13583c

6 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/tagstudio/qt/controllers/field_container_controller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ def _remove_callback(self) -> None:
3737
self.__remove_callback()
3838

3939
def set_copy_callback(self, callback: Callback = None) -> None:
40-
"""Sets the callback to be called when the 'Copy' button is pressed."""
40+
"""Sets the callback to be called when the copy button is pressed."""
4141
self.__copy_callback = callback
4242
self._copy_enabled = callback is not None
4343

4444
def set_edit_callback(self, callback: Callback = None) -> None:
45-
"""Sets the callback to be called when the 'Edit' button is pressed."""
45+
"""Sets the callback to be called when the edit button is pressed."""
4646
self.__edit_callback = callback
4747
self._edit_enabled = callback is not None
4848

4949
def set_remove_callback(self, callback: Callback = None) -> None:
50-
"""Sets the callback to be called when the 'Edit' button is pressed."""
50+
"""Sets the callback to be called when the remove button is pressed."""
5151
self.__remove_callback = callback
5252
self._remove_enabled = callback is not None

src/tagstudio/qt/controllers/field_list_controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def remove_field_prompt(name: str) -> str:
4242
return Translations.format("library.field.confirm_remove", name=name)
4343

4444

45-
def remove_message_box(prompt: str, callback: Callable) -> None:
45+
def remove_message_box(prompt: str, callback: Callable[[], None | tuple[None, None]]) -> None:
4646
remove_mb: QMessageBox = QMessageBox()
4747
remove_mb.setText(prompt)
4848
remove_mb.setWindowTitle("Remove Field")

src/tagstudio/qt/controllers/tag_box_controller.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ class TagBoxWidget(TagBoxWidgetView):
2626

2727
on_update: Signal = Signal()
2828

29-
__entries: list[int] = []
30-
3129
def __init__(self, title: str, driver: "QtDriver") -> None:
3230
super().__init__(title, driver)
3331
self.__driver: QtDriver = driver
32+
self.__entries: list[int] = []
3433

3534
def set_entries(self, entries: list[int]) -> None:
3635
"""Sets the list of entries that are currently selected."""
37-
self.__entries: list[int] = entries
36+
self.__entries = entries
3837

3938
@override
4039
def _on_click(self, tag: Tag) -> None: # type: ignore[misc]

src/tagstudio/qt/views/field_list_view.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88

99
class FieldListView(QWidget):
10+
"""A list of field containers."""
11+
1012
def __init__(self) -> None:
1113
super().__init__()
1214

src/tagstudio/qt/views/panel_modal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(
2727
title: str = "",
2828
window_title: str | None = None,
2929
done_callback: Callable[[], None] | None = None,
30-
save_callback: Callable[[str], None] | None = None,
30+
save_callback: Callable[[str], None | tuple[None, None]] | None = None,
3131
has_save: bool = False,
3232
):
3333
# [Done]

src/tagstudio/qt/views/text_field_widget_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class TextFieldWidget(FieldWidgetView):
1515
"""A widget representing a text field of an entry."""
1616

17-
def __init__(self, title, text: str) -> None:
17+
def __init__(self, title: str, text: str) -> None:
1818
super().__init__(title)
1919

2020
# Text field

0 commit comments

Comments
 (0)