55# Copyright the MNE-Python contributors.
66
77import warnings
8- from abc import ABC , abstractclassmethod , abstractmethod
8+ from abc import ABC , abstractmethod
99
1010from ..ui_events import TimeChange , publish
1111
@@ -28,7 +28,8 @@ class Figure3D(ABC):
2828 # document the class more easily, as we don't have to say what all the
2929 # params are in public docs.
3030
31- @abstractclassmethod
31+ @classmethod
32+ @abstractmethod
3233 def _init (
3334 self ,
3435 fig = None ,
@@ -55,7 +56,8 @@ def plotter(self):
5556
5657
5758class _AbstractRenderer (ABC ):
58- @abstractclassmethod
59+ @classmethod
60+ @abstractmethod
5961 def __init__ (
6062 self ,
6163 fig = None ,
@@ -75,22 +77,26 @@ def __init__(
7577 def _kind (self ):
7678 pass
7779
78- @abstractclassmethod
80+ @classmethod
81+ @abstractmethod
7982 def subplot (self , x , y ):
8083 """Set the active subplot."""
8184 pass
8285
83- @abstractclassmethod
86+ @classmethod
87+ @abstractmethod
8488 def scene (self ):
8589 """Return scene handle."""
8690 pass
8791
88- @abstractclassmethod
92+ @classmethod
93+ @abstractmethod
8994 def set_interaction (self , interaction ):
9095 """Set interaction mode."""
9196 pass
9297
93- @abstractclassmethod
98+ @classmethod
99+ @abstractmethod
94100 def legend (self , labels , border = False , size = 0.1 , face = "triangle" , loc = "upper left" ):
95101 """Add a legend to the scene.
96102
@@ -118,7 +124,8 @@ def legend(self, labels, border=False, size=0.1, face="triangle", loc="upper lef
118124 """
119125 pass
120126
121- @abstractclassmethod
127+ @classmethod
128+ @abstractmethod
122129 def mesh (
123130 self ,
124131 x ,
@@ -197,7 +204,8 @@ def mesh(
197204 """
198205 pass
199206
200- @abstractclassmethod
207+ @classmethod
208+ @abstractmethod
201209 def contour (
202210 self ,
203211 surface ,
@@ -245,7 +253,8 @@ def contour(
245253 """
246254 pass
247255
248- @abstractclassmethod
256+ @classmethod
257+ @abstractmethod
249258 def surface (
250259 self ,
251260 surface ,
@@ -292,7 +301,8 @@ def surface(
292301 """
293302 pass
294303
295- @abstractclassmethod
304+ @classmethod
305+ @abstractmethod
296306 def sphere (
297307 self ,
298308 center ,
@@ -329,7 +339,8 @@ def sphere(
329339 """
330340 pass
331341
332- @abstractclassmethod
342+ @classmethod
343+ @abstractmethod
333344 def tube (
334345 self ,
335346 origin ,
@@ -383,7 +394,8 @@ def tube(
383394 """
384395 pass
385396
386- @abstractclassmethod
397+ @classmethod
398+ @abstractmethod
387399 def quiver3d (
388400 self ,
389401 x ,
@@ -473,7 +485,8 @@ def quiver3d(
473485 """
474486 pass
475487
476- @abstractclassmethod
488+ @classmethod
489+ @abstractmethod
477490 def text2d (self , x_window , y_window , text , size = 14 , color = "white" ):
478491 """Add 2d text in the scene.
479492
@@ -496,7 +509,8 @@ def text2d(self, x_window, y_window, text, size=14, color="white"):
496509 """
497510 pass
498511
499- @abstractclassmethod
512+ @classmethod
513+ @abstractmethod
500514 def text3d (self , x , y , z , text , width , color = "white" ):
501515 """Add 2d text in the scene.
502516
@@ -519,7 +533,8 @@ def text3d(self, x, y, z, text, width, color="white"):
519533 """
520534 pass
521535
522- @abstractclassmethod
536+ @classmethod
537+ @abstractmethod
523538 def scalarbar (self , source , color = "white" , title = None , n_labels = 4 , bgcolor = None ):
524539 """Add a scalar bar in the scene.
525540
@@ -538,17 +553,20 @@ def scalarbar(self, source, color="white", title=None, n_labels=4, bgcolor=None)
538553 """
539554 pass
540555
541- @abstractclassmethod
556+ @classmethod
557+ @abstractmethod
542558 def show (self ):
543559 """Render the scene."""
544560 pass
545561
546- @abstractclassmethod
562+ @classmethod
563+ @abstractmethod
547564 def close (self ):
548565 """Close the scene."""
549566 pass
550567
551- @abstractclassmethod
568+ @classmethod
569+ @abstractmethod
552570 def set_camera (
553571 self ,
554572 azimuth = None ,
@@ -574,7 +592,8 @@ def set_camera(
574592 """
575593 pass
576594
577- @abstractclassmethod
595+ @classmethod
596+ @abstractmethod
578597 def screenshot (self , mode = "rgb" , filename = None ):
579598 """Take a screenshot of the scene.
580599
@@ -588,7 +607,8 @@ def screenshot(self, mode="rgb", filename=None):
588607 """
589608 pass
590609
591- @abstractclassmethod
610+ @classmethod
611+ @abstractmethod
592612 def project (self , xyz , ch_names ):
593613 """Convert 3d points to a 2d perspective.
594614
@@ -601,7 +621,8 @@ def project(self, xyz, ch_names):
601621 """
602622 pass
603623
604- @abstractclassmethod
624+ @classmethod
625+ @abstractmethod
605626 def remove_mesh (self , mesh_data ):
606627 """Remove the given mesh from the scene.
607628
@@ -619,7 +640,8 @@ def remove_mesh(self, mesh_data):
619640
620641
621642class _AbstractWidget (ABC ):
622- @abstractclassmethod
643+ @classmethod
644+ @abstractmethod
623645 def __init__ (self ):
624646 pass
625647
@@ -681,13 +703,15 @@ def _set_size(self, width=None, height=None):
681703
682704
683705class _AbstractLabel (_AbstractWidget ):
684- @abstractclassmethod
706+ @classmethod
707+ @abstractmethod
685708 def __init__ (self , value , center = False , selectable = False ):
686709 pass
687710
688711
689712class _AbstractText (_AbstractWidget ):
690- @abstractclassmethod
713+ @classmethod
714+ @abstractmethod
691715 def __init__ (self , value = None , placeholder = None , callback = None ):
692716 pass
693717
@@ -697,7 +721,8 @@ def _set_value(self, value):
697721
698722
699723class _AbstractButton (_AbstractWidget ):
700- @abstractclassmethod
724+ @classmethod
725+ @abstractmethod
701726 def __init__ (self , value , callback , icon = None ):
702727 pass
703728
@@ -711,7 +736,8 @@ def _set_icon(self, icon):
711736
712737
713738class _AbstractSlider (_AbstractWidget ):
714- @abstractclassmethod
739+ @classmethod
740+ @abstractmethod
715741 def __init__ (self , value , rng , callback , horizontal = True ):
716742 pass
717743
@@ -729,7 +755,8 @@ def _set_range(self, rng):
729755
730756
731757class _AbstractProgressBar (_AbstractWidget ):
732- @abstractclassmethod
758+ @classmethod
759+ @abstractmethod
733760 def __init__ (self , count ):
734761 pass
735762
@@ -739,7 +766,8 @@ def _increment(self):
739766
740767
741768class _AbstractCheckBox (_AbstractWidget ):
742- @abstractclassmethod
769+ @classmethod
770+ @abstractmethod
743771 def __init__ (self , value , callback ):
744772 pass
745773
@@ -753,7 +781,8 @@ def _get_checked(self):
753781
754782
755783class _AbstractSpinBox (_AbstractWidget ):
756- @abstractclassmethod
784+ @classmethod
785+ @abstractmethod
757786 def __init__ (self , value , rng , callback , step = None ):
758787 pass
759788
@@ -767,7 +796,8 @@ def _get_value(self):
767796
768797
769798class _AbstractComboBox (_AbstractWidget ):
770- @abstractclassmethod
799+ @classmethod
800+ @abstractmethod
771801 def __init__ (self , value , items , callback ):
772802 pass
773803
@@ -781,7 +811,8 @@ def _get_value(self):
781811
782812
783813class _AbstractRadioButtons (_AbstractWidget ):
784- @abstractclassmethod
814+ @classmethod
815+ @abstractmethod
785816 def __init__ (self , value , items , callback ):
786817 pass
787818
@@ -795,13 +826,15 @@ def _get_value(self):
795826
796827
797828class _AbstractGroupBox (_AbstractWidget ):
798- @abstractclassmethod
829+ @classmethod
830+ @abstractmethod
799831 def __init__ (self , name , items ):
800832 pass
801833
802834
803835class _AbstractFileButton (_AbstractWidget ):
804- @abstractclassmethod
836+ @classmethod
837+ @abstractmethod
805838 def __init__ (
806839 self ,
807840 callback ,
@@ -816,7 +849,8 @@ def __init__(
816849
817850
818851class _AbstractPlayMenu (_AbstractWidget ):
819- @abstractclassmethod
852+ @classmethod
853+ @abstractmethod
820854 def __init__ (self , value , rng , callback ):
821855 pass
822856
0 commit comments