View Single Post
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#1625
As for the actions_struct and how I gathered the information on it:

I used this script running in terminal while I went through every possible action in ProfileMatic.

Code:
#!/usr/bin/env python

def my_func(struct):
        for index, item in enumerate(struct[5]):
                print index, item

import dbus, gobject
from dbus.mainloop.glib import DBusGMainLoop
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()

bus.add_signal_receiver(my_func,signal_name="ruleUpdated",dbus_interface="org.ajalkane.profilematic")

loop = gobject.MainLoop()
loop.run()
Every time you save a rule in PM a 'ruleUpdated' -signal is sent out with the whole structure for the rule. The script catches it and prints out the 'actions'-part of the structure chopped to individual actions. You can see the datatype a single action accepts and the index number.

Create an empty rule and give it one action and after saving it you can see which index number has changed. Go through all the actions saving after each change and you can create a fresh list of actions_struct indeces. Simple and tedious but works.
 

The Following User Says Thank You to slarti For This Useful Post: