Add event at plugin installation

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
Johnson
Posts: 48
Joined: Sun May 24, 2009 9:05 pm

Add event at plugin installation

Post by Johnson » Sun Mar 28, 2010 2:28 pm

I can add Action and Group to custom folder for plugin using AddAction and AddGroup.

Is it possible to automatically add Event (that will be generated with the same plugin) for this action?

It will be interested to see come code example.

stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: Add event at plugin installation

Post by stottle » Sun Mar 28, 2010 4:48 pm

Not possible without a change to the core.

Brett

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Add event at plugin installation

Post by Pako » Mon Mar 29, 2010 1:54 pm

It would be nice if you wrote a bit more detail what you need.
Maybe it's not as impossible as Brett writes.
Please use short and simple sentences.
Good is also use an example.

Pako

Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Re: Add event at plugin installation

Post by Bartman » Mon Mar 29, 2010 3:50 pm

Adding and removing plugin should be limited to configuration.

Johnson
Posts: 48
Joined: Sun May 24, 2009 9:05 pm

Re: Add event at plugin installation

Post by Johnson » Mon Mar 29, 2010 4:24 pm

Pako wrote:It would be nice if you wrote a bit more detail what you need.
OK. I made plugin for SoundGraph iMON device. Device has both "Event" and "Action" functionality.
For example, the iMON remote control has button for toggle between "mouse" and "keyboard" mode of remote control joystick. When button pressed the plugin receive code X and generate Event. Also to really switch hardware plugin must send code Y to hardware.
I can simple send code Y for code X but more powerful to generate event for code X and then map action with code Y for this event. In this case all process are clear and configurable for users.
User can map Event to Action manually after plugin installed.

But can plugin mapped this event automatically?

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Add event at plugin installation

Post by Pako » Mon Mar 29, 2010 6:19 pm

If I understand well, so I have good news for you!
See (for example) plugin USB-UIRT and look in there eg.Bind (and eg.Unbind).
It's what you need?

Pako

stottle
Plugin Developer
Posts: 636
Joined: Sun Apr 26, 2009 10:59 pm

Re: Add event at plugin installation

Post by stottle » Mon Mar 29, 2010 11:31 pm

Pako,

Very nice idea. That should work.

@Johnson - Pako's suggestion should enable what you are looking for, but not the way you (and I) had in mind originally. Bind/Unbind work behind the scenes, so no actions/events are added to the tree (to do this would require a change to the core) and I don't think they show up in the log. However, they would allow you to do what you are looking for within your plugin. So I think it is a great suggestion.

Brett

Post Reply