[Sugar-devel] Cannot write a function definition for a copy button.

Iain Brown Douglas iain at browndouglas.plus.com
Sun Apr 19 06:10:39 EDT 2015


Following a month of Learn Python the Hard Way, I cannot get an Edit
Toolbar to behave fully correctly, in Activity Help, as modified for
SoaS Loader.

I have tried (in various permutations) to make use of code borrowed from
Terminal, Pippy, Develop, Browse, ReadETexts, and Write. I get stuck
just writing a "vanilla" function definition for

`__copy_cb`

as in: `edit_toolbar.copy.connect('clicked', self.__copy_cb)` .

What am I missing?

This "fresh start" approach seems to demonstrate a "most naive" form of
my error.

I take Help-19 as my base (working with sugar-runner, on Fedora 20).

I edit helpactivity.py adding 5 segments [1] of code I borrowed from
Terminal and Pippy.

The resulting modified helpactivity.py is [2].

For this example, no further debugging or "improvements".

The Activity runs, and looks ok, the copy button works to the extent
that the selected text can be pasted with the centre mouse button, but
not with a Sugar Paste button (or Ctrl+Shift+V). When I press the "new"
Copy button, no clipping shows in the Frame.

The Debug error is:

File "~/Activities/SugarTutorial.activity/helpactivity.py", line 194, in
__copy_cb
    text_buffer.copy_clipboard(clipboard)
AttributeError: 'NoneType' object has no attribute 'copy_clipboard'

I guess I am missing something very obvious, grateful if anyone could
throw me a clue.

With thanks,

Iain

[1] http://fpaste.org/212778/
[2] http://ur1.ca/k7fir




More information about the Sugar-devel mailing list