Skip to content

Commit

Permalink
Add empty progress bar (#2088)
Browse files Browse the repository at this point in the history
* Add -1 to lower bound for Progress

* Update unittest
  • Loading branch information
hoxbro authored and philippjfr committed Apr 8, 2021
1 parent d254381 commit 10c7db9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion panel/tests/widgets/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_audio_url(document, comm):
def test_progress_bounds():
progress = Progress()
progress.max = 200
assert progress.param.value.bounds == (0, 200)
assert progress.param.value.bounds == (-1, 200)
progress.value = 120
assert progress.value == 120

Expand Down
6 changes: 3 additions & 3 deletions panel/widgets/indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,18 @@ class Progress(ValueIndicator):

max = param.Integer(default=100, doc="The maximum value of the progress bar.")

value = param.Integer(default=None, bounds=(0, None), doc="""
value = param.Integer(default=None, bounds=(-1, None), doc="""
The current value of the progress bar. If set to None the progress
bar will be indeterminate and animate depending on the active
parameter.""")
parameter. If set to -1 the progress bar will be empty.""")

_rename = {'name': None}

_widget_type = _BkProgress

@param.depends('max', watch=True)
def _update_value_bounds(self):
self.param.value.bounds = (0, self.max)
self.param.value.bounds = (-1, self.max)

def __init__(self,**params):
super().__init__(**params)
Expand Down

0 comments on commit 10c7db9

Please sign in to comment.