Skip to content

Commit

Permalink
Add support for embedding Player widget
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Aug 9, 2019
1 parent a49a9b7 commit 673d418
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions panel/widgets/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class Player(PlayerBase):

value = param.Integer(default=0, doc="Current player value")

_supports_embed = True

def __init__(self, **params):
if 'length' in params:
if 'start' in params or 'end' in params:
Expand All @@ -55,6 +57,11 @@ def __init__(self, **params):
params['value'] = params['start']
super(Player, self).__init__(**params)

def _get_embed_state(self, root, max_opts=3):
return (self, self._models[root.ref['id']][0], range(self.start, self.end, self.step),
lambda x: x.value, 'value', 'cb_obj.value')



class DiscretePlayer(PlayerBase, SelectBase):
"""
Expand Down

0 comments on commit 673d418

Please sign in to comment.