doCommand() bug?

37 views
Skip to first unread message

Phil

unread,
Dec 21, 2021, 9:14:41 PM12/21/21
to leo-editor
In an @button node I have the following text:
      c.doCommand(c.copyOutline, label='Copy Node')

When I click the button, I get the error below:

exception executing script
TypeError: doCommand() got an unexpected keyword argument 'label'

--------------------
  line 2: #@+node:phil.20200202134614.6: * @button Copy Node
* line 3: c.doCommand(c.copyOutline, label='Copy Node')
  line 4: #@-leo
  line 5: 

I am running this:

Leo 6.6b2-devel, devel branch, build f85969ae8c
2021-12-21 06:16:01 -0600
Python 3.7.3, PyQt version 5.12.4
linux

tbp1...@gmail.com

unread,
Dec 22, 2021, 3:25:54 PM12/22/21
to leo-editor
Did this work in the past?  The call signature doesn't match your usage.  Here is the signature of doCommand, from PyLeoRef -

def doCommand(self, command_func, command_name, event):

You could just call c.copyOutline() directly, without invoking c.doCommand()

jkn

unread,
Dec 22, 2021, 4:17:50 PM12/22/21
to leo-editor
It is documented that way here:


So maybe things have changed...

Edward K. Ream

unread,
Dec 23, 2021, 10:20:03 AM12/23/21
to leo-editor
On Wed, Dec 22, 2021 at 3:17 PM jkn <jkn...@nicorp.f9.co.uk> wrote:
It is documented that way here:


Thanks for this.  I have just removed the discussion of doCommand from the documentation from this section in leoDocs.leo and will update the web docs when I return home.

Leo always catches exceptions, so there is no need to complicate the discussion. The section now discusses only c.executeMinibufferCommand.

Edward
Reply all
Reply to author
Forward
0 new messages