Add step parameter to slider widget

master
0xee 2021-04-03 14:04:20 +02:00
parent 05616f5ad5
commit 8fc0e2175d
1 changed files with 4 additions and 2 deletions

View File

@ -48,7 +48,8 @@ def slider_widget(label,
value_path=None, value_path=None,
unit='', unit='',
min_val=0, min_val=0,
max_val=255): max_val=255,
step=1):
id_ = make_id() id_ = make_id()
sub_topic = sub_topic or topic sub_topic = sub_topic or topic
template = ''' template = '''
@ -58,7 +59,7 @@ def slider_widget(label,
class="slider update-policy-update-value {{sub_topic}}-value" class="slider update-policy-update-value {{sub_topic}}-value"
data-pub-topic="{{topic}}" data-pub-topic="{{topic}}"
{% if value_path %} data-value-path="{{value_path}}" {% endif %} {% if value_path %} data-value-path="{{value_path}}" {% endif %}
min="{{min_val}}" type="range" max="{{max_val}}" min="{{min_val}}" type="range" max="{{max_val}}" step="{{step}}"
value="{{min_val}}"/> value="{{min_val}}"/>
<span id="{{id_}}-textual" class="slider-value">-</span> <span id="{{id_}}-textual" class="slider-value">-</span>
<span>{{unit}}</span> <span>{{unit}}</span>
@ -71,6 +72,7 @@ def slider_widget(label,
label=label, label=label,
min_val=min_val, min_val=min_val,
max_val=max_val, max_val=max_val,
step=step,
value_path=value_path, value_path=value_path,
topic=topic, topic=topic,
unit=unit, unit=unit,