[sugar] [PATCH] Add support for inline renaming of Journal entries

Tomeu Vizoso tomeu at tomeuvizoso.net
Sat Apr 19 06:41:52 EDT 2008


On Wed, Apr 16, 2008 at 6:30 PM, Eben Eliason <eben.eliason at gmail.com> wrote:
> The former patch cut some comments that should have been cut (and now
>  have been) in the initial visual patch.  This eliminates those parts
>  of the patch.

+        self._title_entry.props.widget.connect('focus-out-event',
+
self._title_entry_focus_out_event_cb)

I'd indent the second line just two additional tabs to the right.

+        self._title_entry.connect('key-press-event',
+                                  self._title_entry_key_press_event_cb)

This as well as the above would go inside _create_title_entry().

+        if event.key == hippo.KEY_RETURN:
+            self._set_title(entry.props.text)
+            self._title_entry.set_visible(False)
+            self._title.set_visible(True)
+        elif event.key == hippo.KEY_ESCAPE:
+            entry.props.text = self._title.props.text
+            self._title_entry.set_visible(False)
+            self._title.set_visible(True)

I wonder if hardcoding the return and escape keys are really needed,
or if gtk has a better way of doing this.

+            self._title_entry.set_visible(False)
+            self._title.set_visible(True)

These two lines are repeated after every time we end editing the
title, can this duplication be removed?

+    def _set_title(self, title):
+        if title == '':
+            self._title_entry.props.text = self._title.props.text

I guess that you don't want to let the user remove completely the
title of an entry, can we make it more explicit?

             self._title.props.text = self._format_title() + _(' Activity')
+            self._title_entry.props.text = self._format_title() + _('
Activity')

We have a big problem here: https://dev.laptop.org/ticket/6875 .
"Activity" should be a formatting thing, shouldn't get into the
datastore.

Thanks,

Tomeu


More information about the Sugar mailing list