import os
import sys

# TODO make this less brittle
sys.path = [os.path.join(os.path.dirname(__file__), '../../build/src/python/')] + sys.path

import corrade
import corrade.containers

import magnum
import magnum.gl
import magnum.meshtools
import magnum.platform
import magnum.platform.egl
import magnum.platform.glx
import magnum.platform.glfw
import magnum.platform.sdl2
import magnum.primitives
import magnum.shaders
import magnum.scenegraph
import magnum.trade

# So the doc see everything
# TODO: use just +=, m.css should reorder this on its own
corrade.__all__ = ['containers']
magnum.__all__ = ['math', 'gl', 'meshtools', 'platform', 'primitives', 'shaders', 'scenegraph', 'trade'] + magnum.__all__

# TODO ugh... can this be expressed directly in pybind?
magnum.gl.__annotations__ = {}
magnum.gl.__annotations__['default_framebuffer'] = magnum.gl.DefaultFramebuffer
magnum.shaders.VertexColor2D.__annotations__ = {}
magnum.shaders.VertexColor2D.__annotations__['POSITION'] = magnum.gl.Attribute
magnum.shaders.VertexColor2D.__annotations__['COLOR3'] = magnum.gl.Attribute
magnum.shaders.VertexColor2D.__annotations__['COLOR4'] = magnum.gl.Attribute
magnum.shaders.VertexColor3D.__annotations__ = {}
magnum.shaders.VertexColor3D.__annotations__['POSITION'] = magnum.gl.Attribute
magnum.shaders.VertexColor3D.__annotations__['COLOR3'] = magnum.gl.Attribute
magnum.shaders.VertexColor3D.__annotations__['COLOR4'] = magnum.gl.Attribute
magnum.shaders.Phong.__annotations__ = {}
magnum.shaders.Phong.__annotations__['POSITION'] = magnum.gl.Attribute
magnum.shaders.Phong.__annotations__['TEXTURE_COORDINATES'] = magnum.gl.Attribute
magnum.shaders.Phong.__annotations__['NORMAL'] = magnum.gl.Attribute

PROJECT_TITLE = 'Magnum'
PROJECT_SUBTITLE = 'Python docs'
MAIN_PROJECT_URL = 'https://magnum.graphics'
INPUT_MODULES = [corrade, magnum]
INPUT_PAGES = [
    'pages/index.rst',
    'pages/building.rst',
    'pages/api-conventions.rst',

    '../../../magnum-examples/doc/python/examples.rst'
]
INPUT_DOCS = [
    'corrade.containers.rst',

    'magnum.rst',
    'magnum.gl.rst',
    'magnum.math.rst',
    'magnum.platform.rst',
    'magnum.scenegraph.rst',
    'magnum.shaders.rst'
]

LINKS_NAVBAR2 = [
    ('C++ API', '../../../../magnum/build/doc-mcss/html/index.html', [])
]

PLUGINS = [
    'm.code',
    'm.components',
    'm.dox',
    'm.gh',
    'm.htmlsanity',
    'm.images',
    'm.link',
    'm.math',
    'm.sphinx'
]

STYLESHEETS = [
    'https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600&subset=latin-ext',
    '../css/m-dark+documentation.compiled.css'
]

FAVICON = '../favicon.ico'

M_DOX_TAGFILES = [
    # TODO: the path should be relative to this file
    (os.path.join(os.path.dirname(__file__), '../../../corrade/build/doc-mcss/corrade.tag'), '../../../../corrade/build/doc-mcss/html/', ['Corrade::'],  ['m-doc-external']),
    (os.path.join(os.path.dirname(__file__), '../../../magnum/build/doc-mcss/magnum.tag'), '../../../../magnum/build/doc-mcss/html/', ['Magnum::'],  ['m-doc-external'])
]
M_HTMLSANITY_SMART_QUOTES = True

PYBIND11_COMPATIBILITY = True

OUTPUT = '../../build/doc/python/'

PAGE_HEADER = """
.. container:: m-note m-success

    Welcome to the exciting new Python-flavored future of Magnum! Have fun, but
    please note this functionality is *heavily experimental* at the moment.
    Most APIs are missing, documentation is very sparse and everything is still
    evolving. **Use at your own risk.**
"""

FINE_PRINT = """
| Magnum Python docs. Part of the `Magnum project <https://magnum.graphics/>`_,
  copyright © `Vladimír Vondruš <http://mosra.cz/>`_ and contributors, 2010–2019.
| Generated by `m.css Python doc generator <https://mcss.mosra.cz/documentation/python/>`_.
  Contact the team via `GitHub <https://github.com/mosra/magnum>`_,
  `Gitter <https://gitter.im/mosra/magnum>`_,
  `e-mail <mailto:info@magnum.graphics>`_ or
  `Twitter <https://twitter.com/czmosra>`_"""
