|
11 | 11 | from PIL import Image, ImageQt |
12 | 12 | from PySide6 import QtCore |
13 | 13 | from PySide6.QtCore import QMetaObject, QSize, QStringListModel, Qt |
14 | | -from PySide6.QtGui import QAction, QPixmap |
| 14 | +from PySide6.QtGui import QAction, QColor, QPixmap |
15 | 15 | from PySide6.QtWidgets import ( |
| 16 | + QCheckBox, |
16 | 17 | QComboBox, |
17 | 18 | QCompleter, |
18 | 19 | QFrame, |
19 | 20 | QGridLayout, |
20 | 21 | QHBoxLayout, |
| 22 | + QLabel, |
21 | 23 | QLayout, |
22 | 24 | QLineEdit, |
23 | 25 | QMainWindow, |
|
34 | 36 | ) |
35 | 37 |
|
36 | 38 | from tagstudio.core.enums import ShowFilepathOption |
37 | | -from tagstudio.core.library.alchemy.enums import SortingModeEnum |
| 39 | +from tagstudio.core.library.alchemy.enums import SortingModeEnum, TagColorEnum |
38 | 40 | from tagstudio.qt.controllers.preview_panel_controller import PreviewPanel |
39 | 41 | from tagstudio.qt.helpers.color_overlay import theme_fg_overlay |
40 | 42 | from tagstudio.qt.mixed.landing import LandingWidget |
41 | 43 | from tagstudio.qt.mixed.pagination import Pagination |
| 44 | +from tagstudio.qt.mixed.tag_widget import get_border_color, get_highlight_color, get_text_color |
42 | 45 | from tagstudio.qt.mnemonics import assign_mnemonics |
| 46 | +from tagstudio.qt.models.palette import ColorType, get_tag_color |
43 | 47 | from tagstudio.qt.platform_strings import trash_term |
44 | 48 | from tagstudio.qt.resource_manager import ResourceManager |
45 | 49 | from tagstudio.qt.thumb_grid_layout import ThumbGridLayout |
@@ -578,7 +582,57 @@ def setup_extra_input_bar(self): |
578 | 582 | self.extra_input_layout = QHBoxLayout() |
579 | 583 | self.extra_input_layout.setObjectName("extra_input_layout") |
580 | 584 |
|
581 | | - ## left side spacer |
| 585 | + primary_color = QColor(get_tag_color(ColorType.PRIMARY, TagColorEnum.DEFAULT)) |
| 586 | + border_color = get_border_color(primary_color) |
| 587 | + highlight_color = get_highlight_color(primary_color) |
| 588 | + text_color: QColor = get_text_color(primary_color, highlight_color) |
| 589 | + |
| 590 | + ## Show hidden entries checkbox |
| 591 | + self.show_hidden_entries_widget = QWidget() |
| 592 | + self.show_hidden_entries_layout = QHBoxLayout(self.show_hidden_entries_widget) |
| 593 | + self.show_hidden_entries_layout.setStretch(1, 1) |
| 594 | + self.show_hidden_entries_layout.setContentsMargins(0, 0, 0, 0) |
| 595 | + self.show_hidden_entries_layout.setSpacing(6) |
| 596 | + self.show_hidden_entries_layout.setAlignment(Qt.AlignmentFlag.AlignLeft) |
| 597 | + self.show_hidden_entries_title = QLabel(Translations["home.show_hidden_entries"]) |
| 598 | + self.show_hidden_entries_checkbox = QCheckBox() |
| 599 | + self.show_hidden_entries_checkbox.setFixedSize(22, 22) |
| 600 | + |
| 601 | + self.show_hidden_entries_checkbox.setStyleSheet( |
| 602 | + f"QCheckBox{{" |
| 603 | + f"background: rgba{primary_color.toTuple()};" |
| 604 | + f"color: rgba{text_color.toTuple()};" |
| 605 | + f"border-color: rgba{border_color.toTuple()};" |
| 606 | + f"border-radius: 6px;" |
| 607 | + f"border-style:solid;" |
| 608 | + f"border-width: 2px;" |
| 609 | + f"}}" |
| 610 | + f"QCheckBox::indicator{{" |
| 611 | + f"width: 10px;" |
| 612 | + f"height: 10px;" |
| 613 | + f"border-radius: 2px;" |
| 614 | + f"margin: 4px;" |
| 615 | + f"}}" |
| 616 | + f"QCheckBox::indicator:checked{{" |
| 617 | + f"background: rgba{text_color.toTuple()};" |
| 618 | + f"}}" |
| 619 | + f"QCheckBox::hover{{" |
| 620 | + f"border-color: rgba{highlight_color.toTuple()};" |
| 621 | + f"}}" |
| 622 | + f"QCheckBox::focus{{" |
| 623 | + f"border-color: rgba{highlight_color.toTuple()};" |
| 624 | + f"outline:none;" |
| 625 | + f"}}" |
| 626 | + ) |
| 627 | + |
| 628 | + self.show_hidden_entries_checkbox.setChecked(False) # Default: No |
| 629 | + |
| 630 | + self.show_hidden_entries_layout.addWidget(self.show_hidden_entries_checkbox) |
| 631 | + self.show_hidden_entries_layout.addWidget(self.show_hidden_entries_title) |
| 632 | + |
| 633 | + self.extra_input_layout.addWidget(self.show_hidden_entries_widget) |
| 634 | + |
| 635 | + ## Spacer |
582 | 636 | self.extra_input_layout.addItem( |
583 | 637 | QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum) |
584 | 638 | ) |
@@ -712,3 +766,8 @@ def sorting_direction(self) -> bool: |
712 | 766 | @property |
713 | 767 | def thumb_size(self) -> int: |
714 | 768 | return self.thumb_size_combobox.currentData() |
| 769 | + |
| 770 | + @property |
| 771 | + def show_hidden_entries(self) -> bool: |
| 772 | + """Whether to show entries tagged with hidden tags.""" |
| 773 | + return self.show_hidden_entries_checkbox.isChecked() |
0 commit comments