Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

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

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

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

Post 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
CoderX
Posts: 9
Joined: Sun Sep 20, 2009 6:53 pm

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

Post 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
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

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

Post 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
CoderX
Posts: 9
Joined: Sun Sep 20, 2009 6:53 pm

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

Post 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
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

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

Post 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.
CoderX
Posts: 9
Joined: Sun Sep 20, 2009 6:53 pm

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

Post 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
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

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

Post by Bartman »

If you disable the folder in the tree the action is also considered disabled.
CoderX
Posts: 9
Joined: Sun Sep 20, 2009 6:53 pm

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

Post 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
Post Reply