Skip to content

Commit 3661476

Browse files
committed
Expose repeat for the Play Widget
1 parent de470f1 commit 3661476

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
@@ -776,7 +776,7 @@ class PlayModel extends BoundedIntModel {
776776
return _.extend(super.defaults(), {
777777
_model_name: 'PlayModel',
778778
_view_name: 'PlayView',
779-
_repeat: false,
779+
repeat: false,
780780
playing: false,
781781
show_repeat: true,
782782
interval: 100,
@@ -797,7 +797,7 @@ class PlayModel extends BoundedIntModel {
797797
this.set('value', next_value);
798798
this.schedule_next();
799799
} else {
800-
if (this.get('_repeat')) {
800+
if (this.get('repeat')) {
801801
this.set('value', this.get('min'));
802802
this.schedule_next();
803803
} else {
@@ -847,7 +847,7 @@ class PlayModel extends BoundedIntModel {
847847
}
848848

849849
repeat(): void {
850-
this.set('_repeat', !this.get('_repeat'));
850+
this.set('repeat', !this.get('repeat'));
851851
this.save_changes();
852852
}
853853

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

898898
this.listenTo(this.model, 'change:playing', this.onPlayingChanged);
899-
this.listenTo(this.model, 'change:_repeat', this.update_repeat);
900-
this.listenTo(this.model, 'change:show_repeat', this.update_repeat);
899+
this.listenTo(this.model, 'change:repeat', this.updateRepeat);
900+
this.listenTo(this.model, 'change:show_repeat', this.updateRepeat);
901901
this.updatePlaying();
902-
this.update_repeat();
902+
this.updateRepeat();
903903
this.update();
904904
}
905905

@@ -939,8 +939,8 @@ class PlayView extends DOMWidgetView {
939939
}
940940
}
941941

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

packages/schema/jupyterwidgetmodels.latest.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,6 @@ Attribute | Type | Default | Help
784784
`_model_module` | string | `'@jupyter-widgets/controls'` |
785785
`_model_module_version` | string | `'1.5.0'` |
786786
`_model_name` | string | `'PlayModel'` |
787-
`_repeat` | boolean | `false` | Whether the control will repeat in a continous loop.
788787
`_view_module` | string | `'@jupyter-widgets/controls'` |
789788
`_view_module_version` | string | `'1.5.0'` |
790789
`_view_name` | string | `'PlayView'` |
@@ -795,6 +794,7 @@ Attribute | Type | Default | Help
795794
`max` | number (integer) | `100` | Max value
796795
`min` | number (integer) | `0` | Min value
797796
`playing` | boolean | `false` | Whether the control is currently playing.
797+
`repeat` | boolean | `false` | Whether the control will repeat in a continous loop.
798798
`show_repeat` | boolean | `true` | Show the repeat toggle button in the widget.
799799
`step` | number (integer) | `1` | Increment step
800800
`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)