Пример #1
0
def test_scroll_data(qtbot):

    w = Wonambi()
    qtbot.addWidget(w)

    w.grab().save(str(GUI_PATH / 'open_01_start.png'))

    w.info.idx_filename.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'open_02_open_dataset.png'))
    w.info.idx_filename.setStyleSheet("")

    w.info.open_dataset(str(gui_file))

    new_button = w.channels.layout().itemAt(0).itemAt(0).widget()
    new_button.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'open_03_loaded.png'))
    new_button.setStyleSheet("")

    channel_make_group(w, png=True)

    # this shows selected channels and the apply button
    button_apply = find_in_qt(w.channels, QPushButton, 'Apply')
    button_apply.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'open_05_chan.png'))
    button_apply.setStyleSheet("")

    button_apply.click()
    w.grab().save(str(GUI_PATH / 'open_06_traces.png'))
Пример #2
0
def test_widget_labels(qtbot):

    w = Wonambi()
    qtbot.addWidget(w)

    assert not w.labels.isEnabled()

    w.info.open_dataset(str(gui_file))
    labels_orig = w.labels.chan_name

    assert w.labels.isEnabled()

    w.action['dockwidgets'][1].trigger()
    w.labels.table.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'labels_01_table.png'))
    w.labels.table.setStyleSheet("")

    # change label of second channel
    w.labels.table.item(1, 1).setText('newlabel')
    w.labels.grab().save(str(GUI_PATH / 'labels_02_newlabel.png'))

    w.labels.table.item(3, 1).setText('newlabel')
    w.labels.grab().save(str(GUI_PATH / 'labels_03_duplicate.png'))

    assert not w.labels.idx_apply.isEnabled()

    # fix it
    w.labels.table.item(3, 1).setText('correctlabel')
    w.labels.grab().save(str(GUI_PATH / 'labels_04_correct.png'))

    assert w.labels.idx_apply.isEnabled()

    # cancel should reset the list
    labels_changed = w.labels._read_labels()
    w.labels.idx_cancel.click()
    labels_cancel = w.labels._read_labels()
    assert labels_cancel == labels_orig
    assert labels_cancel != labels_changed

    # apply
    w.labels.table.item(2, 1).setText('newlabel')
    w.labels.idx_apply.click()

    assert w.channels.isEnabled()

    channel_make_group(w)
    find_in_qt(w.channels, QPushButton, 'Apply').click()
    w.grab().save(str(GUI_PATH / 'labels_05_traces.png'))

    # load data
    w.labels.idx_load.setStyleSheet("background-color: red;")
    w.labels.grab().save(str(GUI_PATH / 'labels_06_load_button.png'))
    w.labels.idx_load.setStyleSheet("")

    labels_file = SAMPLE_PATH / 'labels_file.csv'
    with labels_file.open('w') as f:
        f.write('newchan1, newchan2\tnewchan3;\nnewchan5')

    w.labels.load_labels(test_name=str(labels_file))
    w.labels.grab().save(str(GUI_PATH / 'labels_07_loaded.png'))
def test_widget_channels_save(qtbot):
    w = Wonambi()
    qtbot.addWidget(w)

    assert not w.channels.action['save_channels'].isEnabled()
    w.info.open_dataset(str(gui_file))
    assert w.channels.action['save_channels'].isEnabled()

    channel_make_group(w)

    w.channels.new_group(test_name='eog')

    chan_tab_i = w.channels.tabs.currentIndex()
    channelsgroup = w.channels.tabs.widget(chan_tab_i)
    channelsgroup.idx_l0.item(2).setSelected(True)

    channelsgroup.idx_hp.setValue(20)
    channelsgroup.idx_lp.setValue(0)
    channelsgroup.idx_scale.setValue(10)
    w.channels.color_group(test_color=QColor('#ff4a87'))

    w.channels.button_apply.click()

    toolbar = w.findChild(QToolBar, 'File Management')
    button_save = find_in_qt(toolbar, QToolButton, "Save Montage")
    button_save.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'channels_12_save_chan.png'))
    button_save.setStyleSheet("")

    w.channels.save_channels(test_name=str(channel_montage_file))
Пример #4
0
def test_widget_notes_show_fasst(qtbot):

    w = Wonambi()
    qtbot.addWidget(w)

    w.notes.import_fasst(test_fasst=str(annot_fasst0_path),
                         test_annot=str(annot_fasst_export_file))
    w.grab().save(str(GUI_PATH / 'notes_05_show_imported.png'))
Пример #5
0
def test_widget_notes_load(qtbot):
    w = Wonambi()
    qtbot.addWidget(w)

    toolbar = w.findChild(QToolBar, 'File Management')
    button_save = find_in_qt(toolbar, QToolButton, "Load Annotations")
    button_save.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'notes_03_load.png'))
    button_save.setStyleSheet("")
