def __get_annotationparam(self, title, subtitle): param = AnnotationParam(_("Annotation"), icon="annotation.png") if title is not None: param.title = title if subtitle is not None: param.subtitle = subtitle return param
def deserialize(self, reader): """Deserialize object from HDF5 reader""" self.annotationparam = AnnotationParam(_("Annotation"), icon="annotation.png") reader.read('annotationparam', instance=self.annotationparam) self.annotationparam.update_annotation(self) self.shape.deserialize(reader) self.label.deserialize(reader)
def __init__(self, annotationparam=None): AbstractShape.__init__(self) assert self.LABEL_ANCHOR is not None self.shape = self.create_shape() self.label = self.create_label() self.area_computations_visible = True if annotationparam is None: self.annotationparam = AnnotationParam(_("Annotation"), icon="annotation.png") else: self.annotationparam = annotationparam self.annotationparam.update_annotation(self)
def setup_widget(self, title): self.plot = plt.CurvePlot(self, title=title, xunit='Hz', yunit='dB') self.curve_item = make.curve([], []) # set color to magenta color = QtGui.QColor(QtCore.Qt.magenta) color.setAlpha(150) self.curve_item.setPen(QtGui.QPen(color)) self.curve_item.setBrush(QtGui.QBrush(color)) self.plot.add_item(self.curve_item) a_param = AnnotationParam() a_param.title = 'Peak Value' self.peak_item = AnnotatedPoint(annotationparam=a_param) self.plot.add_item(self.peak_item) self.plot.set_antialiasing(True) self.plot.setCanvasBackground(QtCore.Qt.darkBlue) vlayout = QtWidgets.QVBoxLayout() vlayout.addWidget(self.plot) self.setLayout(vlayout) self.update_curve()