def __init__( self, parent=None, spike_times=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) h = QHBoxLayout() mainLayout.addLayout(h) self.combo1 = QComboBox() h.addWidget(self.combo1) self.connect(self.combo1, SIGNAL('currentIndexChanged( int )'), self.comboChanged) self.combo2 = QComboBox() h.addWidget(self.combo2) self.connect(self.combo2, SIGNAL('currentIndexChanged( int )'), self.comboChanged) self.canvas = SimpleCanvasAndTool(orientation=Qt.Horizontal) self.fig = self.canvas.fig self.ax = self.fig.add_subplot(1, 1, 1) mainLayout.addWidget(self.canvas) if show_button: but = QPushButton('', self.canvas.canvas) #~ but = QPushButton('',parent = 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.changeData(spike_times, sorted=sorted)
def __init__( self, parent=None, metadata=None, Session=None, session=None, globalApplicationDict=None, id_respirationsignal=None, ): QDialog.__init__(self, parent) self.metadata = metadata self.session = Session() self.globalApplicationDict = globalApplicationDict self.id_respirationsignal = id_respirationsignal self.respiration = self.session.query(RespirationSignal).filter_by( id=id_respirationsignal).one() #FIXME: do not work: self.setModal(False) self.setWindowModality(Qt.NonModal) self.setWindowTitle( self.tr('OpenElectrophy respiration for %d' % (self.respiration.id))) self.setWindowIcon(QIcon(':/respiration.png')) self.mainLayout = QVBoxLayout() self.setLayout(self.mainLayout) h = QHBoxLayout() self.mainLayout.addLayout(h) c = SimpleCanvasAndTool() h.addWidget(c, 3) self.canvas = c.canvas self.ax = self.canvas.fig.add_subplot(1, 1, 1) v = QVBoxLayout() h.addLayout(v, 2) but = QPushButton(QIcon(':/TODO.txt'), 'Auto detect') v.addWidget(but) self.connect(but, SIGNAL('clicked()'), self.newDetection) v.addSpacing(20) v.addWidget(QLabel('<b>Repiratory cycles</b>')) self.table = QTreeWidget() #~ self.table.setMinimumWidth(100) #~ self.table.setColumnWidth(0,80) v.addWidget(self.table) self.table.setSelectionMode(QAbstractItemView.ExtendedSelection) self.connect(self.table, SIGNAL('itemSelectionChanged()'), self.newSelectionInTable) self.table.setContextMenuPolicy(Qt.CustomContextMenu) self.connect(self.table, SIGNAL('customContextMenuRequested( const QPoint &)'), self.contextMenuTable) self.mainLayout.addSpacing(20) buttonBox = QDialogButtonBox() but = QPushButton(QIcon(':/document-save.png'), 'Save to DB') buttonBox.addButton(but, QDialogButtonBox.ActionRole) self.connect(but, SIGNAL('clicked()'), self.save_to_db) but = QPushButton(QIcon(':/reload.png'), 'Reload from DB') buttonBox.addButton(but, QDialogButtonBox.ActionRole) self.connect(but, SIGNAL('clicked()'), self.reload_from_db) but = QPushButton(QIcon(':/window-close.png'), 'Quit') buttonBox.addButton(but, QDialogButtonBox.RejectRole) self.connect(but, SIGNAL('clicked()'), self.close) self.mainLayout.addWidget(buttonBox) if self.respiration.cycle_times is None: self.cycle_times = None else: self.cycle_times = self.respiration.cycle_times self.vlines = {} self.baseline = 0. self.refreshPlot() self.refreshTable() self.canvas.mpl_connect('pick_event', self.onPick) self.canvas.mpl_connect('button_release_event', self.releaseEvent) self.canvas.mpl_connect('motion_notify_event', self.motionEvent) #~ self.picked = None #~ self.lineSelection = None self.session.expunge_all()