Skip to content

MRG: Refactor OFF_SCREEN variable#7276

Merged
larsoner merged 3 commits intomne-tools:masterfrom
GuillaumeFavelier:renderer_update_offscreen
Feb 3, 2020
Merged

MRG: Refactor OFF_SCREEN variable#7276
larsoner merged 3 commits intomne-tools:masterfrom
GuillaumeFavelier:renderer_update_offscreen

Conversation

@GuillaumeFavelier
Copy link
Copy Markdown
Contributor

@GuillaumeFavelier GuillaumeFavelier commented Feb 2, 2020

This PR prevents setting pyvista.OFF_SCREEN globally (i.e. in tests, ... etc) by managing a renderer MNE_3D_OFF_SCREEN variable instead.

Also, before #7266, the tests were done offscreen by default with _use_test_3d_backend() so this PR fixes this.

This variable is still set globally in _testing_context() (this one restores the original value) and in the doc which is fine by me.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 2, 2020

Codecov Report

Merging #7276 into master will increase coverage by 2.73%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #7276      +/-   ##
==========================================
+ Coverage   87.06%   89.79%   +2.73%     
==========================================
  Files         447      447              
  Lines       79824    80610     +786     
  Branches    12880    12882       +2     
==========================================
+ Hits        69496    72387    +2891     
+ Misses       7512     5390    -2122     
- Partials     2816     2833      +17

@GuillaumeFavelier GuillaumeFavelier changed the title Refactor OFF_SCREEN variable MRG: Refactor OFF_SCREEN variable Feb 2, 2020
@GuillaumeFavelier
Copy link
Copy Markdown
Contributor Author

What do you think @larsoner , @agramfort ?

@agramfort
Copy link
Copy Markdown
Member

@larsoner let us know what you think. I don't fully grasp the consequences of this but if it works and CIs are green it cannot be too bad :)

@GuillaumeFavelier
Copy link
Copy Markdown
Contributor Author

Actually it's fine to set it globally but we just have to remember to set the original value. My previous changes brought confusion/redundancy of two variables doing the same thing.

@GuillaumeFavelier
Copy link
Copy Markdown
Contributor Author

Makes me think that we can use a contextmanager for that.

@agramfort
Copy link
Copy Markdown
Member

agramfort commented Feb 3, 2020 via email

@GuillaumeFavelier
Copy link
Copy Markdown
Contributor Author

I would say it's good enough now. We can always make it nicer later.

@agramfort
Copy link
Copy Markdown
Member

@larsoner merge if you're happy

@GuillaumeFavelier GuillaumeFavelier mentioned this pull request Feb 3, 2020
86 tasks
Copy link
Copy Markdown
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

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

Indeed these should be contextmanagers so that we ensure that the state is restored even in the case of an error

@larsoner
Copy link
Copy Markdown
Member

larsoner commented Feb 3, 2020

(but we can do that in another PR, since it's not a problem with these changes specifically)

@larsoner larsoner merged commit 00476f8 into mne-tools:master Feb 3, 2020
@larsoner
Copy link
Copy Markdown
Member

larsoner commented Feb 3, 2020

Thanks @GuillaumeFavelier

AdoNunes pushed a commit to AdoNunes/mne-python that referenced this pull request Apr 6, 2020
* Refactor OFF_SCREEN variable

* Dont forget to restore original value
AdoNunes pushed a commit to AdoNunes/mne-python that referenced this pull request Apr 6, 2020
* Refactor OFF_SCREEN variable

* Dont forget to restore original value
@GuillaumeFavelier GuillaumeFavelier deleted the renderer_update_offscreen branch June 11, 2020 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants