[kamaelia-list] Re: Submitting my own console writer for review.
On Mon, 02 Mar 2009 06:30:09 -, Steve unetright.thebas...@xoxy.net wrote: 7) No line continuation \ is needed inside a multiline comment . You are correct - it is not necessary - but it helps with the parsing done for the automatically generated component reference documentation on the website. Iirc, without it you effectively get a blank, empty line at the start of the doc string. The currently employed algorithm for stripping the indentation gets confused by it. Hmm, thats a bit rubbish really - I ought to sort it out :-) Matt -- | Matt Hammond | Research Engineer, FMT, BBC, Kingswood Warren, Tadworth, Surrey, UK | http://www.bbc.co.uk/rd/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups kamaelia group. To post to this group, send email to kamaelia@googlegroups.com To unsubscribe from this group, send email to kamaelia+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/kamaelia?hl=en -~--~~~~--~~--~--~---
[kamaelia-list] Re: Submitting my own console writer for review.
This helped tremendously, thank you! Gloria Gloria, I'm very new to Kamaelia, but I'm going to take a stab at this: 1) If you don't inherit from threadedcomponent then your component's main function needs to be a generator. Generators use yield statements to temporarily suspend execution and send a value back to the calling context. Later, the generator is resumed in place where it previously yielded. 2) You need to yield a non-zero value for the component's microprocess to be rescheduled for execution. 3) Pausing is a good idea, but it doesn't happen until you yield, so looping on a pause doesn't pause. 4) Looping on waiting for data in the inbox won't detect a shutdown request, so you need to loop on the shutdown request and simlpy check for dataReady in the inbox (not an inner loop). 5) Received data is returned from recv('boxname') not assigned to a new parameter. 6) There is no need to have an explicit __init__ method unless you are going to be initializing some instance variables. 7) No line continuation \ is needed inside a multiline comment . With all those changes, you have: http://pastebin.com/m1fdf518e Good Luck! --Steve On Mar 1, 8:31 pm, Gloria W strang...@comcast.net wrote: Hi all, I copied snippets from existing console code in Console.py to try to make a functional remote console writer, to, say, prompt for a user name and info before letting anyone into a chat session, for example. Code is here: http://pastebin.com/m6f29ad06 And it seems to hang when I use it. I'll keep hacking away at it, but please take a glance and let me know if anything is blatantly wrong. My class inherits from component, and is therefore not threaded. It is meant to be a one-off: wait for a string, return it when the client types it. Thank you! Gloria --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups kamaelia group. To post to this group, send email to kamaelia@googlegroups.com To unsubscribe from this group, send email to kamaelia+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/kamaelia?hl=en -~--~~~~--~~--~--~---
[kamaelia-list] Re: Submitting my own console writer for review.
Gloria, I'm very new to Kamaelia, but I'm going to take a stab at this: 1) If you don't inherit from threadedcomponent then your component's main function needs to be a generator. Generators use yield statements to temporarily suspend execution and send a value back to the calling context. Later, the generator is resumed in place where it previously yielded. 2) You need to yield a non-zero value for the component's microprocess to be rescheduled for execution. 3) Pausing is a good idea, but it doesn't happen until you yield, so looping on a pause doesn't pause. 4) Looping on waiting for data in the inbox won't detect a shutdown request, so you need to loop on the shutdown request and simlpy check for dataReady in the inbox (not an inner loop). 5) Received data is returned from recv('boxname') not assigned to a new parameter. 6) There is no need to have an explicit __init__ method unless you are going to be initializing some instance variables. 7) No line continuation \ is needed inside a multiline comment . With all those changes, you have: http://pastebin.com/m1fdf518e Good Luck! --Steve On Mar 1, 8:31 pm, Gloria W strang...@comcast.net wrote: Hi all, I copied snippets from existing console code in Console.py to try to make a functional remote console writer, to, say, prompt for a user name and info before letting anyone into a chat session, for example. Code is here: http://pastebin.com/m6f29ad06 And it seems to hang when I use it. I'll keep hacking away at it, but please take a glance and let me know if anything is blatantly wrong. My class inherits from component, and is therefore not threaded. It is meant to be a one-off: wait for a string, return it when the client types it. Thank you! Gloria --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups kamaelia group. To post to this group, send email to kamaelia@googlegroups.com To unsubscribe from this group, send email to kamaelia+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/kamaelia?hl=en -~--~~~~--~~--~--~---