⚠️ **Requires `pyvista>=0.24`** ⚠️
This PR summarizes the ideas to implement …in `Brain`, previously called `_TimeViewer` (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-569378110):
<details>
<summary><b>Milestone 0.20</b></summary>
- [x] Get it working for VectorSourceEstimates (added in #7060)
- [x] Improve the [color cycle of point picking to allow point color re-use](https://github.com/mne-tools/mne-python/pull/7247#issuecomment-580763125) (#7516)
- [x] Check that the latest version 0.24 of pyvista is used (added in https://github.com/mne-tools/mne-python/pull/7506)
- [x] Put `time_viewer='auto'` and `show_traces='auto'` as the default for `stc.plot` / `plot_source_estimates` (added in https://github.com/mne-tools/mne-python/pull/7380)
- [x] Use the latest version 0.24 of pyvista (added in https://github.com/mne-tools/mne-python/pull/7458)
- [x] Use interpolation `nearest` as the default (suggested in https://github.com/mne-tools/mne-python/pull/7247#issuecomment-589447242, added in https://github.com/mne-tools/mne-python/pull/7257, reverted in 95ad0eec8a2e1e9c7c74e25852157e650aea7df0, added in https://github.com/mne-tools/mne-python/pull/7469)
- [x] Improve performance of interpolation (added in https://github.com/mne-tools/mne-python/pull/7257, reverted in 95ad0eec8a2e1e9c7c74e25852157e650aea7df0, added in https://github.com/mne-tools/mne-python/pull/7469)
- [x] Display current time with a line in `MplCanvas` (suggested in https://github.com/mne-tools/mne-python/pull/7247#issuecomment-582899553, added in https://github.com/mne-tools/mne-python/pull/7423)
- [x] Link the time plot of `MplCanvas` with the time slider (suggested in https://github.com/mne-tools/mne-python/pull/7247#issuecomment-582899553, added in https://github.com/mne-tools/mne-python/pull/7423)
- [x] Add a way to clear all the added points in `show_traces=True` mode (added in #7386)
</details>
<details>
<summary><b>Milestone 0.21</b></summary>
- [x] Set PyVista as the default 3d backend (done in https://github.com/mne-tools/mne-python/pull/8220)
- [x] Add reset key that resets camera all views and time to what they were at the beginning / viz init (suggested in https://github.com/mne-tools/mne-python/pull/8082#issuecomment-672948671, done in https://github.com/mne-tools/mne-python/pull/8125)
- [x] Link brains picking infos (suggested in https://github.com/mne-tools/mne-python/issues/7959, done in https://github.com/mne-tools/mne-python/pull/8112)
- [x] Link brains colorbar (suggested in https://github.com/mne-tools/mne-python/pull/7227#issuecomment-577361561, done in https://github.com/mne-tools/mne-python/pull/8126)
- [x] Link brains camera (suggested in https://github.com/mne-tools/mne-python/issues/7959, done in https://github.com/mne-tools/mne-python/pull/7962)
- [x] Remove `_MNE_BRAIN_TRACES_AUTO=false` and build the frontpage after https://github.com/mne-tools/mne-python/pull/7927 and https://github.com/mne-tools/mne-python/pull/7791 (suggested in https://github.com/mne-tools/mne-python/pull/7925#issuecomment-649584156; in progress in #7927)
- [x] Scrape traces (done in #7927)
- [x] Get picking infos with `get_picked_points()` (suggested in https://github.com/mne-tools/mne-python/issues/7959, done in https://github.com/mne-tools/mne-python/pull/7963)
- [x] Add `remove_labels` (suggested in https://github.com/mne-tools/mne-python/issues/7959, done in https://github.com/mne-tools/mne-python/pull/7964)
- [x] Add support for pinch-to-zoom (suggested in https://github.com/mne-tools/mne-python/issues/7162#issuecomment-604403711; done in https://github.com/pyvista/pyvistaqt/pull/26)
- [x] Fix sizing when TimeViewer is present (added in #7775)
- [x] Add `mne.surface` in the `public_modules` (suggested in https://github.com/mne-tools/mne-python/pull/7289#discussion_r375273059, added in https://github.com/mne-tools/mne-python/pull/7930)
- [x] Make the internal matplotlib figure to match `foreground/background` colors with the render view (suggested in https://github.com/mne-tools/mne-python/pull/7843#issuecomment-635384571; done in #7925)
- [x] Remove PySurfer from CircleCI (probably after changing `plot_parcellation.py` to just iterate over labels, see #7275, added in https://github.com/mne-tools/mne-python/pull/7659, https://github.com/mne-tools/mne-python/pull/7695, https://github.com/mne-tools/mne-python/pull/7702)
- [x] Improve toolbar icon consistency and resolution (suggested in https://github.com/mne-tools/mne-python/pull/7612#issuecomment-614703740, added in https://github.com/mne-tools/mne-python/pull/7698)
- [x] Use button widgets (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-569346780, merged [upstream](https://github.com/pyvista/pyvista/pull/528), proof of concept in https://github.com/mne-tools/mne-python/pull/7200, limitations encountered in https://github.com/mne-tools/mne-python/pull/7200#issuecomment-574273958) or `vtkPlaybackWidget` for Play/Pause control of the playback, added in https://github.com/mne-tools/mne-python/pull/7589)
- [x] Add a way to create a movie/GIF (added in https://github.com/mne-tools/mne-python/pull/7257, reverted in 95ad0eec8a2e1e9c7c74e25852157e650aea7df0, added in https://github.com/mne-tools/mne-python/pull/7574)
- [x] Update `latest.inc` and `plot_visualize_stc` to mention `save_movie()` (suggested in https://github.com/mne-tools/mne-python/pull/7257#pullrequestreview-374179244, added in https://github.com/mne-tools/mne-python/pull/7257, reverted in 95ad0eec8a2e1e9c7c74e25852157e650aea7df0, added in in https://github.com/mne-tools/mne-python/pull/7574)
- [x] Use a progress bar during movie saving (suggested in https://github.com/mne-tools/mne-python/pull/7257#discussion_r389260208, added in https://github.com/mne-tools/mne-python/pull/7257, reverted in 95ad0eec8a2e1e9c7c74e25852157e650aea7df0, added in https://github.com/mne-tools/mne-python/pull/7612)
- [x] Improve performance by using directly the widget representation instead of widget name or use `pass_widget` option to widget callback (added in https://github.com/mne-tools/mne-python/pull/7227)
</details>
<details>
<summary><b>Milestone 0.22</b></summary>
- [x] Fix colorbar representation with `transparent=True`, should alpha blend fmin->fmid with `brain_color` (added in https://github.com/mne-tools/mne-python/pull/8643)
- [x] Fix memory problems (#8399, #8379, #8427, #8575)
- [x] Merge "_TimeViewer" with `_Brain` (added in https://github.com/mne-tools/mne-python/pull/8352)
</details>
<details>
<summary><b>Milestone 0.23</b></summary>
- [x] Get jupyter notebook integration working properly with multi-views and time course plotting/clicking (partially solved by https://github.com/mne-tools/mne-python/pull/7758, added in in https://github.com/mne-tools/mne-python/pull/8503)
- [x] Add brain silhouette (added in https://github.com/mne-tools/mne-python/pull/8771)
- [x] Add better intructions to integrate in `Report` (added in https://github.com/mne-tools/mne-python/pull/8730)
- [x] Add shorcuts to rotate the camera and shift time (added in https://github.com/mne-tools/mne-python/pull/8792)
- [x] Widget migration from VTK to Qt/Jupyter Widgets (added in https://github.com/mne-tools/mne-python/pull/8862)
- [x] Light/Dark theme switcher (suggested in https://github.com/mne-tools/mne-python/pull/9000#issuecomment-791557878, added in https://github.com/mne-tools/mne-python/pull/9149)
</details>
<details>
<summary><b>Milestone 1.0</b></summary>
</details>
<details open>
<summary><b>Milestone 1.1</b></summary>
- [ ] add a `color` parameter to `add_sensors()` to set channels color (suggested in [mne.discourse.group](https://mne.discourse.group/t/setting-channels-colors-with-add-sensors-mne-viz-plot-alignment/4014))
- [ ] Interactive sensor-level field patterns browser (suggested in https://github.com/mne-tools/mne-python/issues/8382#event-3892037680, work in progress in https://github.com/mne-tools/mne-python/pull/8803)
- [ ] Interface for drawing ROIs using the mouse
- [ ] Move the vertexId/MNI from the legend to the status bar (suggested in https://github.com/mne-tools/mne-python/pull/8792#issuecomment-767898353)
- [ ] Fix ctrl-C pressing during generation of movies -- should abort generation, currently sometimes just stops a given VTK render (caught by vtkRenderWindowInteractor) sometimes stops the screenshot generation at our end but still saves a movie, etc.
- [ ] Fix multi-window memory problems (#8241, #8808), macos failures (https://github.com/mne-tools/mne-python/pull/8611#issuecomment-739806982, #8619)
- [ ] Change the theme with `QEvent.PaletteChange` (suggested in https://github.com/mne-tools/mne-python/issues/9182)
- [ ] Add support for shadows (suggested in https://github.com/mne-tools/mne-python/issues/7162#issuecomment-813504371)
</details>
<details>
<summary><b>Done</b></summary>
- [x] Unnecessary updates of Brain (reported in https://github.com/mne-tools/mne-python/issues/8986; fixed in #8246)
- [x] Reduce pyvista viz test time (suggested in https://github.com/mne-tools/mne-python/pull/7726#issuecomment-624046382, https://github.com/mne-tools/mne-python/issues/8242; done in #8246)
- [x] Lower the CPU usage (done in #7517)
- [x] Refresh slider style (done in https://github.com/mne-tools/mne-python/pull/7509)
- [x] Avoid the confusion between the default pyvista cell picking and the in `_TimeViewer` (suggested in https://github.com/mne-tools/mne-python/pull/7247#issuecomment-589599734)
- [x] Vertex picking -> time course (suggested in #7235, added in #7247)
- [x] Tag a stable version of PyVista to use with `_TimeViewer` (added in https://github.com/mne-tools/mne-python/pull/7318))
- [x] Add a legend/help (suggested in https://github.com/mne-tools/mne-python/issues/7268#issuecomment-580158431, added in https://github.com/mne-tools/mne-python/pull/7305)
- [x] Switch from `time_actor` to `time_slider_title` to allow scaling with the window (added in https://github.com/mne-tools/mne-python/pull/7263)
- [x] Use a `contextmanager` for tests using widgets (suggested in https://github.com/mne-tools/mne-python/pull/7276#issuecomment-581346281, added in #7280)
- [x] Improve documentation about `hemi` (suggested in https://github.com/mne-tools/mne-python/issues/7250#issuecomment-578122285, added in https://github.com/mne-tools/mne-python/pull/7256)
- [x] Allow fmin, fmid, and fmax to take on all data values, and bump the scalar range while interacting with the slider as necessary (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-571636885, added in https://github.com/mne-tools/mne-python/pull/7188)
- [x] Add a `fscale` slider (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-569002405, added in 068654f5a4967d9505163f480792cf5ee5022709)
- [x] Add support for `smoothing=nearest` (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-569455048, added in https://github.com/mne-tools/mne-python/pull/7191)
- [x] Use vertical orientation for the scalarbar (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-568758879, added in 3bbc6c29f67f70e594b8fbbf8a0be2f0a30fc9bd)
- [x] Use text slider widget (merged [upstream](https://github.com/pyvista/pyvista/pull/518), added in https://github.com/mne-tools/mne-python/pull/7186)
- [x] Use PySurfer-like time dilation (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-569346365, added in https://github.com/mne-tools/mne-python/pull/7200)
- [x] Bring colorbar values auto-scaling (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-569261106, added in https://github.com/mne-tools/mne-python/pull/7218, fixed in https://github.com/mne-tools/mne-python/pull/7226)
- [x] Add support for `hemi=split` (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-569346365, added in https://github.com/mne-tools/mne-python/pull/7219)
- [x] Link brains timeline (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-569415964, added in https://github.com/mne-tools/mne-python/pull/7227)
</details>
<details open>
<summary><b>Bug</b></summary>
- [ ] The window title bar does not follow the theme (reported in https://github.com/mne-tools/mne-python/issues/9182)
- [ ] Unexpected behaviour with shortcuts (reported in https://github.com/mne-tools/mne-python/pull/8792#issuecomment-770160715)
- [ ] The main window opens in the background in `jupyter qtconsole` (reported in https://github.com/mne-tools/mne-python/pull/7305#issuecomment-585748906, https://github.com/mne-tools/mne-python/issues/7162#issuecomment-585889205)
- [x] Detect no-opengl to avoid crash (reported in https://github.com/mne-tools/mne-python/issues/9333, fixed in https://github.com/pyvista/pyvista/pull/2250)
- [x] Fix off-by-one in `screenshot(time_viewer=True)` (reported in https://github.com/mne-tools/mne-python/issues/9336, https://github.com/mne-tools/mne-python/pull/9351)
- [x] Flatmap are not compatible with `hemi=both` (reported in https://github.com/mne-tools/mne-python/issues/9306, #9315)
- [x] Unify sliders and combo boxes to use period instead of comma (reported in https://github.com/mne-tools/mne-python/pull/9126#issuecomment-801725029, fixed in https://github.com/mne-tools/mne-python/pull/9179)
- [x] Wrong color with `add_label` (reported in https://github.com/mne-tools/mne-python/issues/8815#issue-797593479, fixed in https://github.com/mne-tools/mne-python/pull/8820)
- [x] There are visual artifacts on overlapping surfaces on the brain (reported in https://github.com/mne-tools/mne-python/issues/7599, fixed in https://github.com/mne-tools/mne-python/pull/8576)
- [x] The camera is reset too often causing the brain to "bounce" (fixed by https://github.com/mne-tools/mne-python/pull/8572)
- [x] The glyphs colormap are not updated interactively (reported in https://github.com/mne-tools/mne-python/pull/7843#issuecomment-635395395; done in #7934)
- [x] The parameter `foreground` is not supported in `_Brain` (reported in https://github.com/mne-tools/mne-python/issues/7842; done in https://github.com/mne-tools/mne-python/pull/7843)
- [x] There is an unnecessary window title decoration bar on macOS (reported in https://github.com/mne-tools/mne-python/issues/7316)
- [x] The `focalpoint` when `hemi=both` should be between the hemispheres (suggested in https://github.com/mne-tools/mne-python/pull/7247#issuecomment-582899553, added in https://github.com/mne-tools/mne-python/pull/7390)
- [x] The `title` parameter is not taken into account (reported in https://github.com/mne-tools/mne-python/issues/7162#issuecomment-594536145, fixed in https://github.com/mne-tools/mne-python/pull/7382 and https://github.com/mne-tools/mne-python/pull/7396)
- [x] The slider handles when `hemi=both` overlap (reported in https://github.com/mne-tools/mne-python/pull/7247#issuecomment-588279423, fixed in https://github.com/mne-tools/mne-python/pull/7383)
- [x] The `initial_time` is not taken into account (reported in https://github.com/mne-tools/mne-python/issues/7379 added in https://github.com/mne-tools/mne-python/pull/7381)
- [x] `dorsal` view causes the `_Brain` object to disappear (reported in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-568735444, fixed in https://github.com/mne-tools/mne-python/pull/7187)
- [x] The colorbar labels are not updated when the range is modified (fixed in a70b992f4a1b1de0a753f7e36bd9656d1ea4f1df)
</details>
<details open>
<summary><b>HARD</b></summary>
* Use slider with multiple handles (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-571665347 and https://github.com/mne-tools/mne-python/pull/7153#issuecomment-571667909, prototype available on [gist](https://gist.github.com/GuillaumeFavelier/ee40c130b7bbf65e2877a0ef24b2d8eb))
* Improve help window UX (suggested in https://github.com/mne-tools/mne-python/pull/7305#issuecomment-585814805)
* Put label of the orientation slider above the bar (suggested in https://github.com/mne-tools/mne-python/pull/7153#issuecomment-572004994, prototype available on https://github.com/mne-tools/mne-python/pull/7211)
</details>
<details>
<summary><b>Mockup</b></summary>
From https://github.com/mne-tools/mne-python/pull/7153#issuecomment-569315991:
![image](https://user-images.githubusercontent.com/18143289/71541855-556c1500-295f-11ea-8a37-08641873a7d1.png)
</details>
<details>
<summary><b>Progress</b></summary>
From `plot_visualize_stc.py`:
![2020-01-16_1920x1080](https://user-images.githubusercontent.com/18143289/72526825-92913c00-3867-11ea-94ad-607e86790d38.png)
![output](https://user-images.githubusercontent.com/18143289/72527340-d5074880-3868-11ea-8e39-0f4478b600f1.gif)
![output](https://user-images.githubusercontent.com/18143289/72621282-3ef32100-3941-11ea-82d4-43cff4638910.gif)
![output](https://user-images.githubusercontent.com/18143289/72729544-a4d4e800-3b8f-11ea-9cdc-838a061bd103.gif)
![73956703-9e6f9b80-4905-11ea-854d-39d02fec4da9](https://user-images.githubusercontent.com/18143289/75960078-b82ddf80-5ebf-11ea-91ef-f659564962a1.gif)
![output](https://user-images.githubusercontent.com/18143289/76419950-904be980-63a1-11ea-9028-efe29a459dfd.gif)
![output](https://user-images.githubusercontent.com/18143289/78890306-aa8eeb00-7a65-11ea-8150-2a64fc695f75.gif)
![output](https://user-images.githubusercontent.com/18143289/87767443-f7c7e900-c81a-11ea-8f35-8bbebb69db22.gif)
https://user-images.githubusercontent.com/18143289/103798907-a7ec1100-504a-11eb-8d45-f775836cbb9c.mp4
![image](https://user-images.githubusercontent.com/18143289/115887141-ee2a7c00-a451-11eb-8611-3cc509bed111.png)
</details>
<details open>
<summary><b>Current status</b></summary>
https://user-images.githubusercontent.com/18143289/116316751-af2e5a80-a7b2-11eb-9f83-bf81cc07a3e6.mp4
</details>