IRC Logs for #circuits Friday, 2013-10-25

An_Ony_MooseAlso, I'd appreciate if anyone could tell me if I'm misusing circuits terribly there :D00:05
An_Ony_MooseOk enough programming, it's 2am. Good night!00:10
prologicwait00:11
prologicif you have 5mins :)00:11
prologicI just want to say a few things on that note00:11
prologic1) are you using circuits-dev?00:11
prologicBecause you _should_ be :)00:11
prologicThe features in circuits-dev will allow you to do this more easily00:11
prologicwhere you can write sunchronous event handlers00:11
prologicthat are still asynchronous underneath00:11
prologicso you don't need to keep track of components00:12
prologicor any fancy extra queuing on top00:12
prologicAn_Ony_Moose:  the only thing I can see00:13
prologicis your update() method00:13
prologicyou don't need to do this quite like this00:13
prologicyou can write a pygame event source00:14
prologichave a look at circuits/core/pollers.py circuits/core/timers.py and circuits/io/process.py in the circuits-dev repo00:14
prologicfor example of how to do this00:14
prologicbasically you just need to write an event handler called00:14
prologicgenerate_events00:14
prologiciterate over your pygame events and map them into circuits ones in a generic way00:15
prologicand never have to worry about it again00:15
*** ninkotech has quit IRC02:01
*** ninkotech has joined #circuits02:16
An_Ony_Mooseprologic: ok, I'll take a look at that :) thanks!09:52
An_Ony_Moose(time zones are annoying... I'm in Europe)10:05
An_Ony_MooseAnyway, if I should be using the circuits-dev version, then doesn't that mean you should make a release? :)10:13
An_Ony_MooseMmmmyeah I think I won't use the dev version, for the person I'm working with I don't even think it will be easy installing circuits with pip...10:22
An_Ony_MooseIs there a way to avoid a component receiving/handling any events before it has handled the registered event created by its own registration?10:49
prologicyou can easily install circuits-dev with pip11:06
prologicpip install -e hg+https://bitbucket.org/circuits/circuits-dev#egg=circuits11:06
prologicThe reason we haven't releasedd yet is there are still things to do11:06
prologicand we've decided on a 3.0 release next year11:07
prologicwhich will be our 10th year of development11:07
prologicwe also don't release as often as we'd like11:07
prologicbecause we lack the development resources11:07
prologic-however-11:07
prologicwe do continious integration (testing)11:07
prologicso circuits-dev is always assured to be stable11:07
prologicAn_Ony_Moose> Is there a way to avoid a component receiving/handling any events before it has handled the registered event created by its own registration? <-- no single-liner way of doing this , no11:08
prologicyou just have to sequence your events better :)11:08
prologiconce you get the registered event11:08
prologicit's ready to go!11:08
prologicinternally we do fire ready events for when sockets and pollers are ready to start processing events11:09
prologiconce a socket has registered and found a poller11:09
prologicit fires ready11:09
prologicthis is then in-turn used to then kick off other events like connect11:09
prologicin tcp clients for example11:09
prologicso like I say11:09
prologicsequence your events in the right order :)11:09
prologicmake other events depend on other events11:09
prologicin the order you want them to happen11:10
prologicthere is also the .wait() and .call() synchronous primitives11:10
prologicwhereby you can wait for particular events to have occured inside an event handler11:10
prologicor syncchronously call and wait for an event using call()11:10
prologicNB: but it's still all async underneath however11:10
pdurbinprologic: does https://bitbucket.org/prologic/irclogger have it's own channel on freenode? to discuss the project itself?14:26
An_Ony_Mooseprologic: Uh, my mistake... I had a race condition and thought that it was caused by a Component receiving events before the registered event, but it turns out I'm just stupid :)14:46
An_Ony_Moosedoes a channel have to be a string?14:55
*** ninkotech has quit IRC16:43
*** ninkotech has joined #circuits16:45
*** ninkotech has quit IRC17:16
*** ninkotech has joined #circuits17:20
*** ninkotech has quit IRC17:56
*** ninkotech has joined #circuits17:59
*** ninkotech has quit IRC18:10
*** ninkotech has joined #circuits18:13
*** ninkotech has quit IRC18:21
*** ninkotech has joined #circuits18:24
*** ninkotech has quit IRC19:33
*** ninkotech has joined #circuits19:37
prologicpdurbin> prologic: does https://bitbucket.org/prologic/irclogger have it's own channel on freenode? to discuss the project itself? <-- no21:34
prologichere is fine :)21:34
prologicit's only 300 LOC :)21:34
prologicAn_Ony_Moose, no21:35
prologicany hashable objects will work just fine afaik21:35
prologicwe've not really tested this though21:35
prologicsorry :)21:35
prologicperhaps we should write unit tests that do test that21:35
prologicin theory it should be possible21:35
prologicthe handler cache is just a regular dict21:35
prologicso any hashable object should be capable of being used as keys21:35
prologicfor both channels and handlers21:36
prologicNB: we chose to use strings everywhere in the framework and it's library however because:21:36
prologicthey normally map on to methods of the same name as the event they are listening to21:36
prologicso therefore it's silly to define your event handler such as:21:36
prologic@handler(int)21:36
prologicdef _on_int(self, event, *args, **kwargs):21:36
prologic   ...21:36
prologicI imgine some code later on would do:21:37
prologicself.fire(int(12))21:37
prologicproblem is this would not work as such21:37
prologicas the hash of int is not the same as the has of int(12)21:37
prologicwe don't do type checks for event/channels matching21:37
prologicas that would be very expensive :)21:37
An_Ony_Mooseprologic: because I want to have "draw groups" where the draw manager would wait for everything in one group to finish drawing before starting to draw the other21:52
An_Ony_Mooseand figured using channels would be nice for that because it allows sending the event only to the members of the right group, and sorting them21:53
prologicuse sub channels then22:01
prologice.g:22:01
prologicclass Foo(Component):22:01
prologic   channel = "foo"22:01
prologicclass SubFoo(Component):22:01
prologic   channel = "foo.subfoo"22:01
prologicor something :)22:01
prologicyes channels are used for that22:02
prologicto separate potentially identical events from similar components22:02
prologicor group components together22:02
prologicwhere the group would listen to their respective events22:02
prologicbut only if fired to the channel they're on22:02
prologicbut only if fired to the channel they're on22:03
prologic;'ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp,l22:04
prologicoops22:04
prologicmy daughter did that :)22:04
prologicback later22:04
prologicgoing out for breakfast, etc22:04
prologicweekend and all :)22:04
pdurbinprologic: ok. thanks. :)22:29
An_Ony_Mooseprologic: thanks from me too :P22:51
pdurbinAn_Ony_Moose: thanks for staying on topic, unlike me :)22:56
An_Ony_Moosepdurbin: I don't think it's very off-topic :P22:57
pdurbin:)22:57
An_Ony_Moosehttp://candybox2.net/ This is off-topic but it's fun :D23:15

Generated by irclog2html.py 2.11.0 by Marius Gedminas - find it at mg.pov.lt!