def __init__( self, parent=None, waveforms=None, sorted=None, colors=None, show_button=True, plotParams=None, ): QWidget.__init__(self, parent) PlotBase.__init__(self, plotParams=plotParams) self.colors = colors self.spikeSortingWin = self.parent() mainLayout = QVBoxLayout() self.setLayout(mainLayout) #~ self.canvas = SimpleCanvasAndTool(orientation = Qt.Horizontal ) self.canvas = SimpleCanvas() self.fig = self.canvas.fig mainLayout.addWidget(self.canvas) if show_button: #~ but = QPushButton('',parent = self.canvas.canvas) but = QPushButton('', self.canvas) but.setIcon(QIcon(':/configure.png')) but.setGeometry(10, 10, 30, 30) self.canvas.stackUnder(but) self.connect(but, SIGNAL('clicked()'), self.changePlotOptions) self.trodness = None self.changeData(waveforms, sorted=sorted)
def __init__( self, parent=None, globalApplicationDict=None, show_tour=True, show_select_tools=False, plotParams=None, ): self.globalApplicationDict = globalApplicationDict self.plotParams = plotParams if self.plotParams is None: self.plotParams = ParamWidget(plotParamDefault).get_dict() self.show_tour = show_tour self.show_select_tools = show_select_tools QWidget.__init__(self, parent) self.spikeSortingWin = self.parent() mainLayout = QVBoxLayout() self.setLayout(mainLayout) h = QHBoxLayout() mainLayout.addLayout(h) self.widgetProjection = QWidget() v = QVBoxLayout() h.addLayout(v) self.scrollArea = QScrollArea() self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) #~ self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) #~ self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) self.scrollArea.setWidget(self.widgetProjection) self.scrollArea.setMinimumWidth(180) v.addWidget(self.scrollArea) if show_tour: self.randButton = QPushButton(QIcon(':/roll.png'), 'Random') v.addWidget(self.randButton) self.connect(self.randButton, SIGNAL('clicked()'), self.randomPosition) self.startRandTourButton = QPushButton( QIcon(':/helicoper_and_roll.png'), 'Random tour') self.startRandTourButton.setCheckable(True) v.addWidget(self.startRandTourButton) self.connect(self.startRandTourButton, SIGNAL('clicked()'), self.startStopTour) self.timerRandTour = QTimer() self.timerRandTour.setInterval(self.plotParams['interval']) self.connect(self.timerRandTour, SIGNAL('timeout()'), self.stepRandTour) self.startOptimizedTourButton = QPushButton( QIcon(':/helicoper_and_magic.png'), 'Optimized tour') self.startOptimizedTourButton.setCheckable(True) v.addWidget(self.startOptimizedTourButton) self.connect(self.startOptimizedTourButton, SIGNAL('clicked()'), self.startStopTour) self.timerOptimizedTour = QTimer() self.timerOptimizedTour.setInterval(self.plotParams['interval']) self.connect(self.timerOptimizedTour, SIGNAL('timeout()'), self.stepOptimizedTour) but = QPushButton(QIcon(':/configure.png'), 'Configure') v.addWidget(but) self.connect(but, SIGNAL('clicked()'), self.openConfigure) if show_select_tools: h2 = QHBoxLayout() groupbox = QGroupBox('Selection mode') groupbox.setLayout(h2) v.addWidget(groupbox) icons = [ ['pickone', ':/color-picker.png'], ['lasso', ':/lasso.png'], ['contour', ':/polygon-editor.png'], ] self.selectButton = {} for name, icon in icons: but = QPushButton(QIcon(icon), '') h2.addWidget(but) but.setAutoExclusive(True) but.setCheckable(True) self.connect(but, SIGNAL('clicked()'), self.changeSelectMode) self.selectButton[name] = but #~ self.selectButton['pickone'].setChecked(True) self.clearSelectBut = QPushButton(QIcon(':/view-refresh.png'), 'Clear selection') v.addWidget(self.clearSelectBut) self.connect(self.clearSelectBut, SIGNAL('clicked()'), self.clearSelection) self.canvas = SimpleCanvas() #~ self.ax = self.canvas.fig.add_subplot(1,1,1) self.ax = self.canvas.fig.add_axes([0.02, 0.02, .96, .96]) h.addWidget(self.canvas, 2) self.canvas.setMinimumWidth(180) self.ax_circle = None self.create_axe_circle() self.tour_running = False # internal attribute self.dim = 0 # self.spins = [] # spin widget list self.toBeDisconnected = [] # manage mpl_connect and disconnect self.selectMode = None # actual mode self.epsilon = 4. # for pickle event self.poly = None # for contour self.selectionLine = None self.actualSelection = array([], dtype='i') self.connect(self, SIGNAL('selectionChanged'), self.redrawSelection)