Esempio n. 1
0
    def wrap(impl, number=None):
        if impl is None:
            return None

        if number is None:
            number = pn_event_type(impl)

        event = Event(impl, number)

        # check for an application defined ApplicationEvent and return that.  This
        # avoids an expensive wrap operation invoked by event.context
        if pn_event_class(impl) == PN_PYREF and \
                isinstance(event.context, EventBase):
            return event.context
        else:
            return event
Esempio n. 2
0
    def wrap(impl, number=None):
        if impl is None:
            return None

        if number is None:
            number = pn_event_type(impl)

        event = Event(impl, number)

        # check for an application defined ApplicationEvent and return that.  This
        # avoids an expensive wrap operation invoked by event.context
        if pn_event_class(impl) == PN_PYREF and \
                isinstance(event.context, EventBase):
            return event.context
        else:
            return event
Esempio n. 3
0
    def wrap(impl):
        if impl is None:
            return None

        number = pn_event_type(impl)
        cls = pn_event_class(impl)

        if cls:
            clsname = pn_class_name(cls)
            context = wrappers[clsname](pn_event_context(impl))

            # check for an application defined ApplicationEvent and return that.  This
            # avoids an expensive wrap operation invoked by event.context
            if cls == PN_PYREF and isinstance(context, EventBase):
                return context
        else:
            clsname = None

        event = Event(impl, number, clsname, context)
        return event
Esempio n. 4
0
    def wrap(impl):
        if impl is None:
            return None

        number = pn_event_type(impl)
        cls = pn_event_class(impl)

        if cls:
            clsname = pn_class_name(cls)
            context = wrappers[clsname](pn_event_context(impl))

            # check for an application defined ApplicationEvent and return that.  This
            # avoids an expensive wrap operation invoked by event.context
            if cls == PN_PYREF and isinstance(context, EventBase):
                return context
        else:
            clsname = None

        event = Event(impl, number, clsname, context)
        return event
Esempio n. 5
0
 def clazz(self):
     cls = pn_event_class(self._impl)
     if cls:
         return pn_class_name(cls)
     else:
         return None
Esempio n. 6
0
 def clazz(self):
     cls = pn_event_class(self._impl)
     if cls:
         return pn_class_name(cls)
     else:
         return None