style: unify GUI button radius
This commit is contained in:
+58
-4
@@ -91,6 +91,34 @@ COLOR_PENDING = "#9a6700"
|
||||
COLOR_MUTED = "#6e7781"
|
||||
COLOR_WARNING = "#bc4c00"
|
||||
COLOR_DANGER_BG = "#ffebe9"
|
||||
BUTTON_RADIUS_PX = 4
|
||||
BUTTON_BASE_STYLE = f"""
|
||||
QPushButton {{
|
||||
min-height: 24px;
|
||||
min-width: 72px;
|
||||
padding: 4px 10px;
|
||||
border: 1px solid #d0d7de;
|
||||
border-radius: {BUTTON_RADIUS_PX}px;
|
||||
background-color: #f6f8fa;
|
||||
color: #24292f;
|
||||
}}
|
||||
QPushButton:hover {{
|
||||
background-color: #eef4ff;
|
||||
border-color: #8c959f;
|
||||
}}
|
||||
QPushButton:pressed {{
|
||||
background-color: #d8dee4;
|
||||
border-color: #6e7781;
|
||||
}}
|
||||
QPushButton:focus {{
|
||||
border-color: #0969da;
|
||||
}}
|
||||
QPushButton:disabled {{
|
||||
background-color: #f6f8fa;
|
||||
border-color: #d8dee4;
|
||||
color: #8c959f;
|
||||
}}
|
||||
"""
|
||||
|
||||
|
||||
|
||||
@@ -171,12 +199,38 @@ def _danger_metric_text(text, active):
|
||||
return f'<span style="color:{COLOR_DANGER}; font-weight:600;">{text}</span>'
|
||||
|
||||
|
||||
def _danger_outline_button_style(object_name):
|
||||
def _outline_button_style(object_name, color, hover_bg="#f6f8fa", pressed_bg="#f6f8fa"):
|
||||
return (
|
||||
f"QPushButton#{object_name} {{ "
|
||||
f"color: {COLOR_DANGER}; border: 1px solid {COLOR_DANGER}; "
|
||||
"font-weight: 600; padding: 3px 10px; border-radius: 4px; "
|
||||
f"color: {color}; border-color: {color}; font-weight: 600; "
|
||||
"}"
|
||||
f"QPushButton#{object_name}:hover {{ "
|
||||
f"background-color: {hover_bg}; border-color: {color}; "
|
||||
"}"
|
||||
f"QPushButton#{object_name}:pressed {{ "
|
||||
f"background-color: {pressed_bg}; border-color: {color}; "
|
||||
"}"
|
||||
f"QPushButton#{object_name}:disabled {{ "
|
||||
"color: #8c959f; border-color: #d8dee4; "
|
||||
"}"
|
||||
)
|
||||
|
||||
|
||||
def _warning_outline_button_style(object_name):
|
||||
return _outline_button_style(
|
||||
object_name,
|
||||
COLOR_WARNING,
|
||||
hover_bg="#fff8f0",
|
||||
pressed_bg="#ffedd5",
|
||||
)
|
||||
|
||||
|
||||
def _danger_outline_button_style(object_name):
|
||||
return _outline_button_style(
|
||||
object_name,
|
||||
COLOR_DANGER,
|
||||
hover_bg="#fff1f0",
|
||||
pressed_bg=COLOR_DANGER_BG,
|
||||
)
|
||||
|
||||
|
||||
@@ -425,4 +479,4 @@ def _safe_write_diagnostic_log(
|
||||
def _elapsed_ms(started):
|
||||
return int((time.monotonic() - started) * 1000)
|
||||
|
||||
__all__ = [name for name in globals() if not name.startswith("__")]
|
||||
__all__ = [name for name in globals() if not name.startswith("__")]
|
||||
|
||||
Reference in New Issue
Block a user