# -*- coding: utf-8 -*-
#
# Copyright © 2009- The Spyder development Team
# Licensed under the terms of the MIT License
#

"""
Module in charge of the configuration settings using a modified version
of Python's configuration parser.
"""

# Standard library imports
import os

# Local imports
from anaconda_navigator.config.base import get_conf_path, get_home_dir
from anaconda_navigator.config.main import CONF

CONF_PATH = get_conf_path()
CONTENT_PATH = os.path.join(CONF_PATH, 'content')
CONTENT_JSON_PATH = os.path.join(CONTENT_PATH, 'content.json')
IMAGE_ICON_SIZE = (256, 256)
IMAGE_DATA_PATH = os.path.join(CONF_PATH, 'images')
DEFAULT_PROJECT_PATH = os.path.join(CONF_PATH, 'default_project')
CHANNELS_PATH = os.path.join(CONF_PATH, 'channels')
DEVTOOLS_PATH = os.path.join(CONF_PATH, 'devtools')
PROJECT_YAML_FILE = 'project.yaml'
PROJECT_ENVS_FOLDER = 'envs'
DEFAULT_ENV = 'default'

# VALID_DEV_TOOLS = ['ipython-notebook', 'ipython-qtconsole', 'spyder-app']
VALID_DEV_TOOLS = ['notebook', 'qtconsole', 'spyder']
LOG_FOLDER = os.path.join(CONF_PATH, 'logs')
LOG_FILENAME = 'navigator.log'


def get_projects_path():
    """
    """
    paths = CONF.get('main', 'projects_path', [])

    if os.path.isdir(DEFAULT_PROJECT_PATH):
        paths.append(DEFAULT_PROJECT_PATH)

    if os.path.isdir(DEVTOOLS_PATH):
        for d in os.listdir(DEVTOOLS_PATH):
            p = os.sep.join([DEVTOOLS_PATH, d])
            paths.append(p)

    return paths


def set_projects_path():
    """
    """


def test():
    print(get_projects_path())


if __name__ == "__main__":
    test()
