#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys,os
from gimpfu import *


def testLayerParm(image,layer,otherLayer):
    
    msg='Image: %s, layer "%s": %s, otherLayer: "%s": %s' % (image,layer.name,type(layer),otherLayer.name,type(otherLayer))
    print msg 
    gimp.message(msg)
    if type(layer)==gimp.GroupLayer:
        msg='Layers: %s' % (layer.layers)
        print msg
        gimp.message(msg)
    if type(otherLayer)==gimp.GroupLayer:
        msg='Layers: %s' % (otherLayer.layers)
        print msg
        gimp.message(msg)
    return

def testLayerPlain(image,layer):
    
    msg='Image: %s, layer "%s": %s' % (image,layer.name,type(layer))
    print msg 
    gimp.message(msg)
    return

# Some variables to avoid repeating myself
desc="Test layer"
menu="Test layer"
whoiam='\n%s' % os.path.abspath(sys.argv[0])
parmsInParm=    [(PF_IMAGE,'image','Input image',None),
                (PF_DRAWABLE,'layer','Input layer',None),
                (PF_DRAWABLE, "otherLayer", "Other Layer", None ),
                ]
parmsInPlain=    [(PF_IMAGE,'image','Input image',None),
                (PF_DRAWABLE,'layer','Input layer',None),
                ]
parmsOut=[]
menuLocation='<Image>/Test'
author='Ofnuts'
year='2017'
    
register("test-layer-parm",desc+whoiam,desc,author,author,year,'Test with parms','*',parmsInParm,parmsOut,testLayerParm,menuLocation)
register("test-layer-plain",desc+whoiam,desc,author,author,year,'Test without parms','*',parmsInPlain,parmsOut,testLayerPlain,menuLocation)
    
main()
