def label(self, axisValue): # print str(axisValue) if not self._plot._bPlotDatesXAxis: return Qwt.QwtText(str(int(axisValue))) else: remaindermsecs = axisValue/self._fs - int(axisValue) / self._fs qtime = self._timeFirst.addSecs(int(axisValue) / self._fs) qtime = qtime.addMSecs(1000*remaindermsecs+1) # print "value {0}, qtime {1}".format(int(axisValue),qTime) return Qwt.QwtText(qtime.toString("hh:mm"))
def ylabel(self, text=""): """ set the y axis label. The font is based on application font """ font = self._font_app font.setBold(True) qtext = Qwt.QwtText(text) qtext.setFont(font) self.setAxisTitle(Qwt.QwtPlot.yLeft, qtext)
def __init__(self, parent_name='', curve_type=None, x1=None, x2=None, y1=None, y2=None, s=''): self.id = AnnotationObject.newid() # information to be saved in annotation file self.__parent_name = parent_name self.__curve_type = curve_type self.x_from = x1 self.x_to = x2 self.yval1 = y1 self.yval2 = y2 self.valid = True # if a curve is valid and should be plotted self.text = Qwt.QwtText(self.text_wrap(str(s))) self.__too_small_limit = 0 self.font_app = QtGui.QFont() # QPen settings self.pen_def = Qt.QPen() self.pen_symbol = Qt.QPen() self.symbol = Qwt.QwtSymbol() self.__default_pen = Qt.QPen() self.color_highlight = Qt.Qt.darkMagenta
def text_wrap_evaluations(self, evals): """ This is inverse function to get_text() The input is 1 line string: initial_ctg:abnormal__neurology:brain injury The output is left aligned: initial_ctg: abnormal . neurology: brain injury . :param evals: string of evaluation separated by __ :return: """ # compute value for text padding (to be align on right) n = 0 for r in evals.split(self.sep): r = r.strip('\n') r = Qwt.QwtText(r) if n < r.textSize().width(): n = r.textSize().width() eval_list = list() for r in evals.split(self.sep): if r == '': continue r = r.strip('\n') s = r.split(self.sep_type_and_value) s = '{0}{1} {2}'.format(s[0], self.sep_type_and_value, s[1]) r = Qwt.QwtText(s) while r.textSize().width() < n: s += ' ' r = Qwt.QwtText(s) # to have correct alignment s += '.' eval_list.append(s) s = '\n'.join(eval_list) return s
def label(self, axis_value): s = QtCore.QString(str(int(axis_value))) # doplnuji string podle pozadovane sirky while self._fontMetrics.width(s) <= self._max_w: s = ' '+s # s = '{:>8}'.format(axis_value) # tohle nefunguje protoze mezera ma jinou sirku nez cislo # print self._fontMetrics.width(s) return Qwt.QwtText(s)