Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plopp/plotting/scatter3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def scatter3d(
clip_manager = ClippingManager(fig)
fig.toolbar['cut3d'] = ToggleTool(
callback=clip_manager.toggle_visibility,
icon='layer-group',
icon='crop',
tooltip='Hide/show spatial cutting tool',
)
fig.bottom_bar.add(clip_manager)
Expand Down
3 changes: 2 additions & 1 deletion src/plopp/widgets/clip3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from ..graphics import BaseFig
from .debounce import debounce
from .style import BUTTON_LAYOUT
from .utils import RUNNING_IN_VSCODE


def _xor(x: list[sc.Variable]) -> sc.Variable:
Expand Down Expand Up @@ -383,7 +384,7 @@ def __init__(self, fig: BaseFig):
self.cut_borders_visibility = ipw.ToggleButton(
value=True,
disabled=True,
icon='border-style',
icon='square-o' if RUNNING_IN_VSCODE else 'border-style',
tooltip='Toggle visibility of the borders of the cuts',
**BUTTON_LAYOUT,
)
Expand Down
5 changes: 3 additions & 2 deletions src/plopp/widgets/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from ..core.typing import FigureLike
from ..graphics import BaseFig
from .tools import ToggleTool
from .utils import RUNNING_IN_VSCODE


def is_figure(x):
Expand Down Expand Up @@ -231,7 +232,7 @@ def _make_rectangles(**kwargs):
DrawingTool,
tool=_make_rectangles,
get_artist_info=_get_rect_info,
icon='vector-square',
icon='object-ungroup' if RUNNING_IN_VSCODE else 'vector-square',
)


Expand Down Expand Up @@ -274,7 +275,7 @@ def _make_polygons(**kwargs):
DrawingTool,
tool=partial(_make_polygons, mec='w'),
get_artist_info=_get_polygon_info,
icon='draw-polygon',
icon='object-ungroup' if RUNNING_IN_VSCODE else 'draw-polygon',
)
"""
Tool to draw polygon selections on a figure.
Expand Down
6 changes: 2 additions & 4 deletions src/plopp/widgets/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ def value(self) -> str | None:
HomeTool = partial(ButtonTool, icon='home')
"""Return home tool."""

AutoscaleTool = partial(
ButtonTool, icon='arrows-alt-v', tooltip='Autoscale colorbar range'
)
AutoscaleTool = partial(ButtonTool, icon='arrows-v', tooltip='Autoscale colorbar range')
"""Autoscale the colorbar to fit the data."""

LogxTool = partial(ToggleTool, description='logx', tooltip='Toggle X axis scale')
Expand Down Expand Up @@ -182,7 +180,7 @@ def value(self) -> str | None:
AxesTool = partial(
ToggleTool,
value=True,
icon='ruler-combined',
icon='arrows-alt',
style={'font_weight': 'bold'},
tooltip='Toggle visibility of XYZ axes',
)
Expand Down
15 changes: 15 additions & 0 deletions src/plopp/widgets/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2026 Scipp contributors (https://github.com/scipp)

import os

# Determine if the code is likely running in a VS Code environment:
RUNNING_IN_VSCODE = False
# Common in VS Code terminals / extension-launched processes
if os.environ.get("VSCODE_PID"):
RUNNING_IN_VSCODE = True
if os.environ.get("TERM_PROGRAM") == "vscode":
RUNNING_IN_VSCODE = True
# Sometimes present in remote scenarios
if "VSCODE_IPC_HOOK_CLI" in os.environ:
RUNNING_IN_VSCODE = True
Loading