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

Do you have questions about writing plugins or scripts in Python? Meet the coders here.

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

Postby krambriw » Thu Apr 17, 2008 9:36 pm

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
krambriw
Plugin Developer
 
Posts: 1144
Joined: Sat Jun 30, 2007 2:51 pm

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

Postby CoderX » Sun Sep 20, 2009 6:59 pm

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

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

Postby Bartman » Tue Sep 22, 2009 6:29 pm

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

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

Postby CoderX » Wed Sep 23, 2009 9:17 am

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

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

Postby Bartman » Wed Sep 23, 2009 9:20 am

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

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

Postby CoderX » Wed Sep 23, 2009 1:47 pm

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

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

Postby Bartman » Wed Sep 23, 2009 1:48 pm

If you disable the folder in the tree the action is also considered disabled.
Bartman
Plugin Developer
 
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

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

Postby CoderX » Wed Sep 23, 2009 7:34 pm

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


Return to Coding Corner

Who is online

Users browsing this forum: No registered users and 0 guests