Re: [gnome-mud] timer/ticker plugin



Good news!

Quim definitely had a good idea going there. Apparently gtk.timeout_add
is deprecated in favour of gobject.timeout_add, so I'm using the gobject
version.

But it does seem to work.

Here's the simplest plugin possible that accomplishes the desired task.

Cheers,
Mike



Quim Rovira wrote:
> Btw, shouldn't you be trying to set a GTK trigger event instead? Sound
> much more easy, and as far as i know, there's good support for gtk in
> python :)
> 
> Anyway, i would encourage trying anything but threads, as that's
> always a bugnest.. I would try to create the plugin myself, but sadly,
> i'm quite away of my linux box.. hope the idea works!
> 
> On 7/21/06, Mike Ginou <mike ginou ca> wrote:
>> Well..... it doesn't seem to work.
>>
>> I didn't think that sleep would work....and indeed it doesn't. Because
>> using a sleep function would not allow the initialization of the python
>> plugins to complete.
>>
>> So instead I tried using threading.Timer, but the timer is never able to
>> elapse. Probably this has to do with the interaction of the python
>> interpreter and the C gnome-mud code.
>>
>> The end result is that I cannot think of a way to get your simple plugin
>> to work using python. Maybe a C plugin will work? Maybe I'll take a
>> look :)
>>
>> Cheers,
>> Mike
>>
>> Mike Ginou wrote:
>> > Yeah it'd be something like that.  Of course, I don't really know
>> python
>> > either. But I have a few plugin examples to go on. :)
>> >
>> > 007919 wrote:
>> >> On 7/19/06, Mike Ginou <mike ginou ca> wrote:
>> >>> How many of these triggers would you plan on setting?
>> >> Just one.
>> >>
>> >>> And what do you envision a typical value for n being?
>> >> 60 seconds.
>> >>
>> >> I know perl, but not python, so I could figure out enough to modify
>> >> anything  you write.
>> >>
>> >> I was thinking something like time.sleep(60); send('this to mud
>> >> server'); in a loop. But like I said, I don't know python nor the
>> >> gnomemud API.
>> >>
>> >> Thanks.
>> >
>> _______________________________________________
>> gnome-mud-list mailing list
>> gnome-mud-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gnome-mud-list
>>
#!/usr/bin/python

import GnomeMud
import gobject

def wink ():
	GnomeMud.connection().send(":winks\n")
	return True

gobject.timeout_add(60000,wink)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]