def makeIm(): spectroWidth=1000 spectroHeight=1000 a= np.random.random(spectroHeight * spectroWidth) * 255 a=np.reshape(a, (spectroHeight, spectroWidth)) a=np.require(a, np.uint8, 'C') COLORTABLE=[] for i in range(256): COLORTABLE.append(QtGui.qRgb(old_div(i,4),i,old_div(i,2))) a=np.roll(a, -5) QI = QtGui.QImage(a.data, spectroWidth, spectroHeight, QtGui.QImage.Format_Indexed8) QI.setColorTable(COLORTABLE) return QI
def init(self, name): self.FS = 250 self.name=name epoch_samples = int(self.FS * self.epoch) self.signal = Signal(buffer_size=epoch_samples) self.passfail = Signal() self.threshold = 1.0 self.high_threshold = 0.0 self.calc_cnt = 0 self.bar = QtGui.QProgressBar(orientation=QtCore.Qt.Vertical) self.slider = QtGui.QSlider() self.slider.setRange(0, 17) self.bar.setRange(0, 17) self.pass_palette = self.bar.palette() if isinstance(self.input.color, QtGui.QColor): self.color = self.input.color else: self.color = QtGui.QColor(QtGui.qRgb(*self.input.color)) self.bar.setStyleSheet(""" QProgressBar::chunk { background: red; } QProgressBar::chunk[pass='******'] { background: %s ; } """ % self.color.name()) self.button = QtGui.QPushButton("config") self.button.clicked.connect(self.configure_traits)