# This file defines a number of standard "packages" that correspond to
# a Panda3D distribution.  These packages are built by passing this
# file to the ppackage utility, either as a packaged application, or
# as the module direct.p3d.ppackage.

# The packages in this file define the thirdparty
# packages that could be used by a .p3d archive.

# When needed, these packages are downloaded by the core API, from the
# host URL specified in a given p3d file, and not from any hardcoded
# URL.  Thus, any custom version of Panda3D may be hosted on any
# server in the world, and any version of the plugin can download it.

# Also see panda3d.pdef.

from panda3d.core import Filename
import sys

class wx(package):
    config(display_name = "wxPython GUI Toolkit")
    #config(gui_app = True)
    require('panda3d')

    module('direct.showbase.WxGlobal')
    module('direct.wxwidgets')
    module('direct.wxwidgets.*')
    module('wx', required = True)
    module('wx.*')

class tk(package):
    config(display_name = "Tk GUI Toolkit")
    #config(gui_app = True)
    require('panda3d')

    if sys.version_info >= (3, 0):
        module('tkinter', '_tkinter', required = True)
        module('tkinter.colorchooser', 'tkinter.commondialog',
               'tkinter.constants', 'tkinter.dialog', 'tkinter.dnd',
               'tkinter.filedialog', 'tkinter.font', 'tkinter.messagebox',
               'tkinter.scrolledtext', 'tkinter.simpledialog', 'tkinter.tix',
               'tkinter.ttk')
    else:
        module('Tkinter', '_tkinter', required = True)
        module('Tkconstants', 'Tkdnd', 'Tix', 'ScrolledText', 'turtle',
               'tkColorChooser', 'tkCommonDialog', 'tkFileDialog',
               'tkFont', 'tkMessageBox', 'tkSimpleDialog')

    module('direct.showbase.TkGlobal',
           'direct.tkpanels',
           'direct.tkwidgets')

    try:
        if sys.version_info >= (3, 0):
            from tkinter import Tcl
        else:
            from Tkinter import Tcl
        tcl = Tcl()
        dir = Filename.fromOsSpecific(tcl.eval("info library"))
        ver = tcl.eval("info tclversion")

        file(Filename(dir, "*.tcl"), newDir = 'lib/tcl' + ver, extract = True)
    except ImportError:
        pass

    try:
        import Pmw
    except ImportError:
        Pmw = None

    if Pmw is not None:
        Pmw = sys.modules['_Pmw']
        sys.modules['Pmw'] = Pmw
        sys.modules['Pmw'].__name__ = 'Pmw'
        module('Pmw', 'Pmw.Pmw_1_3.lib.*')
        path = Filename.fromOsSpecific(Pmw.__path__[0])
        file(Filename(path, 'Pmw_1_3/lib/Pmw.def'), newDir = 'Pmw/Pmw_1_3/lib')

class sqlite(package):
    config(display_name = "SQLite Interface")
    require('panda3d')

    module('sqlite', 'sqlite3')

class numpy(package):
    config(display_name = "NumPy")
    require('panda3d')

    module('numpy', required = True)

class pygame(package):
    config(display_name = "PyGame")
    require('panda3d', 'numpy')

    module('pygame', required = True)
    module('pygame.*', 'pygame._view')

class twisted(package):
    config(display_name = "Twisted")
    require('panda3d')

    module('twisted', 'twisted._version', required = True)
    module('twisted.application', 'twisted.conch', 'twisted.cred',
           'twisted.enterprise', 'twisted.internet', 'twisted.lore',
           'twisted.mail', 'twisted.manhole', 'twisted.names',
           'twisted.news', 'twisted.pair', 'twisted.persisted',
           'twisted.plugin', 'twisted.plugins', 'twisted.python',
           'twisted.runner', 'twisted.scripts', 'twisted.spread',
           'twisted.tap', 'twisted.trial', 'twisted.vfs',
           'twisted.web', 'twisted.web2', 'twisted.words')

    module('twisted.*', 'twisted.*.*')

class pil(package):
    config(display_name = "Python Imaging Library")
    require('panda3d')

    module('Image', required = True)
    module('PIL', 'ArgImagePlugin', 'BdfFontFile',
           'BmpImagePlugin', 'BufrStubImagePlugin', 'ContainerIO',
           'CurImagePlugin', 'DcxImagePlugin', 'EpsImagePlugin',
           'ExifTags', 'FitsStubImagePlugin', 'FliImagePlugin',
           'FontFile', 'FpxImagePlugin', 'GbrImagePlugin', 'GdImageFile',
           'GifImagePlugin', 'GimpGradientFile', 'GimpPaletteFile',
           'GribStubImagePlugin', 'Hdf5StubImagePlugin',
           'IcnsImagePlugin', 'IcoImagePlugin', 'ImImagePlugin',
           'ImageChops', 'ImageCms', 'ImageColor', 'ImageDraw',
           'ImageDraw2', 'ImageEnhance', 'ImageFile', 'ImageFileIO',
           'ImageFilter', 'ImageFont', 'ImageGL', 'ImageGrab',
           'ImageMath', 'ImageMode', 'ImageOps', 'ImagePalette',
           'ImagePath', 'ImageQt', 'ImageSequence', 'ImageShow',
           'ImageStat', 'ImageTk', 'ImageTransform', 'ImageWin',
           'ImtImagePlugin', 'IptcImagePlugin', 'JpegImagePlugin',
           'McIdasImagePlugin', 'MicImagePlugin', 'MpegImagePlugin',
           'MspImagePlugin', 'OleFileIO', 'PSDraw', 'PaletteFile',
           'PalmImagePlugin', 'PcdImagePlugin', 'PcfFontFile',
           'PcxImagePlugin', 'PdfImagePlugin', 'PixarImagePlugin',
           'PngImagePlugin', 'PpmImagePlugin', 'PsdImagePlugin',
           'SgiImagePlugin', 'SpiderImagePlugin', 'SunImagePlugin',
           'TarIO', 'TgaImagePlugin', 'TiffImagePlugin', 'TiffTags',
           'WalImageFile', 'WmfImagePlugin', 'XVThumbImagePlugin',
           'XbmImagePlugin', 'XpmImagePlugin', '_imaging',
           '_imagingmath', '_imagingtk')

class pyopengl(package):
    config(display_name = "PyOpenGL")
    require('panda3d', 'numpy')

    module('OpenGL', 'OpenGL.GL', required = True)
    module('OpenGL.GLU', 'OpenGL.GLUT', 'OpenGL.GLE', 'OpenGL.GLX')

class httplib2(package):
    config(display_name = "httplib2", platform_specific = False)
    require('panda3d')

    module('httplib2', required = True)

class box2d(package):
    config(display_name = "Box2D")
    require('panda3d')

    module('Box2D', required = True)

class pyglet(package):
    config(display_name = "pyglet", platform_specific = False)
    require('panda3d', 'morepy')

    module('pyglet', required = True)
