Skip to content

Commit

Permalink
Minor fixes for HoloViews widgets (#1163)
Browse files Browse the repository at this point in the history
* Fixed DiscreteSlider margin

* Hide single slider
  • Loading branch information
philippjfr authored Mar 19, 2020
1 parent 92b075d commit 602e467
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion panel/pane/holoviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ def widgets_from_dimensions(cls, object, widget_types=None, widgets_type='indivi

dynamic, bounded = get_dynamic_mode(object)
dims, keys = unique_dimkeys(object)
if dims == [Dimension('Frame')] and keys == [(0,)]:
if ((dims == [Dimension('Frame')] and keys == [(0,)]) or
(not dynamic and len(keys) == 1)):
return [], {}

nframes = 1
Expand Down
7 changes: 4 additions & 3 deletions panel/widgets/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ def __init__(self, **params):

self._text = StaticText(margin=(5, 0, 0, 5), style={'white-space': 'nowrap'})
self._slider = None
layout = {p: getattr(self, p) for p in Layoutable.param
if getattr(self, p) is not None}
self._composite = Column(self._text, self._slider, **layout)
self._composite = Column(self._text, self._slider)
self._update_options()
self.param.watch(self._update_options, ['options', 'formatter'])
self.param.watch(self._update_value, ['value'])
Expand Down Expand Up @@ -253,6 +251,9 @@ def _update_style(self, *events):
self._text.param.set_param(
margin=text_margin, **{k: v for k, v in style.items() if k != 'style'})
self._slider.param.set_param(margin=slider_margin, **style)
if self.width:
style['width'] = self.width + l + r
self._composite.param.set_param(**style)

def _sync_value(self, event):
if self._syncing:
Expand Down

0 comments on commit 602e467

Please sign in to comment.