@@ -65,15 +65,15 @@ async def open(
65
65
66
66
# add image panel
67
67
self .imageLayout = QtWidgets .QVBoxLayout (self .tabImage )
68
- if isinstance (self .module , IData ):
69
- self .imageView = QFitsWidget ()
70
- self .imageLayout .addWidget (self .imageView )
71
- elif isinstance (self .module , ISpectrograph ):
68
+ if isinstance (self .module , ISpectrograph ):
72
69
self .figure , self .ax = plt .subplots ()
73
70
self .canvas = FigureCanvas (self .figure )
74
71
self .plotTools = NavigationToolbar2QT (self .canvas , self .tabImage )
75
72
self .imageLayout .addWidget (self .plotTools )
76
73
self .imageLayout .addWidget (self .canvas )
74
+ elif isinstance (self .module , IData ):
75
+ self .imageView = QFitsWidget ()
76
+ self .imageLayout .addWidget (self .imageView )
77
77
else :
78
78
raise ValueError ("Unknown type" )
79
79
@@ -90,17 +90,15 @@ async def grab_data(self, broadcast: bool, image_type: ImageType = ImageType.OBJ
90
90
# expose
91
91
if isinstance (self .module , IData ):
92
92
filename = await self .module .grab_data (broadcast = broadcast )
93
- elif isinstance (self .module , ISpectrograph ):
94
- filename = await self .module .grab_data (broadcast = broadcast )
95
93
else :
96
94
raise ValueError ("Unknown type" )
97
95
98
96
# if we're not broadcasting the filename, we need to signal it manually
99
97
if not broadcast :
100
- if isinstance (self .module , IData ):
101
- await self ._on_new_data (NewImageEvent (filename , image_type ), cast (Proxy , self .module ).name )
102
- elif isinstance (self .module , ISpectrograph ):
98
+ if isinstance (self .module , ISpectrograph ):
103
99
await self ._on_new_data (NewSpectrumEvent (filename ), cast (Proxy , self .module ).name )
100
+ elif isinstance (self .module , IData ):
101
+ await self ._on_new_data (NewImageEvent (filename , image_type ), cast (Proxy , self .module ).name )
104
102
else :
105
103
raise ValueError ("Unknown type" )
106
104
@@ -112,10 +110,10 @@ def plot(self) -> None:
112
110
if self .data is None :
113
111
return
114
112
115
- if isinstance (self .module , IData ):
116
- self .imageView .display (self .data [0 ])
117
- elif isinstance (self .module , ISpectrograph ):
113
+ if isinstance (self .module , ISpectrograph ):
118
114
self ._plot_spectrum ()
115
+ elif isinstance (self .module , IData ):
116
+ self .imageView .display (self .data [0 ])
119
117
120
118
def _plot_spectrum (self ) -> None :
121
119
"""Plot spectrum."""
0 commit comments