Re: [nox-dev] Python only event?

2010-01-26 Thread James "Murphy" McCauley
Glad to hear it. Since posting this, I've looked a bit harder at the runtime behavior, and I am now fairly confident that this patch is, in fact, correct. -- Murphy On Jan 25, 2010, at 11:22 PM, Daekyeong Moon wrote: Hi Murphy, I applied the patch and it doesn't crash anymore. Thanks! On

Re: [nox-dev] Python only event?

2010-01-24 Thread James "Murphy" McCauley
Hey, DK. Hopefully I'm not introducing a big leak here, but give this a try: Index: pycontext.cc === --- pycontext.cc(revision 2) +++ pycontext.cc(working copy) @@ -132,6 +132,7 @@ if(sfe.python_arg){ py

Re: [nox-dev] Python only event?

2010-01-20 Thread Daekyeong Moon
I followed this approach and it seems it doesn't work when propagating an event through event handler chain. I encountered segfault and I guess it's related to object reference counting. This is a simplified version of what I did (and this simplified version also causes segault.) (Sorry for co

Re: [nox-dev] Python only event?

2010-01-04 Thread David Erickson
s/attributed/attributes/g -D David Erickson wrote: As a clarification for anyone that reads this down the road, it turns out that the python_arg is where you put a python object that you will retrieve when handling a posted event. IE: self.post(pyevent("name here", my_obj)) then to retrieve

Re: [nox-dev] Python only event?

2010-01-04 Thread David Erickson
As a clarification for anyone that reads this down the road, it turns out that the python_arg is where you put a python object that you will retrieve when handling a posted event. IE: self.post(pyevent("name here", my_obj)) then to retrieve my_obj from a handler def handle_event(self, event):

Re: [nox-dev] Python only event?

2010-01-04 Thread Martin Casado
This use to be required so that python-only state was not passed into C++ but I don't believe it is actually used anymore. You can safely ignore the message. Tried this and it worked like a charm. I did see an error message in the log: 00042|pyrt|ERR:Pyevent without internal python_arg set

Re: [nox-dev] Python only event?

2010-01-04 Thread David Erickson
Tried this and it worked like a charm. I did see an error message in the log: 00042|pyrt|ERR:Pyevent without internal python_arg set So I changed my event posting to: self.post(FlowOutEvent("flowoutevent", 1)) Which solved it. I took a look at the source but couldn't reason out what the pytho

Re: [nox-dev] Python only event?

2009-12-29 Thread Martin Casado
Actually looking at the code, this should already be supported. Try registering with "register_python_event(name)". See with context.i. This registers the default python converter and should allow you to create and post python only events without writing any c++. .martin Hi David I'm als

Re: [nox-dev] Python only event?

2009-12-28 Thread David Erickson
Martin and I talked, it will require some C modifications to make it work, but should be doable. I haven't implemented it yet. -David Brandon Heller wrote: Hi David I'm also interested in getting python-only events working. Were you able to get past this issue? Thanks, Brandon On Wed, D

Re: [nox-dev] Python only event?

2009-12-27 Thread Brandon Heller
Hi David I'm also interested in getting python-only events working. Were you able to get past this issue? Thanks, Brandon On Wed, Dec 16, 2009 at 8:08 PM, David Erickson wrote: > Martin Casado wrote: > >> I don't see where you are setting the name of the event you're posting. >> > > That could

Re: [nox-dev] Python only event?

2009-12-16 Thread David Erickson
Martin Casado wrote: I don't see where you are setting the name of the event you're posting. That could be important ;) Changed the code to be self.post(FlowOutEvent("flowoutevent")), now I get the following: 00041|flowinstaller|ERR:flowoutevent posted 00042|pyrt|ERR:flowoutevent has no C++

Re: [nox-dev] Python only event?

2009-12-16 Thread Martin Casado
I don't see where you are setting the name of the event you're posting. Hi Martin, Here is a test case that I am unable to get functioning, please ignore the ugly code: import logging from nox.coreapps.pyrt import * from nox.lib.core import * lg = logging.getLogger('flowinstaller') class F

Re: [nox-dev] Python only event?

2009-12-16 Thread David Erickson
Hi Martin, Here is a test case that I am unable to get functioning, please ignore the ugly code: import logging from nox.coreapps.pyrt import * from nox.lib.core import * lg = logging.getLogger('flowinstaller') class FlowOutEvent(pyevent): def install(self): return class flowin

Re: [nox-dev] Python only event?

2009-12-16 Thread Martin Casado
You should be able to do this by creating an instance of pyevent (see src/nox/pyrt/event.i) with a unique name and posting that. No need to swig or wrap anything. Let me know if this doesn't work. .martin Is it possible to register and post a Python event that is only received by other Pytho

[nox-dev] Python only event?

2009-12-16 Thread David Erickson
Is it possible to register and post a Python event that is only received by other Python handlers? IE an event that is not SWIG'd to C at all? I was looking at pycontext.hh and saw: /* Registers a Python only event */ void register_event(const Event_name&); The only example of using t