예제 #1
0
def test_widget_traces_gotoepoch(qtbot):

    w = MainWindow()
    w.show()
    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()

    menubar = w.menuBar()

    act_navigation = find_in_qt(menubar, QAction, 'Navigation')
    menubar.setActiveAction(act_navigation)
    act_navigation.menu().setActiveAction(w.traces.action['go_to_epoch'])

    screenshot(w, 'traces_01_gotoepoch.png')
    w.close()

    w.traces.go_to_epoch(test_text_str='xxx')
    assert w.statusBar().currentMessage() == 'Input can only contain digits and colons'

    w.traces.go_to_epoch(test_text_str='1130')
    assert w.value('window_start') == 1130

    w.traces.go_to_epoch(test_text_str='22:30')
    assert w.value('window_start') == 20400

    w.info.idx_start.setStyleSheet("background-color: red;")
    w.info.grab().save(str(GUI_PATH / 'traces_02_gotoepoch.png'))
    w.info.idx_start.setStyleSheet("")
예제 #2
0
def test_widget_exportsvg(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.show()
    w.info.open_dataset(str(gui_file))
    channel_make_group(w)
    w.channels.button_apply.click()

    menubar = w.menuBar()
    act_view = find_in_qt(menubar, QAction, 'View')
    menubar.setActiveAction(act_view)
    act_view.menu().setActiveAction(w.traces.action['export_svg'])

    screenshot(w, 'exportsvg_01.png')

    export_graphics(w, test=str(svg_file))  # without extension
    assert svg_file.with_suffix('.svg').exists()
    w.close()

    svg_d = SVGDialog(str(svg_file))
    svg_d.button_clicked(svg_d.idx_ok)
    svg_d.button_clicked(svg_d.idx_cancel)
    svg_d.grab().save(str(GUI_PATH / 'exportsvg_02.png'))
예제 #3
0
def test_widget_notes_export_csv(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    menubar = w.menuBar()

    act_annot = find_in_qt(menubar, QAction, 'Annotations')
    menubar.setActiveAction(act_annot)
    act_annot.menu().setActiveAction(w.notes.action['export_to_csv'])

    screenshot(w, 'notes_06_export.png')
    w.close()
예제 #4
0
def test_widget_notes_export_csv(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    w.info.open_dataset(str(gui_file))
    w.notes.update_notes(annot_psg_path)

    menubar = w.menuBar()

    act_annot = find_in_qt(menubar, QAction, 'Annotations')
    menubar.setActiveAction(act_annot)
    act_annot.menu().setActiveAction(w.notes.action['export_sleepstats'])

    screenshot(w, 'analysis_02_statistics.png')
    w.close()
예제 #5
0
def test_widget_notes_import_fasst(qtbot):

    w = MainWindow()
    qtbot.addWidget(w)

    menubar = w.menuBar()

    act_annot = find_in_qt(menubar, QAction, 'Annotations')
    menubar.setActiveAction(act_annot)

    act_import = find_in_qt(act_annot.menu(), QAction, 'Import Staging')
    act_annot.menu().setActiveAction(act_import)

    act_import.menu().setActiveAction(w.notes.action['import_fasst'])

    screenshot(w, 'notes_04_import_fasst.png')
    w.close()
예제 #6
0
def test_widget_notes_cycle(qtbot):

    w = MainWindow()
    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.Y_wider()
    w.traces.go_to_epoch(test_text_str='22:28')

    menubar = w.menuBar()

    act_annot = find_in_qt(menubar, QAction, 'Annotations')
    menubar.setActiveAction(act_annot)

    act_cycle = find_in_qt(act_annot.menu(), QAction, 'Cycle')
    act_annot.menu().setActiveAction(act_cycle)

    act_cycle.menu().setActiveAction(w.notes.action['cyc_start'])

    screenshot(w, 'notes_11_set_cycle_start.png')

    w.notes.get_cycle_mrkr()

    w.overview.grab().save(str(GUI_PATH / 'notes_12_cycle_marker.png'))

    w.traces.go_to_epoch(test_text_str='23:24')
    w.notes.get_cycle_mrkr(end=True)
    w.traces.go_to_epoch(test_text_str='23:29')
    w.notes.get_cycle_mrkr()
    w.traces.go_to_epoch(test_text_str='00:43')
    w.notes.get_cycle_mrkr()
    w.traces.go_to_epoch(test_text_str='02:14:30')
    w.notes.get_cycle_mrkr(end=True)

    w.overview.grab().save(str(GUI_PATH / 'notes_13_all_cycle_markers.png'))
    w.notes.clear_cycle_mrkrs(test=True)

    w.close()