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

Aleksey Lim alsroot at activitycentral.org
Mon Feb 14 17:23:25 EST 2011


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:
-- 
1.7.3.4



More information about the Sugar-devel mailing list