timer/ticker plugin

View: New views
4 Messages — Rating Filter:   Alert me  

timer/ticker plugin

by 007919 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Greetings, I am looking for a plugin that will do x ever n seconds.
Can anyone help me out with this?
_______________________________________________
gnome-mud-list mailing list
gnome-mud-list@...
http://mail.gnome.org/mailman/listinfo/gnome-mud-list

Parent Message unknown Re: timer/ticker plugin

by Mike Ginou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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@...
http://mail.gnome.org/mailman/listinfo/gnome-mud-list

Re: timer/ticker plugin

by Les Harris :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The gnome-mud api is..... a joke at the moment.  In 10.7 the plugin api is
in a weird state where more stuff is exposed to python rather than the C api
but the C api is the better/stabler of the two ;)

Only have the usual reassurances this situation will be fixed 'in the
future'.

I'd recommend using the C honestly.

Les

-----Original Message-----
From: gnome-mud-list-bounces@...
[mailto:gnome-mud-list-bounces@...] On Behalf Of Mike Ginou
Sent: Thursday, July 20, 2006 6:59 PM
To: gnome-mud-list@...; 007919
Subject: Re: [gnome-mud] timer/ticker plugin

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@...> 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@...
http://mail.gnome.org/mailman/listinfo/gnome-mud-list

_______________________________________________
gnome-mud-list mailing list
gnome-mud-list@...
http://mail.gnome.org/mailman/listinfo/gnome-mud-list

Parent Message unknown Re: timer/ticker plugin

by Mike Ginou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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@...> 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@...
>> 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)
_______________________________________________
gnome-mud-list mailing list
gnome-mud-list@...
http://mail.gnome.org/mailman/listinfo/gnome-mud-list