On 4/5/2011 10:10 PM Lachlan d said...
I've been working on some python rhythmbox plugins for the past few
months and now i've decided to try writing my own.

You'll get a much better answer if this is asked of other rhythmbox developers. This tutor list in more suited for those just learning to program in python.

You can browse at http://osdir.com/ml/rhythmbox-devel/ and subscribe at
http://mail.gnome.org/mailman/listinfo/rhythmbox-devel

HTH,

Emile



I've been able to get actions working correctly in my other plugin.
(http://launchpad.net/rb-fileorganizer) but that uses buttons and a
gui i built rather than mouse clicks.

What i'm trying to create is a plugin that will perform and action
every time the middle mouse button is clicked in rhythmbox. I haven't
been able to find any solid information about doing this on the net.

The plugin will load but i don't think anything in capture_click is correct.
Any help getting this to just print the test message in the console
would be greatly appreciated!

Here's my code that i've written up so far:

class middleclick(rb.Plugin):

    def __init__(self):
        rb.Plugin.__init__(self)

    # Rhythmbox standard Activate method
    def activate(self, shell):
        self.shell = shell
        self.capture_click(shell)

    # Rhythmbox standard Deactivate method
    def deactivate(self, shell):
        self.shell = None

    # Run test_plugin for middle click
    def capture_click(self, shell):
        self.action = gtk.Action('MiddleClick', _('Middle Click'),
_('Action on Middle Click'), gtk.gdk.BUTTON_PRESS_MASK)
        self.action.connect('activate', self.test_plugin, shell)
        self.action_group = gtk.ActionGroup('OnClickActions')
        self.action_group.add_action(self.action)
        uim = shell.get_ui_manager()
        uim.insert_action_group(self.action_group, 0)
        uim.ensure_update()

    def test_plugin(self, shell):
        if event.button == 2:
            print 'THIS IS AN EVENT'
        else
            print 'WRONG EVENT'
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to