jdxi_editor.jdxi.style.factory

Module: style helpers

This module provides functions for dynamically generating Qt style sheets for various UI components, including sequencer buttons, general buttons, tabs, and editors. These functions allow for flexible styling customization based on application states.

Functions:

  • generate_polyend_sequencer_button_style(is_checked: bool, is_current: bool) -> str:

    Generates a button style for a Polyend-style sequencer based on its checked and current step state.

  • generate_sequencer_button_style(active: bool) -> str:

    Generates a QPushButton style for a step sequencer, updating colors based on active/inactive state.

  • generate_button_style(bg, border, radius, text_color, hover, border_pressed, …) -> str:

    Creates a flexible button style dynamically with customizable properties.

  • generate_tab_style(bg, border, radius, text_color, hover_bg, hover_border, …) -> str:

    Generates a QTabBar style for tabs with selectable and hover effects.

  • generate_editor_style(accent, accent_hover, background, foreground, font_family, …) -> str:

    Defines the style for an editor-like UI component, including sliders, buttons, and group boxes.

  • toggle_button_style(button, checked: bool):

    Updates the given button’s style based on whether it is checked.

  • update_button_style(button, checked: bool):

    Toggles the button style dynamically.

  • get_button_styles(active: bool) -> str:

    Returns a style sheet string for buttons in active or inactive states.

These functions help ensure a cohesive and visually distinct UI experience, particularly in MIDI sequencers or other interactive applications.

Attributes

FONT_FAMILY

Functions

generate_polyend_sequencer_button_style(→ str)

Generate button style based on state and current step

generate_sequencer_button_style(→ str)

Generate button style based on active state

generate_button_style(→ str)

Generate address button style dynamically.

generate_tab_style(bg, border, radius, text_color, ...)

Generate address tab style dynamically.

generate_editor_style(→ str)

Generate editor style dynamically.

get_button_styles(→ str)

Returns the appropriate style for active/inactive button states

toggle_button_style(button, checked)

Update button style based on its checked state

update_button_style(button, checked)

Toggle the button style based on the state

Module Contents

jdxi_editor.jdxi.style.factory.FONT_FAMILY = 'Orbitron'[source]
jdxi_editor.jdxi.style.factory.generate_polyend_sequencer_button_style(self, is_checked: bool, is_current: bool = False) str[source]

Generate button style based on state and current step

Parameters:
  • self – The instance of the class

  • is_checked – bool Whether the button is checked

  • is_current – bool Whether the button is the current step

Returns:

str The style sheet for the button

jdxi_editor.jdxi.style.factory.generate_sequencer_button_style(active: bool) str[source]

Generate button style based on active state

Parameters:

active – bool Whether the button is active

Returns:

str The style sheet for the button

jdxi_editor.jdxi.style.factory.generate_button_style(bg: str, border: str, radius: int, text_color: str, hover: str, border_pressed: str, background_pressed: str = '#666666', button_border_width: int = 4, font_family: str = FONT_FAMILY, font_size: str = '12px', button_padding: int = 4) str[source]

Generate address button style dynamically.

Parameters:
  • border_pressed – str The border color when pressed

  • background_pressed – str The background color when pressed

  • button_border_width – int The border width of the button

  • button_padding – int The padding of the button

  • font_size – str The font size

  • font_family – str The font family

  • bg – str The background color

  • border – str The border color

  • radius – int The radius of the button

  • text_color – str The text color

  • hover – str The hover color

jdxi_editor.jdxi.style.factory.generate_tab_style(bg: str, border: str, radius: int, text_color: str, hover_bg: str, hover_border: str, selected_bg: str, selected_border: str, font_family: str = FONT_FAMILY, font_size: str = '12px', padding: str = '1px 1px', margin: str = '1px', accent: str = '#FF2200')[source]

Generate address tab style dynamically.

Parameters:
  • accent

  • selected_border

  • selected_bg

  • hover_border

  • font_family – str The font family

  • margin – str The margin for the tab

  • padding – str The padding for the tab

  • font_size – str The font size

  • bg – str The background color

  • border – str The border color

  • radius – int The radius of the tab

  • text_color – str The text color

  • hover_bg – str The hover background color

jdxi_editor.jdxi.style.factory.generate_editor_style(accent: str, accent_hover: str, background: str, foreground: str, font_family: str, font_size: str, padding: int, button_padding: int, slider_handle: str, slider_handle_border: str, slider_groove: str, slider_neon: str, slider_neon_gradient_stop: str, font_weight: str = 'normal', box_width: str = '100px') str[source]

Generate editor style dynamically.

Parameters:
  • box_width – str width of box widgets such as combo boxes, push button, line edit

  • font_weight – str The font weight

  • slider_neon_gradient_stop – str The gradient stop color for the slider handle

  • slider_neon – str The neon color for the slider handle

  • slider_groove – str The groove color for the slider

  • font_family – str The font family

  • font_size – str The font size

  • padding – int The padding for the group box

  • button_padding – int The padding for the button

  • slider_handle – str The color of the slider handle

  • slider_handle_border – str The color of the slider handle border

  • accent – str The accent color

  • accent_hover – str The accent hover color

  • background – str The background color

  • foreground – str The foreground color

Returns:

str The style sheet for the editor

jdxi_editor.jdxi.style.factory.get_button_styles(active: bool) str[source]

Returns the appropriate style for active/inactive button states

Parameters:

active – bool Whether the button is active

Returns:

str The style sheet for the button

jdxi_editor.jdxi.style.factory.toggle_button_style(button: PySide6.QtWidgets.QPushButton, checked: bool)[source]

Update button style based on its checked state :param button: QPushButton The button to update :param checked: bool Whether the button is checked

jdxi_editor.jdxi.style.factory.update_button_style(button: PySide6.QtWidgets.QPushButton, checked: bool)[source]

Toggle the button style based on the state :param button: QPushButton The button to update :param checked: bool Whether the button is checked