Re: [Rhythmbox-devel] startView() takes exactly 1 argument (3 given)



Hi Ron,
your callback function should look like this:

def startView(self, widget, shell)

because GTK Connect supplies the widget that is connected, too.

Am Dienstag, den 29.12.2009, 09:40 -0500 schrieb Ron Croonenberg:
> Hello,
> 
> I am (trying) to write a plugin for rhythmbox (in python) and keep 
> running into an error msg from an action from the toolbar
> 
> I am adding a 'button' to the toolbar and when it's clicked execute a 
> function/method.
> 
> I get a runtime error every time I click the button, here it is:
> TypeError: startView() takes exactly 1 argument (3 given)
> (It doesn't matter how many arguments I use in the function/method 
> header, the same error-msg shows up.
> 
> I followed the outline in the  rhythmbox plugins writing guide for 
> adding 'an item'.
> 
> Here is the code snippet:
> 
> #
> # the activate thing
> #
> def activate(self, shell):
> self.shell = shell
> 
> view_button = """
> <ui>
>    <toolbar name="ToolBar">
>      <placeholder name="startView">
>        <toolitem name="startView" action="viewAction">
>          </toolitem>
>      </placeholder>
>    </toolbar>
> </ui>
> """
> 
> # create a new action
> action = gtk.Action('viewAction',
>                    _('Start _View'),
>                    _('Browse'), "")
> 
> # connect it
> action.connect('activate', self.startView, shell)
> action_group = gtk.ActionGroup('NewActionGroup')
> action_group.add_action(action)
> shell.get_ui_manager().insert_action_group(action_ group)
> 
> # add it to the toolbar
> ui_manager = shell.get_ui_manager()
> ui_manager.add_ui_from_string(view_button)
> 
> #
> # Start the View
> #
> def startView(self, b, c, d): # tried this with 1, 2, 3, 4, 5... args
> return
> 
> 
> any tips/hints ?
> 
> thanks,
> 
> Ron



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]