[08:15] < aa_> morning |
[08:16] *** aa_ wrote an app with kamaelia last night |
[08:16] < aa_> "app" |
[09:18] < aa_> MS-: around? |
[09:18] < aa_> or anyone |
[09:19] < aa_> I can't see how I can prevent my components from all spinning at 100% cpu |
[09:19] < aa_> they both do... or maybe they should, or maybe I am doing something wrong |
[09:32] *** Davbo has joined #kamaelia |
[09:42] < MS-> Hi - instead of just |
[09:42] < MS-> yield 1 |
[09:42] < MS-> do |
[09:42] < MS-> if not self.anyReady(): |
[09:42] < MS-> self.pause() |
[09:42] < MS-> yield 1 |
[09:43] < MS-> That self.pause() tells the schedule "don't call me until a message comes my way" |
[09:43] < MS-> What was the app? |
[09:43] *** MS- reading back |
[09:43] < MS-> afternoon davbo |
[09:43] < Davbo> Afternoon all |
[09:44] < Davbo> stopping 100% CPU? |
[09:45] *** Davbo is experiencing deja vu |
[09:52] < aa_> Davbo: well, seems as though all my component while 1: loops are running tightly |
[09:53] < aa_> Davbo: this is a simple one: http://paste.pocoo.org/show/87001/ |
[09:54] < aa_> when I hook that in a pipeline with a console echoer, I get 100% cpu usage |
[09:54] < aa_> MS-: oh god, I failed tor ead your reply again :) |
[09:54] < aa_> MS-: thanks |
[09:55] *** Davbo nods |
[09:55] < MS-> that'll change to send the date/time on demand |
[09:55] < MS-> If you want that to send a message periodically you can do the same sort of thing that I discussed with Ben on the IRC channel a few days back and then summarised in the email message to the list |
[09:55] *** MS- digs out link |
[09:56] < MS-> http://groups.google.com/group/kamaelia/browse_thread/thread/d1928975f238061d |
[09:56] < MS-> Specifically the difference between version 1 & version 2 |
[09:58] < MS-> http://paste.pocoo.org/show/87002/ - will send a message once per second |
[09:59] < Davbo> am i right in thinking Python 2.6 doesn't break backwards compatibility but 3 will? |
[09:59] < MS-> correct |
[10:00] < aa_> MS-: but I have a small problem |
[10:00] < MS-> what's the problem? |
[10:00] < aa_> let me collect my thoughts |
[10:00] < MS-> k |
[10:01] < aa_> MS-: ok, it all boils down to the fact that the gtk main loop must block, and also must be running in the main thread |
[10:01] < aa_> MS-: so I can write a fake mainloop in python |
[10:01] < aa_> while 1: if events_pending(): iterate_the_loop() |
[10:01] < aa_> and use that in kamaelia |
[10:02] < aa_> MS-: otherwise I can think how to write a main() that blocks indefinitely |
[10:02] < MS-> Did you know you can put the kamaelia scheduler into a background thread ? |
[10:02] < aa_> MS-: now you are talking |
[10:03] < aa_> MS-: that means I can run the main loop in gtk, and let kamaelia live in a thread |
[10:03] < aa_> ? |
[10:03] < MS-> Yes |
[10:03] < MS-> from Axon.background import background |
[10:03] < MS-> background().start() |
[10:03] < aa_> awesome, where were you at 4am last night! |
[10:03] < MS-> sleeping :-D |
[10:03] < aa_> :) |
[10:03] < Davbo> "now you are talking" /me chuckles |
[10:04] *** MS- gentley makes a reminder about Lawouach's cool PyQT code |
[10:04] < aa_> MS-: yeah, I can't actually find that |
[10:04] < MS-> ah I see |
[10:05] < aa_> oh wait, I can |
[10:05] < MS-> http://trac.defuze.org/wiki/jlib |
[10:06] < MS-> https://svn.defuze.org/oss/jlib/jlib/core/qaxon.py |
[10:07] < aa_> yeah just looking at that |
[10:07] < MS-> cool |
[10:07] < aa_> it makes sense now |
[10:07] < aa_> it made no sense the first time |
[10:07] < aa_> because I don't know axon, or qt :) |
[10:08] < aa_> MS-: still my main() will never yield, is that ok? |
[10:09] *** Davbo has seen a lot of positive / constructive feedback after PyCon UK |
[10:09] < Davbo> I see why you do these things MS- |
[10:10] < aa_> PassThrough just passes inbox -> outbox ? |
[10:11] < Davbo> Yeah, use it to avoid having to recv and send the same data in 1 component (if that makes sense) |
[10:12] < aa_> yeah |
[10:13] < Davbo> for example: http://code.google.com/p/kamaelia/source/browse/branches/private_DK_PaintDev/Kamaelia/Kamaelia/Apps/Paint/ToolBox.py |
[10:13] < Davbo> the UI widgets just post to outbox that way |
[10:17] < MS-> "still my main() will never yield, is that ok" |
[10:17] < MS-> If you mean your front app, then yes |
[10:17] < aa_> MS-: yeah just got it |
[10:17] < MS-> or rather your GTK mainloop never yields, yes |
[10:17] < aa_> I don't have to run a loop in my gtkcomponent's main any more |
[10:18] < MS-> background literally just throws the scheduler in the background |
[10:18] < aa_> MS-: I just create the pipeline and call background().start() ? |
[10:19] < MS-> aa_: yep or after |
[10:19] < MS-> background().start() |
[10:19] < MS-> Pipeline( ... ).activate() |
[10:19] < MS-> while 1: |
[10:19] < MS-> time.sleep(1000) |
[10:19] < MS-> that pipeline will run happily despite the foreground being blocking |
[10:19] < MS-> or completely blocked |
[10:20] < aa_> alright! |
[10:21] < aa_> ok, I was not grabbing the gtk thread lock |
[10:22] < MS-> Davbo: Yeah - you get different amounts of feedback at different conferences, but invariably its always good to go talk to people and find out what people do/don't like since its the only way things improve |
[10:22] < MS-> I'll probably be working some more on the website this weekend |
[10:23] < Davbo> If you decide to go with a developer Planet i'll happily contribute |
[10:23] < MS-> Cool, in which case that's the plan then :) |
[10:26] < Davbo> cool :-) |
[10:28] < aa_> and now I got to the point where it is timecomponent giving me more jip than gtkcomponent |
[10:30] < aa_> and ok, I officially have a gtk kamaelia application |
[10:30] < MS-> Wooo ! |
[10:30] < MS-> :-) |
[10:30] < MS-> fantastic :) |
[10:30] < aa_> yes, really is |
[10:31] < aa_> except now I really need to abstract out this threading stuff |
[10:31] < MS-> Yeah, but we all know it's easier to tidy things up than to get something working initially :) |
[10:31] < MS-> congrats :) |
[10:31] < aa_> MS-: basically any time I call the UI from a kamalia component I have to make sure I get a thread lock, or make sure I add whatever function as agtk idle call |
[10:32] < aa_> no doubt I could dig a bit deeper into kamaelia and fix that before a user has to deal with it |
[10:32] < aa_> s/fix/hack/ |
[10:34] < aa_> these things are very tasklety |
[10:34] < aa_> kamaelia components |
[10:34] < MS-> If you post your code up somewhere when you're happy with a work around, I'll take a look and see if there's anything I can suggest that might fit better. Unless you just get something cool done :) |
[10:34] < MS-> Yes |
[10:34] < aa_> on steroids |
[10:35] < aa_> now I need an application |
[10:35] < MS-> If you skip down this page: |
[10:35] < MS-> http://code.google.com/p/kamaelia/source/browse/trunk/Code/Python/Axon/Axon/Component.py |
[10:35] < aa_> BBC radio player! |
[10:35] < aa_> I am addicted to 5 live |
[10:35] < MS-> that'd be fantastic :) |
[10:36] < MS-> to line 625-650 |
[10:36] < aa_> ok |
[10:36] < MS-> You'll see a basic structure that you could think about |
[10:36] < MS-> that or |
[10:37] < MS-> lines 487 - 510 (_microprocessGenerator) in http://code.google.com/p/kamaelia/source/browse/trunk/Code/Python/Axon/Axon/Microprocess.py |
[10:37] < MS-> The latter is perhaps more appropriate |
[10:37] < MS-> Without knowing what you're doing with gtk, I'm not sure about that of course :) |
[10:37] < aa_> ok, so far have conveniently ignore microprocessors |
[10:38] < MS-> Yep, I'm not saying you should have to care about it, but that it might give you some ideas |
[10:38] < MS-> :) |
[10:41] < aa_> ok brb |
[10:42] < aa_> MS-: looks like all I probably need to do is wrap the pc.next() with thread lock/unlock |
[10:44] < aa_> it came to me in a flash: kamaelia is a library not a framework |
[10:44] < aa_> I was looking for too much "integration" |
[10:44] < aa_> I can make my ui as normal and just let kamaelia do the heavy lifting |
[10:48] < MS-> yep. Kamaelia looks very much like a framework, but it's designed to be one that is relatively lightweight and keeps out of the way |
[10:49] < MS-> After all Axon is actually the frameworky bit, and kamaelia itself is just a bunch of components |
[11:03] < Davbo> Okay, so i've installed 2.6. Can I make a symbolic link or something so I don't need to install everything that's in 2.5's site packages again? |
[11:03] < aa_> Davbo: you probably don't want to do that (imo) |
[11:03] < aa_> best reinstall the stuff you need |
[11:04] < Davbo> Fair enough |
[11:04] < aa_> people do funny things like check version on install etc |
[11:05] < Davbo> ah i see |
[11:05] < aa_> and c suff might be problematic if the c api changed |
[11:17] < aa_> MS-: well, its actually quite pretty http://paste.pocoo.org/show/87005/ |
[11:19] < aa_> ahven't done message sending, just receiving |
[11:20] < aa_> not sure if I would need to schedule the out emssages or can just call component.send from anywhere |
[11:24] < Davbo> looks good aa_ |
[11:25] < aa_> I would have put the component and the bridge in the same class, but it won't let me subclass both |
[11:29] < MS-> very nice - and it runs :) |
[11:29] < aa_> hehe |
[11:30] < aa_> ok, well sending works too |
[11:31] < aa_> I can just call component.send() from anywhere and it seems to work |
[11:31] < aa_> MS-: one issue still I want to make the signals generic |
[11:33] < aa_> um.. I mean it's not always "inbox" is it |
[12:16] < aa_> ok I blogged a little bit about kamaelia |
[12:16] < aa_> http://unpythonic.blogspot.com/2008/10/what-twisted-could-learn-from-kamaelia.html |
[12:37] < Davbo> Sounds like you're having licensing fun with PIDA aa_ |
[12:38] < aa_> Davbo: :) |
[12:39] < aa_> Davbo: to be honest, I rather would say "so sue me" |
[12:39] < aa_> and then I'll take pida underground, and release it on torrent sites |
[12:42] < Davbo> Hah |
[12:44] *** vmlemon has joined #kamaelia |
[12:44] *** aa_ has joined #kamaelia |
[12:47] < Davbo> it's funny, open source is supposed to be all about the community getting stuff done together. But we can't even use each others code. |
[12:47] < Davbo> it's no wonder whenever I talk to other students at Uni about getting involved with open source nobody is interested |
[12:53] < aa_> right |
[13:06] < Davbo> You could always try Beerware or WTFPL aa_ |
[13:50] *** aa_ has joined #kamaelia |
[15:43] *** Davbo has joined #kamaelia |