eg.PluginBase

class eg.PluginBase

Base class of every EventGhost plugin written in Python.

name

The (localised) name of the plugin.

description

The (localised) description of the plugin.

info

Internally used house keeping data. Don’t try to manipulate this yourself.

text

Assign a class with text strings to this field to get them localised. For more information read the section about Internationalisation Support for Plugins.

__start__(*args)

Start/Enable the plugin.

If your plugin is loaded and enabled by the user, this method will be called from EventGhost. Plugins should start its operation now.

The plugin will also receive its parameters (if it has any) through this method. To make a plugin that has parameters, you will have to overwrite the Configure() method also.

__stop__()

Stop/Disable the plugin.

If the user disables the plugin, this method will be called. The plugin should from now on not trigger any events anymore, till it gets another call to its __start__() method.

__close__()

Gets called, if the plugin is about to be closed.

Override this if you have to do some cleanup before your plugin gets unloaded.

Configure(*args)

This should be overridden in a subclass, if the plugin wants to have a configuration dialog.

When the plugin is freshly added by the user to the configuration tree there are no *args and you must therefore supply sufficient default arguments. If the plugin is reconfigured by the user, this method will be called with the same arguments as the __start__() method would receive.

GetLabel(*args)

Returns the label that should be displayed in the configuration tree with the current arguments.

The default method simply shows the plugin name. If you want to have a different behaviour, you can override it. This method gets called with the same parameters as the __start__() method.

AddAction(actionCls, clsName=None, name=None, description=None, value=None, hidden=False)

Adds an eg.ActionBase subclass to this plugin.

The action will then be visible in the AddActionDialog of EventGhost for this plugin (except hidden is set to True).

Through the usage of the clsName, name and description parameters, you can add the same action class multiple times with different names and descriptions. You can then also use the value parameter, to assign some arbitrary data to the action, that the action can then query through its self.value attribute.

Parameters:
  • actionCls – The action class to add
  • clsName – Overrides the actions class name with a string
  • name – Overrides the actions name with a string
  • description – Overrides the actions description with a string
  • value – Some data that you would like to assign to the action
  • hidden – If set to True, the action will not show up in the AddActionDialog but is otherwise fully functional.
AddGroup(name=None, description=None, iconFile=None)

Adds a new sub-group to the AddActionDialog of EventGhost for this plugin.

This group will appear under the group of the plugin. To add actions to this group, store the returned object and call AddAction on it. You can also call AddGroup on the returned object to create even deeper nested sub-groups.

Parameters:
  • name – Name of the sub-group
  • description – Description of the sub-group. Can include HTML tags.
Returns:

The new sub-group instance

Return type:

eg.ActionGroup instance

TriggerEvent(suffix, payload=None)

Trigger an event.

If the plugin wants to trigger an event in EventGhost, it should call self.TriggerEvent with the event name as suffix parameter. It can also post optional additional data through the payload parameter.

Keep in mind, that an event generated through this method will also automatically be ended immediately. If the plugin wants to generate an event with a longer duration, it has to use TriggerEnduringEvent().

TriggerEnduringEvent(suffix, payload=None)

Trigger an enduring event.

Does nearly the same as TriggerEvent() but the event will not be ended immediately. This is used for devices that can have longer enduring events, like a remote, where you can press and hold a button.

The plugin has to call EndLastEvent() to end the event. The last event will also be ended, if another event will be generated through TriggerEvent() or TriggerEnduringEvent(). This will ensure, that only one event per plugin can be active at the same time.

EndLastEvent()

End the last event that was generated through TriggerEnduringEvent().

Previous topic

eg.MessageDialog

Next topic

eg.Scheduler

This Page