Page 1 of 1

A __stop__ and __close__ method also for eg.ActionClass???

Posted: Thu Apr 17, 2008 9:36 pm
by krambriw
Hi,
I'm currently working on a plugin for a scheduler based on ideas and code structure from Bartman's Timer plugin.

I think it would be a good thing to have a __stop__(self) and a __close__(self) method also for egActionClass.

You can see this in Bartman's Timer plugin when you have defined and started some timers. If you delete or stop them, they still keep running and you have to abort them separatly. Also it would be good to have a method to start/run when you apply/save the settings.

Best regards, Walter

Re: A __stop__ and __close__ method also for eg.ActionClass???

Posted: Sun Sep 20, 2009 6:59 pm
by CoderX
Hi,

I'm also missing these functions. For a specific plugin I'm writing I need a __stop__ function in eg.ActionBase.

What is actually called when a action item is disabled?

CoderX

Re: A __stop__ and __close__ method also for eg.ActionClass???

Posted: Tue Sep 22, 2009 6:29 pm
by Bartman
CoderX wrote:I'm also missing these functions. For a specific plugin I'm writing I need a __stop__ function in eg.ActionBase.

What is actually called when a action item is disabled?
Actually nothing is called.
An action has no concept of running, stopping ot other means in that direction. It is just called when appearing in a macro. The time an action is running is just the execution time of call function.
It didn't bothered me while coding the Timer plugin

Re: A __stop__ and __close__ method also for eg.ActionClass???

Posted: Wed Sep 23, 2009 9:17 am
by CoderX
Bartman wrote:It didn't bothered me while coding the Timer plugin
Hi Bartman,

I studied the timer plugin code, you used another action to abort the timer. This is perfectly fine. I'm currently writing a cron plugin, I could also add an action to abort the cron job.

I think for the end-user it is more logical that if "disable item" is selected for an action the execution of the action really stops. Thus in my case the cron job is canceled and is scheduled again if the user enables the action.

So strictly __stop__ it is not needed for programming but I think to be able to disable an action is more logical for the end-user and would fit perfectly in the EventGhost concept.

~CoderX

Re: A __stop__ and __close__ method also for eg.ActionClass???

Posted: Wed Sep 23, 2009 9:20 am
by Bartman
action are continously disabled when using the very central "enable exclusive" action.
Keeping track of that would certainly screw my mind in a larger config.

Re: A __stop__ and __close__ method also for eg.ActionClass???

Posted: Wed Sep 23, 2009 1:47 pm
by CoderX
Bartman wrote:action are continously disabled when using the very central "enable exclusive" action.
Keeping track of that would certainly screw my mind in a larger config.
Don't know what this means, but sounds like "can not be implemented" :) .

~CoderX

Re: A __stop__ and __close__ method also for eg.ActionClass???

Posted: Wed Sep 23, 2009 1:48 pm
by Bartman
If you disable the folder in the tree the action is also considered disabled.

Re: A __stop__ and __close__ method also for eg.ActionClass???

Posted: Wed Sep 23, 2009 7:34 pm
by CoderX
I see now, this gives different thoughts about implementing the plug-in. The problem I created was that I wanted to disable the cron job within the action. In this situation there must be something that tells the action that it is disabled :?. Better way is to tell the plug-in to disable a cron job (by an action). A cron plugin could be programmed as following:

Within eg.PluginBase the cron scheduler process runs. Two actions are defined, one to start a schedule, one to stop a schedule. The action's can access the scheduler trough "self.plugin".

So the cron job is disabled by executing a "job disable action" and not by disabling the the action.

No more need for __stop__ :)

~CoderX