Re: [Rhythmbox-devel] capture middle click in plugin
- From: Jonathan Matthew <jonathan d14n org>
- To: rhythmbox-devel gnome org
- Subject: Re: [Rhythmbox-devel] capture middle click in plugin
- Date: Sat, 9 Apr 2011 15:05:44 +1000
On Tue, Apr 5, 2011 at 7:06 PM, Lachlan d <lachlan 00 gmail com> wrote:
> I've managed to get my GUI working on my other plugin and have got
> actions for buttons and all that so things are going well there.
>
> I've been looking at writing another plugin but can't find any
> information on how to run on mouse clicks. (It's all from buttons, etc
> online)
> Basically I want to write a plugin that can perform actions on a
> middle click of the mouse which i'll build on once i get it running.
This is really a GTK question. Rhythmbox doesn't provide any specific
means to do this. Anyway, it depends on what exactly you're trying to
do. If you want to catch middle-click events in specific widgets, you
can probably connect a button-click-event or button-release-event
handler for those widgets. If you want to catch middle clicks anywhere
in the whole application (which doesn't sound like a great idea to me,
but whatever), you might need to use gdk_window_add_filter instead.
> I think the problem is in capture_click but haven't been able to find
> anything to help..
>
> Here's my code that i've written up so far today:
>
> 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'
> _______________________________________________
> rhythmbox-devel mailing list
> rhythmbox-devel gnome org
> http://mail.gnome.org/mailman/listinfo/rhythmbox-devel
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]