Skip to content

Commit bdcece5

Browse files
Refactor
1 parent 874e8e1 commit bdcece5

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

mne/viz/_brain/_brain.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -3065,9 +3065,6 @@ def _post_setup(unused):
30653065
dialog.finished.connect(_post_setup)
30663066
return dialog
30673067
else:
3068-
from PyQt5.QtCore import Qt
3069-
from PyQt5.QtGui import QCursor
3070-
30713068
def frame_callback(frame, n_frames):
30723069
if frame == n_frames:
30733070
# On the ImageIO step
@@ -3094,7 +3091,8 @@ def frame_callback(frame, n_frames):
30943091

30953092
# set cursor to busy
30963093
default_cursor = self._renderer._window_get_cursor()
3097-
self._renderer._window_set_cursor(QCursor(Qt.WaitCursor))
3094+
self._renderer._window_set_cursor(
3095+
self._renderer._window_new_cursor("WaitCursor"))
30983096

30993097
try:
31003098
self._save_movie(

mne/viz/backends/_abstract.py

+4
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,10 @@ def _window_get_cursor(self):
789789
def _window_set_cursor(self, cursor):
790790
pass
791791

792+
@abstractmethod
793+
def _window_new_cursor(self, name):
794+
pass
795+
792796
@abstractmethod
793797
def _window_ensure_minimum_sizes(self):
794798
pass

mne/viz/backends/_notebook.py

+3
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,9 @@ def _window_get_cursor(self):
282282
def _window_set_cursor(self, cursor):
283283
pass
284284

285+
def _window_new_cursor(self, name):
286+
pass
287+
285288
@contextmanager
286289
def _window_ensure_minimum_sizes(self):
287290
yield

mne/viz/backends/_qt.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pyvistaqt.plotting import FileDialog
1515

1616
from PyQt5.QtCore import Qt, pyqtSignal, QLocale
17-
from PyQt5.QtGui import QIcon, QImage, QPixmap
17+
from PyQt5.QtGui import QIcon, QImage, QPixmap, QCursor
1818
from PyQt5.QtWidgets import (QComboBox, QDockWidget, QDoubleSpinBox, QGroupBox,
1919
QHBoxLayout, QLabel, QToolButton, QMenuBar,
2020
QSlider, QSpinBox, QVBoxLayout, QWidget,
@@ -403,6 +403,9 @@ def _window_get_cursor(self):
403403
def _window_set_cursor(self, cursor):
404404
self._interactor.setCursor(cursor)
405405

406+
def _window_new_cursor(self, name):
407+
return QCursor(getattr(Qt, name))
408+
406409
@contextmanager
407410
def _window_ensure_minimum_sizes(self):
408411
sz = self.figure.store['window_size']

0 commit comments

Comments
 (0)