mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-09-14 22:49:36 +02:00
refactor(ui): use constants for common padding and radius values
This commit is contained in:
@@ -20,7 +20,8 @@ from PySide6.QtWidgets import QVBoxLayout, QWidget
|
||||
|
||||
from tagstudio.qt.views.banner_view import BannerView
|
||||
from tagstudio.qt.views.styles.stylesheets import (
|
||||
BANNER_CORNER_RADIUS,
|
||||
PAD,
|
||||
RADIUS,
|
||||
banner_notice_bg_color,
|
||||
banner_notice_style,
|
||||
banner_progress_bg_color,
|
||||
@@ -52,7 +53,7 @@ class _BannerBackground(QWidget):
|
||||
painter = QPainter(self)
|
||||
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
|
||||
path = QPainterPath()
|
||||
path.addRoundedRect(QRectF(self.rect()), BANNER_CORNER_RADIUS, BANNER_CORNER_RADIUS)
|
||||
path.addRoundedRect(QRectF(self.rect()), RADIUS, RADIUS)
|
||||
painter.fillPath(path, self._bg_color)
|
||||
painter.end()
|
||||
|
||||
@@ -61,8 +62,7 @@ class Banner(QWidget):
|
||||
"""A notification banner with an optional progress bar, action button, and close button."""
|
||||
|
||||
CONTENT_HEIGHT = 36
|
||||
GAP = 6
|
||||
HEIGHT = CONTENT_HEIGHT + GAP
|
||||
HEIGHT = CONTENT_HEIGHT + PAD
|
||||
ANIMATION_MS = 250
|
||||
COLOR_ANIMATION_MS = 250
|
||||
MIN_VISIBLE_MS = 3000
|
||||
@@ -78,7 +78,7 @@ class Banner(QWidget):
|
||||
self.setMaximumHeight(0)
|
||||
|
||||
outer_layout = QVBoxLayout(self)
|
||||
outer_layout.setContentsMargins(0, 0, 0, self.GAP)
|
||||
outer_layout.setContentsMargins(0, 0, 0, PAD)
|
||||
outer_layout.setSpacing(0)
|
||||
|
||||
self._background = _BannerBackground(self)
|
||||
@@ -95,7 +95,7 @@ class Banner(QWidget):
|
||||
self._progress_bg_color = banner_progress_bg_color()
|
||||
self._background.setStyleSheet(self._notice_style)
|
||||
self._background.set_bg_color(self._notice_bg_color)
|
||||
self.view.progress_bar.set_corner_radius(BANNER_CORNER_RADIUS)
|
||||
self.view.progress_bar.set_corner_radius(RADIUS)
|
||||
self.view.progress_bar.set_chunk_color(banner_progress_chunk_color())
|
||||
|
||||
self._card_color_anim = QVariantAnimation(self)
|
||||
|
||||
@@ -17,7 +17,7 @@ from PySide6.QtWidgets import (
|
||||
from tagstudio.i18n.translations import Translations
|
||||
from tagstudio.qt.controllers.clickable_label import ClickableLabel
|
||||
from tagstudio.qt.controllers.modal_content import ModalContent
|
||||
from tagstudio.qt.views.styles.stylesheets import checkbox_style
|
||||
from tagstudio.qt.views.styles.stylesheets import PAD, checkbox_style
|
||||
|
||||
logger = structlog.get_logger(__name__)
|
||||
|
||||
@@ -29,7 +29,7 @@ class EditFieldTemplateModalView(ModalContent):
|
||||
# Layout Init
|
||||
self.setMinimumSize(460, 200)
|
||||
self.root_layout = QVBoxLayout(self)
|
||||
self.root_layout.setContentsMargins(6, 0, 6, 0)
|
||||
self.root_layout.setContentsMargins(PAD, 0, PAD, 0)
|
||||
self.root_layout.setAlignment(Qt.AlignmentFlag.AlignTop)
|
||||
|
||||
# Field Name
|
||||
@@ -64,14 +64,14 @@ class EditFieldTemplateModalView(ModalContent):
|
||||
self._text_field_attributes_layout = QHBoxLayout(self._text_field_attributes_widget)
|
||||
self._text_field_attributes_layout.setStretch(1, 1)
|
||||
self._text_field_attributes_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self._text_field_attributes_layout.setSpacing(6)
|
||||
self._text_field_attributes_layout.setSpacing(PAD)
|
||||
|
||||
# Is Multiline
|
||||
self._multiline_widget = QWidget()
|
||||
self._multiline_layout = QHBoxLayout(self._multiline_widget)
|
||||
self._multiline_layout.setStretch(1, 1)
|
||||
self._multiline_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self._multiline_layout.setSpacing(6)
|
||||
self._multiline_layout.setSpacing(PAD)
|
||||
self._multiline_layout.setAlignment(Qt.AlignmentFlag.AlignLeft)
|
||||
self._multiline_title = ClickableLabel(Translations["field.text.is_multiline"])
|
||||
self._multiline_checkbox = QCheckBox()
|
||||
|
||||
@@ -16,7 +16,7 @@ from PySide6.QtWidgets import (
|
||||
from tagstudio.i18n.translations import Translations
|
||||
from tagstudio.qt.controllers.clickable_label import ClickableLabel
|
||||
from tagstudio.qt.controllers.modal_content import ModalContent
|
||||
from tagstudio.qt.views.styles.stylesheets import checkbox_style, title_line_edit_style
|
||||
from tagstudio.qt.views.styles.stylesheets import PAD, checkbox_style, title_line_edit_style
|
||||
|
||||
|
||||
class EditTextView(ModalContent):
|
||||
@@ -24,7 +24,7 @@ class EditTextView(ModalContent):
|
||||
super().__init__()
|
||||
self.setMinimumSize(480, 240)
|
||||
self.root_layout = QVBoxLayout(self)
|
||||
self.root_layout.setContentsMargins(6, 0, 6, 0)
|
||||
self.root_layout.setContentsMargins(PAD, 0, PAD, 0)
|
||||
|
||||
self.name_field = QLineEdit()
|
||||
self.name_field.setStyleSheet(title_line_edit_style())
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import QFrame, QHBoxLayout, QScrollArea, QSizePolicy, QVBoxLayout, QWidget
|
||||
|
||||
from tagstudio.qt.views.styles.stylesheets import inset_container_style
|
||||
from tagstudio.qt.views.styles.stylesheets import HALF_PAD, PAD, inset_container_style
|
||||
|
||||
|
||||
class EntryDataBoxListView(QHBoxLayout):
|
||||
@@ -15,8 +15,8 @@ class EntryDataBoxListView(QHBoxLayout):
|
||||
|
||||
self.scroll_layout = QVBoxLayout()
|
||||
self.scroll_layout.setAlignment(Qt.AlignmentFlag.AlignTop)
|
||||
self.scroll_layout.setContentsMargins(3, 3, 3, 3)
|
||||
self.scroll_layout.setSpacing(6)
|
||||
self.scroll_layout.setContentsMargins(HALF_PAD, HALF_PAD, HALF_PAD, HALF_PAD)
|
||||
self.scroll_layout.setSpacing(PAD)
|
||||
|
||||
scroll_container = QWidget()
|
||||
scroll_container.setObjectName("entryScrollContainer")
|
||||
|
||||
@@ -9,6 +9,7 @@ from PySide6.QtWidgets import QHBoxLayout, QLabel, QPushButton, QVBoxLayout, QWi
|
||||
|
||||
from tagstudio.qt.resource_manager import ResourceManager
|
||||
from tagstudio.qt.views.styles.color_overlay import auto_theme_overlay
|
||||
from tagstudio.qt.views.styles.stylesheets import HALF_PAD
|
||||
|
||||
# TODO: There should be a global button theme somewhere.
|
||||
_BUTTON_SIZE = 22
|
||||
@@ -27,7 +28,7 @@ class EntryDataBoxView(QVBoxLayout):
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.inner_layout = QVBoxLayout()
|
||||
self.inner_layout.setContentsMargins(3, 0, 0, 3)
|
||||
self.inner_layout.setContentsMargins(HALF_PAD, 0, 0, HALF_PAD)
|
||||
self.inner_layout.setSpacing(0)
|
||||
self.field_container = QWidget()
|
||||
self.field_container.setLayout(self.inner_layout)
|
||||
@@ -51,7 +52,7 @@ class EntryDataBoxView(QVBoxLayout):
|
||||
self.copy_button.setMaximumSize(_BUTTON_SIZE, _BUTTON_SIZE)
|
||||
self.copy_button.setFlat(True)
|
||||
self.copy_button.setIcon(QPixmap.fromImage(ImageQt.ImageQt(self.copy_icon)))
|
||||
self.copy_button.setIconSize(QSize(20, 20))
|
||||
self.copy_button.setIconSize(QSize(_ICON_SIZE, _ICON_SIZE))
|
||||
self.copy_button.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
self.title_layout.addWidget(self.copy_button)
|
||||
self.copy_button.setHidden(True)
|
||||
|
||||
@@ -10,8 +10,8 @@ from PySide6.QtWidgets import QHBoxLayout, QLabel, QPushButton, QVBoxLayout, QWi
|
||||
|
||||
from tagstudio.core.library.alchemy.library import Library
|
||||
from tagstudio.i18n.translations import Translations
|
||||
from tagstudio.qt.views.styles.stylesheets import PAD
|
||||
|
||||
# Only import for type checking/autocompletion, will not be imported at runtime.
|
||||
if TYPE_CHECKING:
|
||||
from tagstudio.qt.qt_driver import QtDriver
|
||||
|
||||
@@ -27,7 +27,7 @@ class FixIgnoredEntriesModalView(QWidget):
|
||||
self.setWindowModality(Qt.WindowModality.ApplicationModal)
|
||||
self.setMinimumSize(400, 300)
|
||||
self.root_layout = QVBoxLayout(self)
|
||||
self.root_layout.setContentsMargins(6, 6, 6, 6)
|
||||
self.root_layout.setContentsMargins(PAD, PAD, PAD, PAD)
|
||||
|
||||
self.ignored_desc_widget = QLabel(Translations["entries.ignored.description"])
|
||||
self.ignored_desc_widget.setObjectName("ignoredDescriptionLabel")
|
||||
@@ -43,7 +43,7 @@ class FixIgnoredEntriesModalView(QWidget):
|
||||
|
||||
self.button_container = QWidget()
|
||||
self.button_layout = QHBoxLayout(self.button_container)
|
||||
self.button_layout.setContentsMargins(6, 6, 6, 6)
|
||||
self.button_layout.setContentsMargins(PAD, PAD, PAD, PAD)
|
||||
self.button_layout.addStretch(1)
|
||||
|
||||
self.done_button = QPushButton(Translations["generic.done_alt"])
|
||||
@@ -59,9 +59,9 @@ class FixIgnoredEntriesModalView(QWidget):
|
||||
self.root_layout.addWidget(self.button_container)
|
||||
|
||||
@override
|
||||
def keyPressEvent(self, event: QtGui.QKeyEvent) -> None: # noqa N802
|
||||
def keyPressEvent(self, event: QtGui.QKeyEvent) -> None:
|
||||
if event.key() == QtCore.Qt.Key.Key_Escape:
|
||||
self.done_button.click()
|
||||
else: # Other key presses
|
||||
else:
|
||||
pass
|
||||
return super().keyPressEvent(event)
|
||||
|
||||
@@ -16,6 +16,7 @@ from tagstudio.core.library.alchemy.library import Library
|
||||
from tagstudio.core.library.alchemy.models import Tag
|
||||
from tagstudio.i18n.translations import Translations
|
||||
from tagstudio.qt.controllers.modal_content import ModalContent
|
||||
from tagstudio.qt.views.styles.stylesheets import PAD
|
||||
|
||||
logger = structlog.get_logger(__name__)
|
||||
|
||||
@@ -30,7 +31,7 @@ class IgnoreModalView(ModalContent):
|
||||
|
||||
self.setMinimumSize(640, 460)
|
||||
self.root_layout = QVBoxLayout(self)
|
||||
self.root_layout.setContentsMargins(6, 0, 6, 0)
|
||||
self.root_layout.setContentsMargins(PAD, 0, PAD, 0)
|
||||
self.root_layout.setAlignment(Qt.AlignmentFlag.AlignTop)
|
||||
|
||||
self.text_edit = QPlainTextEdit()
|
||||
@@ -44,6 +45,6 @@ class IgnoreModalView(ModalContent):
|
||||
Translations.format("ignore.open_file", ts_ignore=IGNORE_NAME)
|
||||
)
|
||||
|
||||
# Add Widgets to Layout ================================================
|
||||
# Finalize Layout
|
||||
self.root_layout.addWidget(self.text_edit)
|
||||
self.root_layout.addWidget(self.open_button)
|
||||
|
||||
@@ -19,7 +19,13 @@ from tagstudio.qt.controllers.return_button import ReturnButton
|
||||
from tagstudio.qt.controllers.tag_suggest_box import TagSuggestBox
|
||||
from tagstudio.qt.mixed.file_attributes import FileAttributes
|
||||
from tagstudio.qt.resource_manager import ResourceManager
|
||||
from tagstudio.qt.views.styles.stylesheets import button_style, preview_warning_style
|
||||
from tagstudio.qt.views.styles.stylesheets import (
|
||||
HALF_PAD,
|
||||
PAD,
|
||||
WIN_PAD,
|
||||
button_style,
|
||||
preview_warning_style,
|
||||
)
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from tagstudio.qt.qt_driver import QtDriver
|
||||
@@ -30,8 +36,8 @@ logger = structlog.get_logger(__name__)
|
||||
class InspectorView(QVBoxLayout):
|
||||
def __init__(self, driver: QtDriver, pixel_ratio: float) -> None:
|
||||
super().__init__()
|
||||
self.setContentsMargins(0, 0, 9, 9)
|
||||
self.setSpacing(6)
|
||||
self.setContentsMargins(0, 0, WIN_PAD, WIN_PAD)
|
||||
self.setSpacing(PAD)
|
||||
rm = ResourceManager()
|
||||
|
||||
# Search/Create Boxes
|
||||
@@ -53,13 +59,13 @@ class InspectorView(QVBoxLayout):
|
||||
preview_section = QWidget()
|
||||
preview_layout = QVBoxLayout(preview_section)
|
||||
preview_layout.setContentsMargins(0, 0, 0, 0)
|
||||
preview_layout.setSpacing(6)
|
||||
preview_layout.setSpacing(PAD)
|
||||
|
||||
# Warning Banner (Missing FFmpeg, etc.)
|
||||
self.warning_banner = QWidget()
|
||||
self.warning_banner.setObjectName("ffmpeg_widget")
|
||||
ffmpeg_warning_layout = QHBoxLayout(self.warning_banner)
|
||||
ffmpeg_warning_layout.setContentsMargins(3, 3, 3, 3)
|
||||
ffmpeg_warning_layout.setContentsMargins(HALF_PAD, HALF_PAD, HALF_PAD, HALF_PAD)
|
||||
self.warning_banner.setStyleSheet(preview_warning_style())
|
||||
ffmpeg_warning_label = QLabel(
|
||||
Translations.format(
|
||||
@@ -86,17 +92,17 @@ class InspectorView(QVBoxLayout):
|
||||
info_section = QWidget()
|
||||
info_layout = QVBoxLayout(info_section)
|
||||
info_layout.setContentsMargins(0, 0, 0, 0)
|
||||
info_layout.setSpacing(6)
|
||||
info_layout.setSpacing(PAD)
|
||||
|
||||
splitter = QSplitter()
|
||||
splitter.setOrientation(Qt.Orientation.Vertical)
|
||||
splitter.setHandleWidth(12)
|
||||
splitter.setHandleWidth(PAD * 2)
|
||||
|
||||
# Add Tag/Field Buttons
|
||||
add_buttons_container = QWidget()
|
||||
add_buttons_layout = QHBoxLayout(add_buttons_container)
|
||||
add_buttons_layout.setContentsMargins(0, 0, 0, 0)
|
||||
add_buttons_layout.setSpacing(6)
|
||||
add_buttons_layout.setSpacing(PAD)
|
||||
|
||||
self.add_tag_button = ReturnButton(Translations["tag.add"])
|
||||
self.add_tag_button.setEnabled(False)
|
||||
|
||||
@@ -24,7 +24,7 @@ from PySide6.QtWidgets import (
|
||||
from tagstudio.i18n.platform_strings import open_file_str
|
||||
from tagstudio.i18n.translations import Translations
|
||||
from tagstudio.qt.views.styles.color_overlay import auto_theme_overlay
|
||||
from tagstudio.qt.views.styles.stylesheets import header
|
||||
from tagstudio.qt.views.styles.stylesheets import PAD, header
|
||||
|
||||
# Only import for type checking/autocompletion, will not be imported at runtime.
|
||||
if TYPE_CHECKING:
|
||||
@@ -42,7 +42,7 @@ class LibraryInfoWindowView(QWidget):
|
||||
self.setWindowTitle("Library Information")
|
||||
self.setMinimumSize(800, 480)
|
||||
self.root_layout = QVBoxLayout(self)
|
||||
self.root_layout.setContentsMargins(6, 6, 6, 6)
|
||||
self.root_layout.setContentsMargins(PAD, PAD, PAD, PAD)
|
||||
|
||||
row_height: int = 22
|
||||
icon_margin: int = 4
|
||||
@@ -58,7 +58,7 @@ class LibraryInfoWindowView(QWidget):
|
||||
self.body_widget = QWidget()
|
||||
self.body_layout = QHBoxLayout(self.body_widget)
|
||||
self.body_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.body_layout.setSpacing(6)
|
||||
self.body_layout.setSpacing(PAD)
|
||||
|
||||
# Statistics -----------------------------------------------------------
|
||||
self.stats_widget = QWidget()
|
||||
@@ -440,7 +440,7 @@ class LibraryInfoWindowView(QWidget):
|
||||
# Details --------------------------------------------------------------
|
||||
self.details_container = QWidget()
|
||||
self.details_layout = QHBoxLayout(self.details_container)
|
||||
self.details_layout.setContentsMargins(6, 0, 6, 0)
|
||||
self.details_layout.setContentsMargins(PAD, 0, PAD, 0)
|
||||
opacity_effect_details = QGraphicsOpacityEffect(self)
|
||||
opacity_effect_details.setOpacity(0.5)
|
||||
|
||||
@@ -451,7 +451,7 @@ class LibraryInfoWindowView(QWidget):
|
||||
# Buttons --------------------------------------------------------------
|
||||
self.button_container = QWidget()
|
||||
self.button_layout = QHBoxLayout(self.button_container)
|
||||
self.button_layout.setContentsMargins(6, 6, 6, 6)
|
||||
self.button_layout.setContentsMargins(PAD, PAD, PAD, PAD)
|
||||
self.button_layout.addStretch(1)
|
||||
|
||||
self.close_button = QPushButton(Translations["generic.close"])
|
||||
|
||||
@@ -8,7 +8,7 @@ from PySide6.QtWidgets import QHBoxLayout, QLabel, QPushButton, QVBoxLayout, QWi
|
||||
|
||||
from tagstudio.i18n.translations import Translations
|
||||
from tagstudio.qt.controllers.modal_content import ModalContent
|
||||
from tagstudio.qt.views.styles.stylesheets import header
|
||||
from tagstudio.qt.views.styles.stylesheets import PAD, header
|
||||
|
||||
logger = structlog.get_logger(__name__)
|
||||
|
||||
@@ -25,11 +25,11 @@ class ModalView(QVBoxLayout):
|
||||
):
|
||||
super().__init__()
|
||||
self.content_widget = content_widget
|
||||
self.setContentsMargins(6, 6 if inline_title else 12, 6, 6)
|
||||
self.setContentsMargins(PAD, PAD if inline_title else PAD * 2, PAD, PAD)
|
||||
|
||||
self.button_container = QWidget()
|
||||
self.button_layout = QHBoxLayout(self.button_container)
|
||||
self.button_layout.setContentsMargins(6, 6, 6, 6)
|
||||
self.button_layout.setContentsMargins(PAD, PAD, PAD, PAD)
|
||||
self.button_layout.addStretch(1)
|
||||
|
||||
# [Done]
|
||||
|
||||
@@ -11,6 +11,7 @@ from PySide6.QtWidgets import QHBoxLayout, QLabel, QLineEdit, QPushButton, QWidg
|
||||
|
||||
from tagstudio.qt.resource_manager import ResourceManager
|
||||
from tagstudio.qt.views.styles.color_overlay import auto_theme_overlay
|
||||
from tagstudio.qt.views.styles.stylesheets import HALF_PAD, PAD
|
||||
|
||||
|
||||
class PageValidator(QIntValidator):
|
||||
@@ -31,8 +32,8 @@ class PaginationView(QHBoxLayout):
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.setContentsMargins(0, 6, 0, 6)
|
||||
self.setSpacing(3)
|
||||
self.setContentsMargins(0, PAD, 0, PAD)
|
||||
self.setSpacing(HALF_PAD)
|
||||
_rm = ResourceManager()
|
||||
|
||||
# [<] ----------------------------------
|
||||
|
||||
@@ -17,7 +17,7 @@ from PySide6.QtWidgets import (
|
||||
)
|
||||
|
||||
from tagstudio.i18n.translations import Translations
|
||||
from tagstudio.qt.views.styles.stylesheets import list_button_style
|
||||
from tagstudio.qt.views.styles.stylesheets import PAD, list_button_style
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
@@ -29,13 +29,13 @@ class SearchPanelView(QVBoxLayout):
|
||||
) -> None:
|
||||
self.is_chooser: bool = is_chooser
|
||||
super().__init__()
|
||||
self.setContentsMargins(6, 0, 6, 0)
|
||||
self.setContentsMargins(PAD, 0, PAD, 0)
|
||||
|
||||
# Limit container
|
||||
self.limit_container = QWidget()
|
||||
self.limit_layout = QHBoxLayout(self.limit_container)
|
||||
self.limit_layout.setContentsMargins(0, 0, 0, 0)
|
||||
self.limit_layout.setSpacing(12)
|
||||
self.limit_layout.setSpacing(PAD * 2)
|
||||
self.limit_layout.addStretch(1)
|
||||
self.limit_title = QLabel(Translations["home.search.view_limit"])
|
||||
self.limit_layout.addWidget(self.limit_title)
|
||||
@@ -57,7 +57,7 @@ class SearchPanelView(QVBoxLayout):
|
||||
# Scroll area
|
||||
self.scroll_contents = QWidget()
|
||||
self.scroll_layout = QVBoxLayout(self.scroll_contents)
|
||||
self.scroll_layout.setContentsMargins(6, 0, 6, 0)
|
||||
self.scroll_layout.setContentsMargins(PAD, 0, PAD, 0)
|
||||
self.scroll_layout.setAlignment(Qt.AlignmentFlag.AlignTop)
|
||||
self.scroll_area = QScrollArea()
|
||||
self.scroll_area.setWidget(self.scroll_contents)
|
||||
|
||||
@@ -19,8 +19,12 @@ from tagstudio.qt.views.styles.palette import (
|
||||
# TODO: There's plenty of good opportunities here to consolidate similar styles.
|
||||
# Work should be done to more closely use Qt's theming systems rather than override them.
|
||||
|
||||
# Shared with RoundedProgressBar.set_corner_radius() so both use the exact same corner arc.
|
||||
BANNER_CORNER_RADIUS = 6
|
||||
|
||||
RADIUS = 6 # Standard corner radius
|
||||
INNER_RADIUS = RADIUS // 2 # Inner/small corder radius
|
||||
PAD = 6 # Standard padding value
|
||||
HALF_PAD = PAD // 2
|
||||
WIN_PAD = PAD + HALF_PAD # Padding used for window edge margins
|
||||
|
||||
|
||||
def add_button_style() -> str:
|
||||
@@ -31,7 +35,7 @@ def add_button_style() -> str:
|
||||
color: {get_tag_color(ColorType.TEXT, TagColorEnum.DEFAULT)};
|
||||
font-weight: 600;
|
||||
border-color: {get_tag_color(ColorType.BORDER, TagColorEnum.DEFAULT)};
|
||||
border-radius: 6px;
|
||||
border-radius: {RADIUS}px;
|
||||
border-style: solid;
|
||||
border-width: 2px;
|
||||
padding-right: 4px;
|
||||
@@ -59,7 +63,7 @@ def button_style() -> str:
|
||||
return f"""
|
||||
QPushButton{{
|
||||
background-color: {ThemePalette.COLOR_BG.value};
|
||||
border-radius: 6px;
|
||||
border-radius: {RADIUS}px;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
padding: 0px 12px;
|
||||
@@ -103,7 +107,7 @@ def line_edit_style_main() -> str:
|
||||
return f"""
|
||||
QLineEdit{{
|
||||
background: {bg_color};
|
||||
border-radius: 6px;
|
||||
border-radius: {RADIUS}px;
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
padding: 0px 4px;
|
||||
@@ -150,7 +154,7 @@ def colored_checkbox_style(
|
||||
background: rgba{primary_color.toTuple()};
|
||||
color: rgba{text_color.toTuple()};
|
||||
border-color: rgba{border_color.toTuple()};
|
||||
border-radius: 6px;
|
||||
border-radius: {RADIUS}px;
|
||||
border-style: solid;
|
||||
border-width: 2px;
|
||||
}}
|
||||
@@ -184,7 +188,7 @@ def colored_radio_button_style(
|
||||
background: rgba{primary_color.toTuple()};
|
||||
color: rgba{text_color.toTuple()};
|
||||
border-color: rgba{border_color.toTuple()};
|
||||
border-radius: 6px;
|
||||
border-radius: {RADIUS}px;
|
||||
border-style: solid;
|
||||
border-width: 2px;
|
||||
}}
|
||||
@@ -230,7 +234,7 @@ def color_swatch_style(
|
||||
color: rgba{text_color.toTuple()};
|
||||
border-color: rgba{border_color.toTuple()};
|
||||
{bottom_color_str}
|
||||
border-radius: 3px;
|
||||
border-radius: {INNER_RADIUS}px;
|
||||
border-style: solid;
|
||||
border-width: 2px;
|
||||
}}
|
||||
@@ -249,7 +253,7 @@ def color_swatch_style(
|
||||
QRadioButton::focus{{
|
||||
outline-style: solid;
|
||||
outline-width: 2px;
|
||||
outline-radius: 3px;
|
||||
outline-radius: {INNER_RADIUS}px;
|
||||
outline-color: rgba{highlight_color.toTuple()};
|
||||
}}
|
||||
"""
|
||||
@@ -278,7 +282,7 @@ def form_content_style() -> str:
|
||||
if QGuiApplication.styleHints().colorScheme() is Qt.ColorScheme.Dark
|
||||
else ThemePalette.COLOR_BG_LIGHT.value
|
||||
};
|
||||
border-radius: 3px;
|
||||
border-radius: {INNER_RADIUS}px;
|
||||
font-weight: 500;
|
||||
padding: 1px;
|
||||
}}
|
||||
@@ -313,7 +317,7 @@ def list_button_style(
|
||||
font-weight: 600;
|
||||
{"font: italic;" if italic else ""}
|
||||
border-color: rgba{border_color.toTuple()};
|
||||
border-radius: 6px;
|
||||
border-radius: {RADIUS}px;
|
||||
border-style: {border_style};
|
||||
border-width: 2px;
|
||||
padding-right: 4px;
|
||||
@@ -354,7 +358,7 @@ def properties_style() -> str:
|
||||
font-family: Oxanium;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
border-radius: 3px;
|
||||
border-radius: {INNER_RADIUS}px;
|
||||
padding-top: 4px;
|
||||
padding-right: 1px;
|
||||
padding-bottom: 1px;
|
||||
@@ -376,7 +380,7 @@ def tag_style(
|
||||
color: rgba{text_color.toTuple()};
|
||||
font-weight: 600;
|
||||
border-color: rgba{border_color.toTuple()};
|
||||
border-radius: 6px;
|
||||
border-radius: {RADIUS}px;
|
||||
border-style: {border_style};
|
||||
border-width: 2px;
|
||||
font-size: 13px;
|
||||
@@ -419,7 +423,7 @@ def tag_remove_button_style(
|
||||
color: rgba{text_color.toTuple()};
|
||||
border-color: rgba{highlight_color.toTuple()};
|
||||
border-width: 2;
|
||||
border-radius: 6px;
|
||||
border-radius: {RADIUS}px;
|
||||
}}
|
||||
QPushButton::pressed{{
|
||||
background: rgba{border_color.toTuple()};
|
||||
@@ -458,7 +462,7 @@ def inset_container_style(object_name: str = "") -> str:
|
||||
return f"""
|
||||
QWidget{"#" + object_name if object_name else ""}{{
|
||||
background: {bg_color};
|
||||
border-radius: 6px;
|
||||
border-radius: {RADIUS}px;
|
||||
}}
|
||||
"""
|
||||
|
||||
@@ -475,8 +479,8 @@ def autofill_scroll_top_style(object_name: str = "") -> str:
|
||||
return f"""
|
||||
QWidget{"#" + object_name if object_name else ""}{{
|
||||
background: {bg_color};
|
||||
border-top-left-radius: 6px;
|
||||
border-top-right-radius: 6px;
|
||||
border-top-left-radius: {RADIUS}px;
|
||||
border-top-right-radius: {RADIUS}px;
|
||||
border: none;
|
||||
}}
|
||||
"""
|
||||
@@ -493,8 +497,8 @@ def autofill_scroll_top_focus_style(object_name: str = "") -> str:
|
||||
return f"""
|
||||
QWidget{"#" + object_name if object_name else ""}{{
|
||||
background: {bg_color};
|
||||
border-top-left-radius: 6px;
|
||||
border-top-right-radius: 6px;
|
||||
border-top-left-radius: {RADIUS}px;
|
||||
border-top-right-radius: {RADIUS}px;
|
||||
border: solid;
|
||||
border-width: 2px 2px 0px 2px;
|
||||
border-color: rgba{Palette.accent().toTuple()};
|
||||
@@ -513,8 +517,8 @@ def autofill_line_edit_style() -> str:
|
||||
return f"""
|
||||
QLineEdit{{
|
||||
background: {bg_color};
|
||||
border-radius: 6px;
|
||||
padding: 3px 6px;
|
||||
border-radius: {RADIUS}px;
|
||||
padding: {HALF_PAD}px {PAD}px;
|
||||
}}
|
||||
QLineEdit::focus{{
|
||||
padding: 4px 4px;
|
||||
@@ -538,9 +542,9 @@ def autofill_line_edit_top_style() -> str:
|
||||
background: {bg_color};
|
||||
border-top-left-radius: 0px;
|
||||
border-top-right-radius: 0px;
|
||||
border-bottom-left-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
padding: 0px 0px 2px 6px;
|
||||
border-bottom-left-radius: {RADIUS}px;
|
||||
border-bottom-right-radius: {RADIUS}px;
|
||||
padding: 0px 0px 2px {RADIUS}px;
|
||||
}}
|
||||
QLineEdit::focus{{
|
||||
padding: 4px 4px;
|
||||
@@ -555,7 +559,7 @@ def preview_warning_style() -> str:
|
||||
return f"""
|
||||
QWidget#ffmpeg_widget {{
|
||||
background: {get_ui_color(ColorType.DARK_ACCENT, UiColor.RED)};
|
||||
border-radius: 6px;
|
||||
border-radius: {RADIUS}px;
|
||||
}}
|
||||
"""
|
||||
|
||||
@@ -598,7 +602,7 @@ def banner_close_button_style() -> str:
|
||||
background: transparent;
|
||||
color: rgba{text_color.toTuple()};
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
border-radius: {INNER_RADIUS}px;
|
||||
}}
|
||||
{_banner_button_hover_style("bannerCloseButton")}
|
||||
"""
|
||||
@@ -614,7 +618,7 @@ def banner_action_button_style() -> str:
|
||||
background-color: rgba{accent.toTuple()};
|
||||
color: rgba{text_color.toTuple()};
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
border-radius: {INNER_RADIUS}px;
|
||||
padding: 4px 8px;
|
||||
outline: none;
|
||||
}}
|
||||
@@ -655,7 +659,7 @@ def banner_close_button_progress_style() -> str:
|
||||
background: transparent;
|
||||
color: rgba{text_color.toTuple()};
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
border-radius: {INNER_RADIUS}px;
|
||||
}}
|
||||
QPushButton#bannerCloseButton::hover {{
|
||||
background-color: {hover};
|
||||
|
||||
@@ -10,6 +10,7 @@ from PySide6.QtWidgets import QFrame, QHBoxLayout, QSizePolicy, QVBoxLayout, QWi
|
||||
from tagstudio.qt.controllers.autofill_line_edit import AutofillLineEdit
|
||||
from tagstudio.qt.controllers.horizontal_scroll_area import HorizontalScrollArea
|
||||
from tagstudio.qt.views.styles.stylesheets import (
|
||||
PAD,
|
||||
autofill_line_edit_style,
|
||||
autofill_scroll_top_style,
|
||||
)
|
||||
@@ -36,7 +37,7 @@ class SuggestBoxView(QVBoxLayout):
|
||||
# Autocomplete ScrollArea
|
||||
contents = QWidget()
|
||||
self.content_layout = QHBoxLayout(contents)
|
||||
self.content_layout.setSpacing(6)
|
||||
self.content_layout.setSpacing(PAD)
|
||||
self.content_layout.setAlignment(Qt.AlignmentFlag.AlignBottom | Qt.AlignmentFlag.AlignLeft)
|
||||
self.content_layout.setContentsMargins(0, 0, 0, 0)
|
||||
scroll_area_container = QWidget()
|
||||
|
||||
@@ -10,6 +10,7 @@ from PySide6.QtGui import QColor, QEnterEvent, QPainter, QPainterPath, QPaintEve
|
||||
from PySide6.QtWidgets import QPushButton, QWidget
|
||||
|
||||
from tagstudio.qt.views.styles.palette import Palette
|
||||
from tagstudio.qt.views.styles.stylesheets import RADIUS
|
||||
|
||||
|
||||
# TODO: Use newer MVC style guidelines
|
||||
@@ -46,7 +47,6 @@ class ThumbButton(QPushButton):
|
||||
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
|
||||
path = QPainterPath()
|
||||
width = 3
|
||||
radius = 6
|
||||
path.addRoundedRect(
|
||||
QtCore.QRectF(
|
||||
width / 2,
|
||||
@@ -54,8 +54,8 @@ class ThumbButton(QPushButton):
|
||||
self.thumb_size[0] - width,
|
||||
self.thumb_size[1] - width,
|
||||
),
|
||||
radius,
|
||||
radius,
|
||||
RADIUS,
|
||||
RADIUS,
|
||||
)
|
||||
|
||||
if self.selected:
|
||||
|
||||
Reference in New Issue
Block a user