def on_activate(self):
""" Definition and initialisation of the GUI.
"""
self._spectrum_logic = self.get_connector('spectrumlogic1')
# setting up the window
self._mw = SpectrometerWindow()
self._mw.stop_diff_spec_Action.setEnabled(False)
self._mw.resume_diff_spec_Action.setEnabled(False)
# giving the plots names allows us to link their axes together
self._pw = self._mw.plotWidget # pg.PlotWidget(name='Counter1')
self._plot_item = self._pw.plotItem
# create a new ViewBox, link the right axis to its coordinate system
self._right_axis = pg.ViewBox()
self._plot_item.showAxis('right')
self._plot_item.scene().addItem(self._right_axis)
self._plot_item.getAxis('right').linkToView(self._right_axis)
self._right_axis.setXLink(self._plot_item)
# create a new ViewBox, link the right axis to its coordinate system
self._top_axis = pg.ViewBox()
self._plot_item.showAxis('top')
self._plot_item.scene().addItem(self._top_axis)
self._plot_item.getAxis('top').linkToView(self._top_axis)
self._top_axis.setYLink(self._plot_item)
self._top_axis.invertX(b=True)
# handle resizing of any of the elements
self._pw.setLabel('left', 'Fluorescence', units='counts/s')
self._pw.setLabel('right', 'Number of Points', units='#')
self._pw.setLabel('bottom', 'Wavelength', units='nm')
self._pw.setLabel('top', 'Relative Frequency', units='Hz')
self._mw.rec_single_spectrum_Action.triggered.connect(self.record_single_spectrum)
self._mw.start_diff_spec_Action.triggered.connect(self.start_differential_measurement)
self._mw.stop_diff_spec_Action.triggered.connect(self.stop_differential_measurement)
self._mw.resume_diff_spec_Action.triggered.connect(self.resume_differential_measurement)
self._mw.save_spectrum_Action.triggered.connect(self.save_spectrum_data)
self._spectrum_logic.sig_specdata_updated.connect(self.updateData)
self._mw.show()
# Create an empty plot curve to be filled later, set its pen
self._curve1 = self._pw.plot()
self._curve1.setPen(palette.c2, width=2)
self._save_PNG = True
评论列表
文章目录