|
28 | 28 | from tagstudio.core.library.alchemy.enums import TagColorEnum |
29 | 29 | from tagstudio.core.library.alchemy.library import Library |
30 | 30 | from tagstudio.core.library.alchemy.models import Tag, TagColorGroup |
| 31 | +from tagstudio.core.utils.types import unwrap |
31 | 32 | from tagstudio.qt.mixed.tag_color_preview import TagColorPreview |
32 | 33 | from tagstudio.qt.mixed.tag_color_selection import TagColorSelection |
33 | 34 | from tagstudio.qt.mixed.tag_search import TagSearchModal, TagSearchPanel |
@@ -181,6 +182,7 @@ def __init__(self, library: Library, tag: Tag | None = None) -> None: |
181 | 182 | self.color_layout.addWidget(self.color_title) |
182 | 183 | self.color_button: TagColorPreview |
183 | 184 | try: |
| 185 | + assert tag is not None |
184 | 186 | self.color_button = TagColorPreview(self.lib, tag.color) |
185 | 187 | except Exception as e: |
186 | 188 | # TODO: Investigate why this happens during tests |
@@ -316,7 +318,7 @@ def add_alias_callback(self): |
316 | 318 | item = self.aliases_table.cellWidget(row, 1) |
317 | 319 | item.setFocus() |
318 | 320 |
|
319 | | - def remove_alias_callback(self, alias_name: str, alias_id: int | None = None): |
| 321 | + def remove_alias_callback(self, alias_name: str, alias_id: int): |
320 | 322 | logger.info("remove_alias_callback") |
321 | 323 |
|
322 | 324 | self.alias_ids.remove(alias_id) |
@@ -468,7 +470,7 @@ def add_aliases(self): |
468 | 470 |
|
469 | 471 | def _update_new_alias_name_dict(self): |
470 | 472 | for i in range(0, self.aliases_table.rowCount()): |
471 | | - widget = self.aliases_table.cellWidget(i, 1) |
| 473 | + widget = cast(CustomTableItem, self.aliases_table.cellWidget(i, 1)) |
472 | 474 | self.new_alias_names[widget.id] = widget.text() |
473 | 475 |
|
474 | 476 | def _set_aliases(self): |
@@ -574,8 +576,8 @@ def parent_post_init(self): |
574 | 576 | self.setTabOrder(self.shorthand_field, self.aliases_add_button) |
575 | 577 | self.setTabOrder(self.aliases_add_button, self.parent_tags_add_button) |
576 | 578 | self.setTabOrder(self.parent_tags_add_button, self.color_button) |
577 | | - self.setTabOrder(self.color_button, self.panel_cancel_button) |
578 | | - self.setTabOrder(self.panel_cancel_button, self.panel_save_button) |
579 | | - self.setTabOrder(self.panel_save_button, self.aliases_table.cellWidget(0, 1)) |
| 579 | + self.setTabOrder(self.color_button, unwrap(self.panel_cancel_button)) |
| 580 | + self.setTabOrder(unwrap(self.panel_cancel_button), unwrap(self.panel_save_button)) |
| 581 | + self.setTabOrder(unwrap(self.panel_save_button), self.aliases_table.cellWidget(0, 1)) |
580 | 582 | self.name_field.selectAll() |
581 | 583 | self.name_field.setFocus() |
0 commit comments