Skip to content

Commit 1d43678

Browse files
authored
Merge pull request #1597 from romanroibu/fix-plugin-custom-naming
Fix plugin custom naming
2 parents eb25de8 + 1070142 commit 1d43678

File tree

9 files changed

+51
-15
lines changed

9 files changed

+51
-15
lines changed

pupil_src/shared_modules/blink_detection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ class Blink_Detection(Analysis_Plugin_Base):
4747
icon_chr = chr(0xE81A)
4848
icon_font = "pupil_icons"
4949

50+
@classmethod
51+
def parse_pretty_class_name(cls) -> str:
52+
return "Blink Detector"
53+
5054
def __init__(
5155
self,
5256
g_pool,

pupil_src/shared_modules/eye_movement/eye_movement_detector_base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@
1414
class Eye_Movement_Detector_Base(Analysis_Plugin_Base):
1515
icon_chr = chr(0xEC03)
1616
icon_font = "pupil_icons"
17+
@classmethod
18+
19+
def parse_pretty_class_name(cls) -> str:
20+
return "Eye Movement Detector"

pupil_src/shared_modules/fixation_detector.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ class Fixation_Detector_Base(Analysis_Plugin_Base):
5353
icon_chr = chr(0xEC03)
5454
icon_font = "pupil_icons"
5555

56+
@classmethod
57+
def parse_pretty_class_name(cls) -> str:
58+
return "Fixation Detector"
59+
5660

5761
def fixation_from_data(dispersion, method, base_data, timestamps=None):
5862
norm_pos = np.mean([gp["norm_pos"] for gp in base_data], axis=0).tolist()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
(*)~---------------------------------------------------------------------------
3+
Pupil - eye tracking platform
4+
Copyright (C) 2012-2019 Pupil Labs
5+
6+
Distributed under the terms of the GNU
7+
Lesser General Public License (LGPL v3.0).
8+
See COPYING and COPYING.LESSER for license details.
9+
---------------------------------------------------------------------------~(*)
10+
"""
11+
12+
from observable import Observable
13+
from plugin import Plugin
14+
15+
16+
class Head_Pose_Tracker_Base(Plugin, Observable):
17+
18+
icon_chr = chr(0xEC07)
19+
icon_font = "pupil_icons"
20+
21+
@classmethod
22+
def parse_pretty_class_name(cls) -> str:
23+
return "Head Pose Tracker"

pupil_src/shared_modules/head_pose_tracker/offline_head_pose_tracker.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,18 @@
1414
import csv_utils
1515
import player_methods as pm
1616
from head_pose_tracker import ui as plugin_ui, controller, storage
17-
from observable import Observable
18-
from plugin import Plugin
1917
from plugin_timeline import PluginTimeline
2018
from tasklib.manager import PluginTaskManager
2119

20+
from .base_head_pose_tracker import Head_Pose_Tracker_Base
2221

23-
class Offline_Head_Pose_Tracker(Plugin, Observable):
22+
23+
class Offline_Head_Pose_Tracker(Head_Pose_Tracker_Base):
2424
"""
2525
This plugin tracks the pose of the scene camera based on fiducial markers in the
2626
environment.
2727
"""
2828

29-
icon_chr = chr(0xEC07)
30-
icon_font = "pupil_icons"
31-
3229
def __init__(self, g_pool):
3330
super().__init__(g_pool)
3431

pupil_src/shared_modules/head_pose_tracker/online_head_pose_tracker.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,17 @@
1010
"""
1111

1212
from head_pose_tracker import ui as plugin_ui, controller, storage
13-
14-
from observable import Observable
15-
from plugin import Plugin
1613
from tasklib.manager import PluginTaskManager
1714

15+
from .base_head_pose_tracker import Head_Pose_Tracker_Base
16+
1817

19-
class Online_Head_Pose_Tracker(Plugin, Observable):
18+
class Online_Head_Pose_Tracker(Head_Pose_Tracker_Base):
2019
"""
2120
This plugin tracks the pose of the scene camera based on fiducial markers in the
2221
environment.
2322
"""
2423

25-
icon_chr = chr(0xEC07)
26-
icon_font = "pupil_icons"
27-
2824
def __init__(
2925
self,
3026
g_pool,

pupil_src/shared_modules/plugin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ def base_class_name(self):
240240

241241
@property
242242
def pretty_class_name(self):
243-
return self.class_name.replace("_", " ")
243+
return self.__class__.parse_pretty_class_name()
244+
245+
@classmethod
246+
def parse_pretty_class_name(cls) -> str:
247+
return cls.__name__.replace("_", " ")
244248

245249
def add_menu(self):
246250
"""

pupil_src/shared_modules/plugin_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def getter():
6060

6161
return ui.Switch(
6262
p.__name__,
63-
label=p.__name__.replace("_", " "),
63+
label=p.parse_pretty_class_name(),
6464
setter=setter,
6565
getter=getter,
6666
)

pupil_src/shared_modules/surface_tracker/surface_tracker.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ class Surface_Tracker(Plugin, metaclass=ABCMeta):
3838
icon_chr = chr(0xEC07)
3939
icon_font = "pupil_icons"
4040

41+
@classmethod
42+
def parse_pretty_class_name(cls) -> str:
43+
return "Surface Tracker"
44+
4145
def __init__(
4246
self,
4347
g_pool,

0 commit comments

Comments
 (0)