For example, I want to get the '28.00' bit from an event like:
System.Volume '28.00'
And call
MyPlugin.SetVolumeAbsolute(28)
I'm using the Python and XML code below, but getting this error.
TypeError: __call__() takes exactly 2 arguments (1 given)
Do I need to pass a reference to self into __call__(self, volume) or something? If so, how do I do that from the XML script?
My Action looks like this:
Code: Select all
class SetVolumeAbsolute(eg.ActionBase):
...
def __call__(self, volume):
return self.plugin.setVolumeAbsolute(volume)
def Configure(self, volume=25):
panel = eg.ConfigPanel(self)
valueCtrl = panel.SpinIntCtrl(volume, min=0, max=100)
panel.AddLine("Set absolute volume to", valueCtrl)
while panel.Affirmed():
panel.SetResult(valueCtrl.GetValue())
Code: Select all
<Macro Name="MyPlugin: Set Absolute Volume" Expanded="True">
<Event Name="System.Volume" />
<Action>
MyPlugin.SetVolumeAbsolute(int(round(eg.event.payload)))
</Action>
</Macro>
Thanks,
Sam.