def test_widget_channels_load(qtbot):

    w = Wonambi()
    qtbot.addWidget(w)

    assert not w.channels.action['load_channels'].isEnabled()
    w.info.open_dataset(str(gui_file))
    assert w.channels.action['load_channels'].isEnabled()

    toolbar = w.findChild(QToolBar, 'File Management')
    button_load = find_in_qt(toolbar, QToolButton, "Load Montage")
    button_load.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'channels_13_load_chan.png'))
    button_load.setStyleSheet("")

    w.channels.load_channels(test_name=str(channel_montage_file))
    w.grab().save(str(GUI_PATH / 'channels_14_loaded.png'))
Пример #7
0
def test_widget_notes_toolbar(qtbot):

    w = Wonambi()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()
    w.channels.new_group(test_name='eog')
    w.notes.update_notes(annot_psg_path)
    w.traces.Y_wider()
    w.traces.go_to_epoch(test_text_str='23:00')

    toolbar = w.findChild(QToolBar, 'Annotations')

    button_event = find_in_qt(toolbar, QToolButton, 'Event Mode')
    button_event.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'notes_07_event_mode.png'))
    button_event.setStyleSheet("")

    box_evttype = find_in_qt_by_idx(toolbar, QComboBox, 0)
    box_evttype.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'notes_08_evt_type_box.png'))
    box_evttype.setStyleSheet("")

    box_stage = find_in_qt_by_idx(toolbar, QComboBox, 1)
    box_stage.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'notes_09_stage_box.png'))
    box_stage.setStyleSheet("")

    box_qual = find_in_qt_by_idx(toolbar, QComboBox, 2)
    box_qual.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'notes_10_quality_box.png'))
    box_qual.setStyleSheet("")

    w.close()
def test_widget_channels(qtbot):

    w = Wonambi()
    qtbot.addWidget(w)

    assert not w.channels.isEnabled()

    w.info.open_dataset(str(gui_file))

    assert w.channels.isEnabled()

    assert not w.channels.button_color.isEnabled()
    assert not w.channels.button_del.isEnabled()
    assert not w.channels.button_apply.isEnabled()
    channel_make_group(w)
    assert w.channels.button_color.isEnabled()
    assert w.channels.button_del.isEnabled()
    assert w.channels.button_apply.isEnabled()

    w.channels.button_apply.click()

    w.channels.grab().save(str(GUI_PATH / 'channels_01_onegroup.png'))

    w.channels.new_group(test_name='eog')
    chan_tab_i = w.channels.tabs.currentIndex()
    channelsgroup = w.channels.tabs.widget(chan_tab_i)

    channelsgroup.idx_l0.item(2).setSelected(True)
    w.channels.grab().save(str(GUI_PATH / 'channels_02_eog.png'))

    chan_tab_i = w.channels.tabs.currentIndex()
    channelsgroup = w.channels.tabs.widget(chan_tab_i)

    channelsgroup.idx_l0.item(2).setSelected(True)

    channelsgroup.idx_hp.setValue(20)
    channelsgroup.idx_hp.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_03_hp.png'))
    channelsgroup.idx_hp.setStyleSheet("")

    channelsgroup.idx_lp.setValue(0)
    channelsgroup.idx_lp.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_04_lp.png'))
    channelsgroup.idx_lp.setStyleSheet("")

    channelsgroup.idx_notch.setValue(60)
    channelsgroup.idx_notch.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_05_notch.png'))
    channelsgroup.idx_notch.setStyleSheet("")

    channelsgroup.idx_scale.setValue(10)
    channelsgroup.idx_scale.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_05_scale.png'))
    channelsgroup.idx_scale.setStyleSheet("")

    channelsgroup.idx_demean.setCheckState(Qt.Checked)
    channelsgroup.idx_demean.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_05_demean.png'))
    channelsgroup.idx_demean.setStyleSheet("")

    channelsgroup.idx_l1.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_06_ref.png'))
    channelsgroup.idx_l1.setStyleSheet("")

    channelsgroup.idx_reref.setStyleSheet("background-color: red;")
    w.channels.grab().save(str(GUI_PATH / 'channels_07_avgref.png'))
    channelsgroup.idx_reref.setStyleSheet("")

    button_apply = w.channels.button_apply
    button_apply.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'channels_08_apply.png'))
    button_apply.setStyleSheet("")

    button_apply.click()

    button_color = w.channels.button_color
    button_color.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'channels_09_color.png'))
    button_color.setStyleSheet("")

    w.channels.color_group(test_color=QColor('#ff4a87'))
    w.grab().save(str(GUI_PATH / 'channels_10_colored.png'))

    button_delete = w.channels.button_del
    button_delete.setStyleSheet("background-color: red;")
    w.grab().save(str(GUI_PATH / 'channels_11_delete.png'))
    button_delete.setStyleSheet("")
    button_delete.click()

    # delete also the first channel group
    assert w.channels.button_color.isEnabled()
    assert w.channels.button_del.isEnabled()
    assert w.channels.button_apply.isEnabled()
    button_delete.click()
    assert not w.channels.button_color.isEnabled()
    assert not w.channels.button_del.isEnabled()
    assert not w.channels.button_apply.isEnabled()