Ejemplo n.º 1
0
def removeLayout(name):
    """Deletes the named layout. """

    log.debug('Deleting layout with name {}'.format(name))
    fslsettings.delete('fsleyes.layouts.{}'.format(name))
    fslsettings.delete('fsleyes.perspectives.{}'.format(name))
    _removeFromLayoutList(name)
Ejemplo n.º 2
0
def test_initialise():

    # Assuming that initialise()
    # has not yet been called
    assert settings.read('nothing') is None
    assert settings.read('nothing', 'default') == 'default'
    settings.write('nothing', 'nothing')
    settings.delete('nothing')
    assert settings.readFile('nothing') is None
    settings.writeFile('nothing', 'nothing')
    settings.deleteFile('nothing')
    assert settings.filePath() is None
    assert settings.readAll() == {}
    assert settings.listFiles() == []
    settings.clear()

    with tests.testdir() as testdir:

        settings.initialise(cfgid='test', cfgdir=testdir, writeOnExit=False)

        assert settings.settings.configID == 'test'
        assert settings.settings.configDir == testdir

        settings.write('setting', 'value')

        assert settings.read('setting') == 'value'
        assert settings.read('nothing') is None
Ejemplo n.º 3
0
def shutdown():
    """Called when FSLeyes exits normally (i.e. the user closes the window).
    Does some final clean-up before exiting.
    """

    import fsl.utils.settings as fslsettings

    # Clear the cached directory for loading/saving
    # files - when FSLeyes starts up, we want it to
    # default to the current directory.
    fslsettings.delete('loadSaveOverlayDir')
Ejemplo n.º 4
0
def removePerspective(name):
    """Deletes the named perspective. """

    log.debug('Deleting perspective with name {}'.format(name))
    fslsettings.delete('fsleyes.perspectives.{}'.format(name))
    _removeFromPerspectivesList(name)