# Disable Snapshot and Record push buttons in SequenceBrowserPlayWidget while recordning

**URL:** <https://discourse.slicer.org/t/disable-snapshot-and-record-push-buttons-in-sequencebrowserplaywidget-while-recordning/19711>\
**Category:** Development\
**Tags:** sequences\
**Created:** [September 16, 2021, 4:03pm UTC](https://discourse.slicer.org/t/disable-snapshot-and-record-push-buttons-in-sequencebrowserplaywidget-while-recordning/19711 "2021-09-16T16:03:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thibaut\_Faller](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/thibaut_faller/32/9663_2.png) [@Thibaut\_Faller](https://discourse.slicer.org/u/Thibaut_Faller)\
**Post date:** [September 16, 2021, 4:03pm UTC](https://discourse.slicer.org/t/disable-snapshot-and-record-push-buttons-in-sequencebrowserplaywidget-while-recordning/19711/1 "2021-09-16T16:03:23Z")

</div>

Hello,

I work on an application in which we use SequenceBrowserPlayWidget to browse sequences. We would like to disable Snapshot (pushButton\_Snapshot) and Record (pushButton\_VcrRecord) push buttons as we do not use them.  
However, in Modules/Loadable/Sequences/Widgets/qMRMLSequenceBrowserPlayWidget.cxx, these buttons are automatically set visible when a node is recording (L. 150-153).

Would it be possible to add a member variable (and the function to set it) to disable this behaviour ?

Thank you !

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 17, 2021, 12:51am UTC](https://discourse.slicer.org/t/disable-snapshot-and-record-push-buttons-in-sequencebrowserplaywidget-while-recordning/19711/2 "2021-09-17T00:51:31Z")

</div>

The record&snapshot buttons are automatically shown if recording is allowed for any of the sequence nodes. To disable recording for all sequences, you can call `sequenceBrowserNode.SetRecording(None, False)`.

---

<div class="post-metadata">

**Author:** ![Thibaut\_Faller](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/thibaut_faller/32/9663_2.png) [@Thibaut\_Faller](https://discourse.slicer.org/u/Thibaut_Faller)\
**Post date:** [September 17, 2021, 7:37am UTC](https://discourse.slicer.org/t/disable-snapshot-and-record-push-buttons-in-sequencebrowserplaywidget-while-recordning/19711/3 "2021-09-17T07:37:05Z")

</div>

Hello Andras,

Thank you very much Andras for your quick response !  
This command is, indeed, quite useful to disable recording for all sequences.

The point is, we are recording images, but the recording is not controlled through the SequenceBrowserPlayWidget. So, we need to have recording enabled for some sequences, but we would like not to show the recording and snapshot buttons meanwhile.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 17, 2021, 1:48pm UTC](https://discourse.slicer.org/t/disable-snapshot-and-record-push-buttons-in-sequencebrowserplaywidget-while-recordning/19711/4 "2021-09-17T13:48:12Z")

</div>

Yes, you could add an extra property to the widget (recordingEnabled) that would be required to be set to true to make the record buttons visible (in addition to having recordable sequences). This flag would not be saved into MRML, applied to other widgets, just used by that single widget. If you need any help with getting started with this then let us know. If you send us a pull request then we’ll integrate your changes and maintain it in Slicer core.

---

<div class="post-metadata">

**Author:** ![Thibaut\_Faller](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/thibaut_faller/32/9663_2.png) [@Thibaut\_Faller](https://discourse.slicer.org/u/Thibaut_Faller)\
**Post date:** [September 17, 2021, 2:03pm UTC](https://discourse.slicer.org/t/disable-snapshot-and-record-push-buttons-in-sequencebrowserplaywidget-while-recordning/19711/5 "2021-09-17T14:03:37Z")

</div>

Thank you ! I will try to make the corresponding changes; let you know if I need some help and send the pull request.

---

<div class="post-metadata">

**Author:** ![Thibaut\_Faller](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/thibaut_faller/32/9663_2.png) [@Thibaut\_Faller](https://discourse.slicer.org/u/Thibaut_Faller)\
**Post date:** [September 17, 2021, 3:48pm UTC](https://discourse.slicer.org/t/disable-snapshot-and-record-push-buttons-in-sequencebrowserplaywidget-while-recordning/19711/6 "2021-09-17T15:48:26Z")

</div>

An option would be to add a member boolean variable to the class, initially set to true to allow enabling the buttons, with two methods to set and get the value.

```auto
if (m_activateButtons)
  {
    d->pushButton_VcrRecord->setVisible(recordingAllowed);
    d->pushButton_VcrRecord->setEnabled(!playbackActive);
    d->pushButton_Snapshot->setVisible(recordingAllowed);
    d->pushButton_Snapshot->setEnabled(!playbackActive && !recordingActive);
  }

```

This member variable would be set in qMRMLSequenceBrowserPlayWidget.h.

What do you think about it ?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [September 17, 2021, 8:15pm UTC](https://discourse.slicer.org/t/disable-snapshot-and-record-push-buttons-in-sequencebrowserplaywidget-while-recordning/19711/7 "2021-09-17T20:15:51Z")

</div>

Sounds good. A few tips:

- The member variable name has to be `recordingControlsVisible` (since there is already `setRecordingEnabled` method).
- Make it a Qt property (by adding `Q_PROPERTY(bool recordingControlsVisible READ recordingControlsVisible WRITE setRecordingControlsVisible)`) so that you can enable/disable this property in Qt Designer.
- Whenever the value is changed then make sure the buttons are immediately shown/hidden as applicable (by calling `updateWidgetFromMRML()`)
- Change the logic in `updateWidgetFromMRML()` to make record&snapshot buttons visible if `recordingAllowed && d->recordingControlsVisible`

Thanks in advance, looking forward to getting your pull request.

---

<div class="post-metadata">

**Author:** ![Thibaut\_Faller](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/thibaut_faller/32/9663_2.png) [@Thibaut\_Faller](https://discourse.slicer.org/u/Thibaut_Faller)\
**Post date:** [September 20, 2021, 3:26pm UTC](https://discourse.slicer.org/t/disable-snapshot-and-record-push-buttons-in-sequencebrowserplaywidget-while-recordning/19711/8 "2021-09-20T15:26:49Z")

</div>

Thank you very much Andras for your tips, they were very useful !
