Skip to content

Commit cff8b77

Browse files
committed
Expose repeat for the Play Widget
1 parent 91d4030 commit cff8b77

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

ipywidgets/widgets/widget_int.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class Play(_BoundedInt):
228228
_model_name = Unicode('PlayModel').tag(sync=True)
229229

230230
playing = Bool(help="Whether the control is currently playing.").tag(sync=True)
231-
_repeat = Bool(help="Whether the control will repeat in a continous loop.").tag(sync=True)
231+
repeat = Bool(help="Whether the control will repeat in a continous loop.").tag(sync=True)
232232

233233
interval = CInt(100, help="The time between two animation steps (ms).").tag(sync=True)
234234
step = CInt(1, help="Increment step").tag(sync=True)

packages/controls/src/widget_int.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ class PlayModel extends BoundedIntModel {
777777
return _.extend(super.defaults(), {
778778
_model_name: 'PlayModel',
779779
_view_name: 'PlayView',
780-
_repeat: false,
780+
repeat: false,
781781
playing: false,
782782
show_repeat: true,
783783
interval: 100,
@@ -798,7 +798,7 @@ class PlayModel extends BoundedIntModel {
798798
this.set('value', next_value);
799799
this.schedule_next();
800800
} else {
801-
if (this.get('_repeat')) {
801+
if (this.get('repeat')) {
802802
this.set('value', this.get('min'));
803803
this.schedule_next();
804804
} else {
@@ -848,7 +848,7 @@ class PlayModel extends BoundedIntModel {
848848
}
849849

850850
repeat() {
851-
this.set('_repeat', !this.get('_repeat'));
851+
this.set('repeat', !this.get('repeat'));
852852
this.save_changes();
853853
}
854854

@@ -897,10 +897,10 @@ class PlayView extends DOMWidgetView {
897897
this.repeatButton.onclick = this.model.repeat.bind(this.model);
898898

899899
this.listenTo(this.model, 'change:playing', this.onPlayingChanged);
900-
this.listenTo(this.model, 'change:_repeat', this.update_repeat);
901-
this.listenTo(this.model, 'change:show_repeat', this.update_repeat);
900+
this.listenTo(this.model, 'change:repeat', this.updateRepeat);
901+
this.listenTo(this.model, 'change:show_repeat', this.updateRepeat);
902902
this.updatePlaying();
903-
this.update_repeat();
903+
this.updateRepeat();
904904
this.update();
905905
}
906906

@@ -940,8 +940,8 @@ class PlayView extends DOMWidgetView {
940940
}
941941
}
942942

943-
update_repeat() {
944-
let repeat = this.model.get('_repeat');
943+
updateRepeat() {
944+
let repeat = this.model.get('repeat');
945945
this.repeatButton.style.display = this.model.get('show_repeat') ? this.playButton.style.display : 'none';
946946
if (repeat) {
947947
this.repeatButton.classList.add('mod-active');

packages/schema/jupyterwidgetmodels.latest.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ Attribute | Type | Default | Help
776776
`_model_module` | string | `'@jupyter-widgets/controls'` |
777777
`_model_module_version` | string | `'1.5.0'` |
778778
`_model_name` | string | `'PlayModel'` |
779-
`_repeat` | boolean | `false` | Whether the control will repeat in a continous loop.
780779
`_view_module` | string | `'@jupyter-widgets/controls'` |
781780
`_view_module_version` | string | `'1.5.0'` |
782781
`_view_name` | string | `'PlayView'` |
@@ -788,6 +787,7 @@ Attribute | Type | Default | Help
788787
`max` | number (integer) | `100` | Max value
789788
`min` | number (integer) | `0` | Min value
790789
`playing` | boolean | `false` | Whether the control is currently playing.
790+
`repeat` | boolean | `false` | Whether the control will repeat in a continous loop.
791791
`show_repeat` | boolean | `true` | Show the repeat toggle button in the widget.
792792
`step` | number (integer) | `1` | Increment step
793793
`style` | reference to DescriptionStyle widget | reference to new instance | Styling customizations

packages/schema/jupyterwidgetmodels.v8.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ Attribute | Type | Default | Help
718718
`_model_module_version` | string | `'1.4.0'` |
719719
`_model_name` | string | `'PlayModel'` |
720720
`playing` | boolean | `false` | Whether the control is currently playing.
721-
`_repeat` | boolean | `false` | Whether the control will repeat in a continous loop.
721+
`repeat` | boolean | `false` | Whether the control will repeat in a continous loop.
722722
`_view_module` | string | `'@jupyter-widgets/controls'` |
723723
`_view_module_version` | string | `'1.4.0'` |
724724
`_view_name` | string | `'PlayView'` |

0 commit comments

Comments
 (0)