After much ado, here is the resulting patch.
- Eben
On Fri, Apr 25, 2008 at 2:17 PM, Tomeu Vizoso <[EMAIL PROTECTED]> wrote:
>
> On Wed, Apr 23, 2008 at 10:05 PM, Eben Eliason <[EMAIL PROTECTED]> wrote:
> >
> > On Wed, Apr 23, 2008 at 3:52 PM, Tomeu Vizoso <[EMAIL PROTECTED]> wrote:
> > > On Wed, Apr 23, 2008 at 9:45 PM, Eben Eliason <[EMAIL PROTECTED]> 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
>
From c2e1c3fc756550d9ce3b2d609ee499a6314780b7 Mon Sep 17 00:00:00 2001
From: Eben Eliason <[EMAIL PROTECTED]>
Date: Thu, 24 Apr 2008 05:00:18 -0400
Subject: [PATCH] Fix appearance of activity bundles
---
collapsedentry.py | 22 +++++++++-------------
expandedentry.py | 10 ++--------
palettes.py | 2 +-
3 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/collapsedentry.py b/collapsedentry.py
index c99208a..1abc7de 100644
--- a/collapsedentry.py
+++ b/collapsedentry.py
@@ -192,12 +192,6 @@ class CollapsedEntry(hippo.CanvasBox):
buddies = []
return buddies
- def _format_title(self):
- if self.jobject.metadata.has_key('title'):
- return '%s' % self.jobject.metadata['title']
- else:
- return '%s' % _('Untitled')
-
def _update_visibility(self):
in_process = self._is_in_progress()
@@ -323,21 +317,23 @@ class CollapsedEntry(hippo.CanvasBox):
self._icon.props.file_name = misc.get_icon_name(jobject)
if jobject.is_activity_bundle():
self._icon.props.fill_color=style.COLOR_TRANSPARENT.get_svg()
- self._icon.props.stroke_color=style.COLOR_BLACK.get_svg()
- self._title.props.text = self._format_title() + _(' Activity')
- self._title_entry.props.text = self._format_title() + _(' Activity')
+ self._icon.props.stroke_color=style.COLOR_BUTTON_GREY.get_svg()
else:
if jobject.metadata.has_key('icon-color') and \
jobject.metadata['icon-color']:
self._icon.props.xo_color = XoColor( \
jobject.metadata['icon-color'])
else:
- self._icon.props.xo_color = None
- self._title.props.text = self._format_title()
- self._title_entry.props.text = self._format_title()
+ self._icon.props.xo_color = None
- self._icon.set_palette(ObjectPalette(jobject))
+ if jobject.metadata.get('title', ''):
+ title_text = jobject.metadata['title']
+ else:
+ title_text = _('Untitled')
+ self._title.props.text = title_text
+ self._title_entry.props.text = title_text
+ self._icon.set_palette(ObjectPalette(jobject))
self._buddies_list.set_model(self._decode_buddies())
if jobject.metadata.has_key('progress'):
diff --git a/expandedentry.py b/expandedentry.py
index 693a41c..9534c4d 100644
--- a/expandedentry.py
+++ b/expandedentry.py
@@ -160,7 +160,7 @@ class ExpandedEntry(hippo.CanvasBox):
if self._jobject.is_activity_bundle():
icon.props.fill_color=style.COLOR_TRANSPARENT.get_svg()
- icon.props.stroke_color=style.COLOR_BLACK.get_svg()
+ icon.props.stroke_color=style.COLOR_BUTTON_GREY.get_svg()
else:
if self._jobject.metadata.has_key('icon-color') and \
self._jobject.metadata['icon-color']:
@@ -174,13 +174,7 @@ class ExpandedEntry(hippo.CanvasBox):
def _create_title(self):
title = CanvasEntry()
title.set_background(style.COLOR_WHITE.get_html())
-
- text = self._jobject.metadata.get('title', _('Untitled'))
- if self._jobject.is_activity_bundle():
- title.props.text = text + _(' Activity')
- else:
- title.props.text = text
-
+ title.props.text = self._jobject.metadata.get('title', _('Untitled'))
title.props.widget.connect('focus-out-event',
self._title_focus_out_event_cb)
return title
diff --git a/palettes.py b/palettes.py
index 2eb389e..00275bf 100644
--- a/palettes.py
+++ b/palettes.py
@@ -44,7 +44,7 @@ class ObjectPalette(Palette):
activity_icon.props.xo_color = \
XoColor(jobject.metadata['icon-color'])
else:
- avtivity_icon.props.xo_color = \
+ activity_icon.props.xo_color = \
XoColor('%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
style.COLOR_TRANSPARENT.get_svg()))
--
1.5.3.3
_______________________________________________
Sugar mailing list
[email protected]
http://lists.laptop.org/listinfo/sugar