|
25 | 25 | QWidget,
|
26 | 26 | )
|
27 | 27 | from src.core.library import Library, Tag
|
| 28 | +from src.core.library.alchemy.enums import TagColorEnum |
28 | 29 | from src.core.library.alchemy.models import TagColorGroup
|
29 |
| -from src.core.palette import ColorType, UiColor, get_ui_color |
| 30 | +from src.core.palette import ColorType, UiColor, get_tag_color, get_ui_color |
30 | 31 | from src.qt.modals.tag_color_selection import TagColorSelection
|
31 | 32 | from src.qt.modals.tag_search import TagSearchPanel
|
32 | 33 | from src.qt.translations import Translations
|
@@ -73,7 +74,7 @@ def __init__(self, library: Library, tag: Tag | None = None):
|
73 | 74 | self.tag_color_slug: str | None
|
74 | 75 | self.disambiguation_id: int | None
|
75 | 76 |
|
76 |
| - self.setMinimumSize(300, 400) |
| 77 | + self.setMinimumSize(300, 460) |
77 | 78 | self.root_layout = QVBoxLayout(self)
|
78 | 79 | self.root_layout.setContentsMargins(6, 0, 6, 0)
|
79 | 80 | self.root_layout.setAlignment(Qt.AlignmentFlag.AlignTop)
|
@@ -134,6 +135,7 @@ def __init__(self, library: Library, tag: Tag | None = None):
|
134 | 135 |
|
135 | 136 | # Parent Tags ----------------------------------------------------------
|
136 | 137 | self.parent_tags_widget = QWidget()
|
| 138 | + self.parent_tags_widget.setMinimumHeight(128) |
137 | 139 | self.parent_tags_layout = QVBoxLayout(self.parent_tags_widget)
|
138 | 140 | self.parent_tags_layout.setStretch(1, 1)
|
139 | 141 | self.parent_tags_layout.setContentsMargins(0, 0, 0, 0)
|
@@ -210,26 +212,39 @@ def __init__(self, library: Library, tag: Tag | None = None):
|
210 | 212 | self.cat_layout = QHBoxLayout(self.cat_widget)
|
211 | 213 | self.cat_layout.setStretch(1, 1)
|
212 | 214 | self.cat_layout.setContentsMargins(0, 0, 0, 0)
|
213 |
| - self.cat_layout.setSpacing(0) |
| 215 | + self.cat_layout.setSpacing(6) |
214 | 216 | self.cat_layout.setAlignment(Qt.AlignmentFlag.AlignLeft)
|
215 | 217 | self.cat_title = QLabel()
|
216 | 218 | self.cat_title.setText("Is Category")
|
217 | 219 | self.cat_checkbox = QCheckBox()
|
218 |
| - # TODO: Style checkbox |
| 220 | + self.cat_checkbox.setFixedSize(22, 22) |
| 221 | + |
| 222 | + primary_color = QColor(get_tag_color(ColorType.PRIMARY, TagColorEnum.DEFAULT)) |
| 223 | + border_color = get_border_color(primary_color) |
| 224 | + highlight_color = get_highlight_color(primary_color) |
| 225 | + text_color: QColor = get_text_color(primary_color, highlight_color) |
| 226 | + |
219 | 227 | self.cat_checkbox.setStyleSheet(
|
220 |
| - "QCheckBox::indicator{" |
221 |
| - "width: 19px; height: 19px;" |
222 |
| - # f"background: #1e1e1e;" |
223 |
| - # f"border-color: #333333;" |
224 |
| - # f"border-radius: 6px;" |
225 |
| - # f"border-style:solid;" |
226 |
| - # f"border-width:{math.ceil(self.devicePixelRatio())}px;" |
227 |
| - "}" |
228 |
| - # f"QCheckBox::indicator::hover" |
229 |
| - # f"{{" |
230 |
| - # f"border-color: #CCCCCC;" |
231 |
| - # f"background: #555555;" |
232 |
| - # f"}}" |
| 228 | + f"QCheckBox{{" |
| 229 | + f"background: rgba{primary_color.toTuple()};" |
| 230 | + f"color: rgba{text_color.toTuple()};" |
| 231 | + f"border-color: rgba{border_color.toTuple()};" |
| 232 | + f"border-radius: 6px;" |
| 233 | + f"border-style:solid;" |
| 234 | + f"border-width: 2px;" |
| 235 | + f"}}" |
| 236 | + f"QCheckBox::indicator{{" |
| 237 | + f"width: 10px;" |
| 238 | + f"height: 10px;" |
| 239 | + f"border-radius: 2px;" |
| 240 | + f"margin: 4px;" |
| 241 | + f"}}" |
| 242 | + f"QCheckBox::indicator:checked{{" |
| 243 | + f"background: rgba{text_color.toTuple()};" |
| 244 | + f"}}" |
| 245 | + f"QCheckBox::hover{{" |
| 246 | + f"border-color: rgba{highlight_color.toTuple()};" |
| 247 | + f"}}" |
233 | 248 | )
|
234 | 249 | self.cat_layout.addWidget(self.cat_checkbox)
|
235 | 250 | self.cat_layout.addWidget(self.cat_title)
|
|
0 commit comments