[sugar] [PATCH] Fix appearance of activity bundles (in Journal)

Eben Eliason eben.eliason
Sat Apr 26 10:53:43 EDT 2008


After much ado, here is the resulting patch.

- Eben


On Fri, Apr 25, 2008 at 2:17 PM, Tomeu Vizoso <tomeu at tomeuvizoso.net> wrote:
>
> On Wed, Apr 23, 2008 at 10:05 PM, Eben Eliason <eben.eliason at gmail.com> wrote:
>  >
>  > On Wed, Apr 23, 2008 at 3:52 PM, Tomeu Vizoso <tomeu at tomeuvizoso.net> wrote:
>  >  > On Wed, Apr 23, 2008 at 9:45 PM, Eben Eliason <eben.eliason at gmail.com> wrote:
>  >  >  > Hmm, you mean:
>  >  >  >
>  >  >  >
>  >  >  >  if jobject.metadata.get('title', ''):
>  >  >  >     title_text = jobject.metadata.get('title', '')
>  >  >  >  else
>  >  >  >     title_text = _('Untitled')
>  >  >  >
>  >  >  >  title.props.text = title_text
>  >  >  >  ...
>  >  >  >
>  >  >  >  Do I not need to declare title_text outside the scope of the condition
>  >  >  >  first?  For that matter, is the null string always treated as False in
>  >  >  >  conditions, even though it's distinct from None type?  (Sorry...didn't
>  >  >  >  play in Python much before.)
>  >  >
>  >  >  Sorry, didn't meant that as a literal solution.
>  >  >
>  >  >
>  >  >  >  I supposed there's also:
>  >  >  >
>  >  >  >  title_text = _('Untitled')
>  >  >  >
>  >  >  > if jobject.metadata.get('title', ''):
>  >  >  >     title_text = jobject.metadata.get('title', '')
>  >  >  >
>  >  >  >  title.props.text = title_text
>  >  >
>  >  >  This I don't like much, the person that reads needs to make more
>  >  >  effort to see that you are overriding the var.
>  >  >
>  >  >  This is what I would do:
>  >  >
>  >  >
>  >  >  if jobject.metadata.get('title', ''):
>  >  >    title.props.text = jobject.metadata['title']
>  >  >  else
>  >  >    title.props.text = _('Untitled')
>  >
>  >
>  > I'm not sure I like that much either, since I have to set two things
>  >  to the values.
>  >
>  >
>  > if jobject.metadata.get('title', ''):
>  >     self._title.props.text = jobject.metadata['title']
>  >     self._title_entry.props.text = jobject.metadata['title']
>  >  else
>  >
>  >
>  >     self._title.props.text = _('Untitled')
>  >     self._title_entry.props.text = _('Untitled')
>  >
>  >  Hence, the reason to use a variable instead. Do you prefer this?
>
>  Yes, a 'title' variable is better in this case.
>
>
>  if jobject.metadata.get('title', ''):
>     title = jobject.metadata['title']
>  else
>     title = _('Untitled')
>  self._title.props.text = title
>  self._title_entry.props.text = title
>
>  Tomeu
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-appearance-of-activity-bundles.patch
Type: text/x-patch
Size: 4176 bytes
Desc: not available
Url : http://lists.laptop.org/pipermail/sugar/attachments/20080426/6503b313/attachment-0001.bin 



More information about the Sugar-devel mailing list