Page 2 of 2

Re: [SOLVED] Possibility to listen to events within a plugin

Posted: Sun Aug 10, 2014 8:19 am
by Sem;colon
Hi Pako,

I have never been to Dresden yet, but I heard from many people that it's a very nice old city, I hope you had a good time in Germany 8)

As for the EventListener; it works very similar to LogListener, but hands over the whole event object, not only a string.
You can use it like this:

Code: Select all

class LogWrapper:
        
    def AddEventListener(self):
        if self not in eg.log.eventListeners:
            eg.log.AddEventListener(self)

    def LogEvent(self, event):
        print event.suffix

    def StopEventListener(self):
        if self in eg.log.eventListeners:
            eg.log.RemoveEventListener(self)
            
eg.globals.LogWrapper=LogWrapper()
eg.globals.LogWrapper.AddEventListener()

Re: [SOLVED] Possibility to listen to events within a plugin

Posted: Sun Aug 10, 2014 8:34 am
by Pako
Sem;colon wrote:I heard from many people that it's a very nice old city ...
Yes, Dresden is a very nice city.
I've been there several times already.
Sem;colon wrote:You can use it like this:
Yes, of course you are right.
I forgot that you can redefine the method "LogEvent".

I think it is useful improvements. It is good that you made ÔÇïÔÇïa note about it in the appropriate topic.

Pako

Re: [SOLVED] Possibility to listen to events within a plugin

Posted: Wed Nov 12, 2014 8:31 pm
by Sem;colon
Bugfix on this Modification:

I noticed that it's only working if "only log assigned events" is unticked.

I attached a corrected version.