Loading CHANGELOG.md +4 −0 Original line number Diff line number Diff line ### nova-trame, 0.18.2 * Passing a string to the style parameter to GridLayout, HBoxLayout, and VBoxLayout will no longer cause Trame to crash (thanks to John Duggan). ### nova-trame, 0.18.1 * The `CompactTheme` has been overhauled and should produce denser UIs (thanks to Kristin Maroun). Loading pyproject.toml +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ Changelog = "https://code.ornl.gov/ndip/public-packages/nova-trame/blob/main/CHA [tool.poetry] name = "nova-trame" version = "0.18.1" version = "0.18.2" description = "A Python Package for injecting curated themes and custom components into Trame applications" authors = ["Duggan, John <dugganjw@ornl.gov>"] readme = "README.md" Loading src/nova/trame/view/layouts/grid.py +5 −2 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ from typing import Any, Optional, Union from trame.widgets import html from trame_client.widgets.core import AbstractElement from .utils import merge_styles class GridLayout(html.Div): """Creates a grid with a specified number of columns.""" Loading Loading @@ -68,9 +70,10 @@ class GridLayout(html.Div): classes = " ".join(classes) classes += " d-grid" style = self.get_root_styles(columns, height, width, halign, valign, gap) | kwargs.pop("style", {}) widget_style = self.get_root_styles(columns, height, width, halign, valign, gap) user_style = kwargs.pop("style", {}) super().__init__(classes=classes, style=style, **kwargs) super().__init__(classes=classes, style=merge_styles(widget_style, user_style), **kwargs) def get_root_styles( self, Loading src/nova/trame/view/layouts/hbox.py +5 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ from typing import Any, Optional, Union from trame.widgets import html from .utils import merge_styles class HBoxLayout(html.Div): """Creates an element that horizontally stacks its children.""" Loading Loading @@ -59,9 +61,10 @@ class HBoxLayout(html.Div): classes = " ".join(classes) classes += " d-flex flex-row" style = self.get_root_styles(height, width, halign, valign, gap, vspace) | kwargs.pop("style", {}) widget_style = self.get_root_styles(height, width, halign, valign, gap, vspace) user_style = kwargs.pop("style", {}) super().__init__(classes=classes, style=style, **kwargs) super().__init__(classes=classes, style=merge_styles(widget_style, user_style), **kwargs) def get_root_styles( self, Loading src/nova/trame/view/layouts/utils.py 0 → 100644 +16 −0 Original line number Diff line number Diff line """Utilities for our layout components.""" from typing import Dict, Union def merge_styles(*styles: Union[Dict[str, str], str]) -> str: result = "" for style in styles: if isinstance(style, dict): for key, value in style.items(): result += f" {key}: {value};" else: result += f" {style};" return result Loading
CHANGELOG.md +4 −0 Original line number Diff line number Diff line ### nova-trame, 0.18.2 * Passing a string to the style parameter to GridLayout, HBoxLayout, and VBoxLayout will no longer cause Trame to crash (thanks to John Duggan). ### nova-trame, 0.18.1 * The `CompactTheme` has been overhauled and should produce denser UIs (thanks to Kristin Maroun). Loading
pyproject.toml +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ Changelog = "https://code.ornl.gov/ndip/public-packages/nova-trame/blob/main/CHA [tool.poetry] name = "nova-trame" version = "0.18.1" version = "0.18.2" description = "A Python Package for injecting curated themes and custom components into Trame applications" authors = ["Duggan, John <dugganjw@ornl.gov>"] readme = "README.md" Loading
src/nova/trame/view/layouts/grid.py +5 −2 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ from typing import Any, Optional, Union from trame.widgets import html from trame_client.widgets.core import AbstractElement from .utils import merge_styles class GridLayout(html.Div): """Creates a grid with a specified number of columns.""" Loading Loading @@ -68,9 +70,10 @@ class GridLayout(html.Div): classes = " ".join(classes) classes += " d-grid" style = self.get_root_styles(columns, height, width, halign, valign, gap) | kwargs.pop("style", {}) widget_style = self.get_root_styles(columns, height, width, halign, valign, gap) user_style = kwargs.pop("style", {}) super().__init__(classes=classes, style=style, **kwargs) super().__init__(classes=classes, style=merge_styles(widget_style, user_style), **kwargs) def get_root_styles( self, Loading
src/nova/trame/view/layouts/hbox.py +5 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ from typing import Any, Optional, Union from trame.widgets import html from .utils import merge_styles class HBoxLayout(html.Div): """Creates an element that horizontally stacks its children.""" Loading Loading @@ -59,9 +61,10 @@ class HBoxLayout(html.Div): classes = " ".join(classes) classes += " d-flex flex-row" style = self.get_root_styles(height, width, halign, valign, gap, vspace) | kwargs.pop("style", {}) widget_style = self.get_root_styles(height, width, halign, valign, gap, vspace) user_style = kwargs.pop("style", {}) super().__init__(classes=classes, style=style, **kwargs) super().__init__(classes=classes, style=merge_styles(widget_style, user_style), **kwargs) def get_root_styles( self, Loading
src/nova/trame/view/layouts/utils.py 0 → 100644 +16 −0 Original line number Diff line number Diff line """Utilities for our layout components.""" from typing import Dict, Union def merge_styles(*styles: Union[Dict[str, str], str]) -> str: result = "" for style in styles: if isinstance(style, dict): for key, value in style.items(): result += f" {key}: {value};" else: result += f" {style};" return result