[Sugar-devel] Proposed solution to OLPC #10930

manuel quiñones manuel.por.aca at gmail.com
Tue Jun 28 06:54:07 EDT 2011


2011/6/23 Gonzalo Odiard <gonzalo at laptop.org>:
> I was working in the solution of OLPC #10930 "copy/paste does not work in if
> one has not revealed the edit toolbar once"
> The problem can be reproduced in activities with the new toolbars, like
> Terminal or Browse.
> For example, in Terminal, if you open the activity, select a text and press
> "Shift-Ctrl-C", nothing is copied,
> if you show the Edit toolbar and try pressing "Sift-Ctrl-C" again, the text
> is copied.
> The same happen in Browse with "Ctrl-C"
> I have worked in two different solutions:
> 1) 0001-Update-accelerators-when-the-toolbar-is-set-in-the-a.patch
> The patch walk the objects in the toolbar_box when is set in the activity
> and update the accelerators.
> This patch resolve the problem in activities Terminal and Browse without
> changing the activities.
> If in one activity the programmer set the toolbar_box in the activity before
> adding all the buttons,
> must call the update_accelerators methods after add the controls.
> Additionally, we can remove the 'hierarchy-changed' signal handlers in
> toolbutton.py
> 0001-Remove-hierachy-changed-signal-handlers-in-toolbutto.patch
> This code is called many times at the start of the activity, and later every
> time we show or hide a toolbar.
> 2) Another solution is
> 0001-Pack-page-in-ToolbarButton-when-is-conected-to-the-w.patch
> I don't like it, but is a fix using the same technique used in
> toolbutton.py,
> Uses the 'hierarchy-changed' signal to pack the toolbar to the
> toolbarbutton,
> udating the hierachy of the children and enabling them to setup the
> accelerators.
> The problem with this approach is the code is executed many times, because
> the toolbars
> change the parents every time are visible/invisible.
> Comments?

Tested both solutions.  I think the first one is the better approach.
And the removal of the hierarchy changed callback is very good too.
This is a critical bug so we need to have this in git soon.

.. manuq ..

More information about the Sugar-devel mailing list