Defines a method as being a slot for the XView system.  This will validate
    the method against the signal properties if it is triggered from the
    dispatcher, taking into account currency and grouping for the widget.  
    You can specify the optional policy keyword to define the specific signal
    policy for this slot, otherwise it will use its parent view's policy.
    
    :param      default | <variant> | default return value
                policy  | <XView.SignalPolicy> || None
                
    :usage      |from projexui.widgets.xviewwidget import xviewSlot
                |
                |class A(XView):
                |   @xviewSlot()
                |   def format( self ):
                |       print 'test'

def xviewSlot(*typs, **opts):
    """
    Defines a method as being a slot for the XView system.  This will validate
    the method against the signal properties if it is triggered from the
    dispatcher, taking into account currency and grouping for the widget.  
    You can specify the optional policy keyword to define the specific signal
    policy for this slot, otherwise it will use its parent view's policy.
    
    :param      default | <variant> | default return value
                policy  | <XView.SignalPolicy> || None
                
    :usage      |from projexui.widgets.xviewwidget import xviewSlot
                |
                |class A(XView):
                |   @xviewSlot()
                |   def format( self ):
                |       print 'test'
    """
    default = opts.get('default')
    policy  = opts.get('policy')
    
    if typs:
        typ_count = len(typs)
    else:
        typ_count = 0
    
    def decorated(func):
        @wraps(func)
        def wrapped(*args, **kwds):
            if ( args and isinstance(args[0], XView) ):
                validated = args[0].validateSignal(policy)
            else:
                validated = True
            
            if ( validated ):
                new_args = args[:typ_count+1]
                return func(*new_args, **kwds)
            return default
        return wrapped
    return decorated