[Sugar-devel] [PATCH sugar-toolkit] Cursor moves to beginning while trying to edit activity instance name #2608

Simon Schampijer simon at schampijer.de
Fri Feb 18 09:52:36 EST 2011


On 02/14/2011 05:23 PM, Aleksey Lim wrote:
> This issue is not the same as #1948 but #1948 triggers this one.
> In some cases set_text doesn't change cursor position but not in all cases.
> ---
>   src/sugar/activity/widgets.py |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py
> index a8664d9..8d34855 100644
> --- a/src/sugar/activity/widgets.py
> +++ b/src/sugar/activity/widgets.py
> @@ -201,7 +201,9 @@ class TitleEntry(gtk.ToolItem):
>           self.entry.modify_bg(state, color)
>
>       def __jobject_updated_cb(self, jobject):
> +        prev_pos = self.entry.props.cursor_position
>           self.entry.set_text(jobject['title'])
> +        self.entry.set_position(prev_pos)
>
>       def __title_changed_cb(self, entry, activity):
>           if self._update_title_sid is not None:

Hi Aleksey,

thanks for your patch. From a working point of view your patch does 
mostly get it right. Though it can squash by one character in some 
circumstances since there is still the race between the parties involved 
(update of entry, the gobject.timeout and the jobject_update), 
reproducible when you type a longer title and do a bit of pausing etc.

I will have another look if I can come up with another patch.

Regards,
    Simon
    Simon


More information about the Sugar-devel mailing list