Skip to content

Conversation

@larsoner
Copy link
Member

Alternative to #7518.

I think we should show the (incorrectly-named) _TimeViewer even if there is a single time point because it shows useful controls like clim, view, etc. (and others if we add them later). This hides the playback speed and time slider as well.

@larsoner larsoner added this to the 0.20 milestone Mar 26, 2020
@codecov
Copy link

codecov bot commented Mar 26, 2020

Codecov Report

Merging #7520 into master will decrease coverage by 0.00%.
The diff coverage is 65.62%.

@@            Coverage Diff             @@
##           master    #7520      +/-   ##
==========================================
- Coverage   90.13%   90.12%   -0.01%     
==========================================
  Files         452      452              
  Lines       82947    82987      +40     
  Branches    13113    13117       +4     
==========================================
+ Hits        74762    74792      +30     
- Misses       5350     5361      +11     
+ Partials     2835     2834       -1     

@larsoner
Copy link
Member Author

Pushed a commit to fix the PyQt-abort-on-error problem

@GuillaumeFavelier
Copy link
Contributor

How do we select the functions wrapped by safe_event? Because I would like to suggest self.play() as well.

@larsoner
Copy link
Member Author

In principle, anything that could cause an error should be guarded. But in the special case of play we probably want to do more, because we should stop the playback, otherwise the user will get spammed with messages

@larsoner
Copy link
Member Author

@GuillaumeFavelier @agramfort this should be ready for review/merge now

Copy link
Member

@agramfort agramfort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GuillaumeFavelier please merge if you're happy. You know this code better than me

Copy link
Contributor

@GuillaumeFavelier GuillaumeFavelier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @larsoner, I tested it and it works even when only one time step is available. We should think about a better name for this wrapper 😄

I think a bit more work is needed in order to display the final (updated) state of _TimeViewer when it's ready only at the end. For instance, the sliders are displayed as soon as they are added. We don't have the option to add them to the scene while hidden and just toggle the interface for example. We can take care of that in another PR, I think it was reported somewhere.

@GuillaumeFavelier GuillaumeFavelier merged commit 1e882d0 into mne-tools:master Mar 27, 2020
@larsoner larsoner deleted the fix-circle branch March 27, 2020 11:44
@larsoner
Copy link
Member Author

Maybe it would require a PyVista PR? Or is there some general VTK renderer update blocking that we could use?

@GuillaumeFavelier
Copy link
Contributor

I think a trick similar to https://github.com/mne-tools/mne-python/blob/master/mne/viz/_brain/_brain.py#L947-L963 would be necessary where we configure the representation of the widget to be hidden by default. This would require a PR on pyvista.

is there some general VTK renderer update blocking

hm... I don't know any. I tried hiding the window (or interactor) and display at the end but although the window reappears ready, there is the fact that it disappears out of the blue.

@GuillaumeFavelier
Copy link
Contributor

GuillaumeFavelier commented Mar 27, 2020

Maybe the rendering thread could be paused...
EDIT: it won't work because update() is called at multiple places

Reference: https://github.com/pyvista/pyvista/blob/master/pyvista/plotting/qt_plotting.py#L449

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants