Skip to content

Commit

Permalink
Add margin to plot principle toggle descriptions, closes #1373
Browse files Browse the repository at this point in the history
  • Loading branch information
zkovari committed Oct 3, 2024
1 parent e3d50a2 commit f45c0b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/main/python/plotlyst/view/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from qthandy import hbox, vbox, margins


def group(*widgets, vertical: bool = True, margin: int = 2, spacing: int = 3, margin_top: int = 0,
def group(*widgets, vertical: bool = True, margin: int = 2, spacing: int = 3, margin_top: int = 0, margin_left: int = 0,
parent=None) -> QWidget:
container = QWidget(parent)
if vertical:
Expand All @@ -32,6 +32,8 @@ def group(*widgets, vertical: bool = True, margin: int = 2, spacing: int = 3, ma

if margin_top:
margins(container, top=margin_top)
if margin_left:
margins(container, top=margin_left)

for w in widgets:
container.layout().addWidget(w)
Expand Down
6 changes: 3 additions & 3 deletions src/main/python/plotlyst/view/widget/plot/principle.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
from qthandy import bold, margins, italic, vbox, transparent, \
hbox, spacer, sp, pointy, line, underline
from qthandy.filter import OpacityEventFilter
from qtmenu import MenuWidget, group, ActionTooltipDisplayMode
from qtmenu import MenuWidget, ActionTooltipDisplayMode

from plotlyst.common import RELAXED_WHITE_COLOR, CONFLICT_SELF_COLOR
from plotlyst.core.domain import Plot, PlotType, PlotPrinciple, \
PlotPrincipleType, PlotEventType, DynamicPlotPrincipleGroupType
from plotlyst.core.template import antagonist_role
from plotlyst.view.common import shadow, label, tool_btn, push_btn, scrolled, action
from plotlyst.view.common import shadow, label, tool_btn, push_btn, scrolled, action, wrap
from plotlyst.view.icons import IconRegistry
from plotlyst.view.layout import group
from plotlyst.view.style.base import apply_white_menu
Expand Down Expand Up @@ -264,7 +264,7 @@ def __init__(self, principleType: PlotPrincipleType, plotType: Optional[PlotType
self.toggle = Toggle(self)
self.layout().addWidget(group(self._label, spacer(), self.toggle, margin=0))
desc = label(hint, description=True)
self.layout().addWidget(desc)
self.layout().addWidget(wrap(desc, margin_left=20))

self.toggle.toggled.connect(self._label.setChecked)

Expand Down

0 comments on commit f45c0b2

Please sign in to comment.