[Sugar-devel] [PATCH v2 sugar] Disable Start menu item for entries that can't be opened(Bug#328)

Frederick Grose fgrose at gmail.com
Fri Oct 15 08:19:09 EDT 2010


On Fri, Oct 15, 2010 at 7:06 AM, Mukul Gupta <mukul at seeta.in> wrote:

> Please find the explanation to the patch in the comments.
>
> On Fri, Oct 15, 2010 at 4:19 PM, Mukul Gupta <mukul at seeta.in> wrote:
>
>> The patch disables the Start and Start With menu items for files
>> which can't be opened by any installed activity and instead
>> replace it with a hover dropdown with a menu item 'No activity
>> installed to start entry'
>> ---
>>  src/jarabe/journal/palettes.py |   38
>> +++++++++++++++++++++++---------------
>>  1 files changed, 23 insertions(+), 15 deletions(-)
>>
>> v1->v2: Patch remade as per pep8 standards
>>
>> diff --git a/src/jarabe/journal/palettes.py
>> b/src/jarabe/journal/palettes.py
>> index 7c3e5ff..2ab93fe 100644
>> --- a/src/jarabe/journal/palettes.py
>> +++ b/src/jarabe/journal/palettes.py
>> @@ -62,22 +62,30 @@ class ObjectPalette(Palette):
>>         Palette.__init__(self, primary_text=title,
>>                          icon=activity_icon)
>>
>> -        if metadata.get('activity_id', ''):
>> -            resume_label = _('Resume')
>> -            resume_with_label = _('Resume with')
>> -        else:
>> -            resume_label = _('Start')
>> -            resume_with_label = _('Start with')
>> -        menu_item = MenuItem(resume_label, 'activity-start')
>> -        menu_item.connect('activate', self.__start_activate_cb)
>> -        self.menu.append(menu_item)
>> -        menu_item.show()
>>
>
> """
> The function misc.get_activities(metadata) checks whether the file can be
> opened by any installed activity. If it is True, then Menu items Start and
> Start with are displayed
> """
>
>
>> +        if misc.get_activities(metadata):
>> +            if metadata.get('activity_id', ''):
>> +                resume_label = _('Resume')
>> +                resume_with_label = _('Resume with')
>> +            else:
>> +                resume_label = _('Start')
>> +                resume_with_label = _('Start with')
>> +            menu_item = MenuItem(resume_label, 'activity-start')
>> +            menu_item.connect('activate', self.__start_activate_cb)
>> +            self.menu.append(menu_item)
>> +            menu_item.show()
>>
>> -        menu_item = MenuItem(resume_with_label, 'activity-start')
>> -        self.menu.append(menu_item)
>> -        menu_item.show()
>> -        start_with_menu = StartWithMenu(self._metadata)
>> -        menu_item.set_submenu(start_with_menu)
>> +            menu_item = MenuItem(resume_with_label, 'activity-start')
>> +            self.menu.append(menu_item)
>> +            menu_item.show()
>> +            start_with_menu = StartWithMenu(self._metadata)
>> +            menu_item.set_submenu(start_with_menu)
>> +
>>
> """
> If misc.get_activities(metadata) is False, the entries Start and Start with
> are replaced by a single frozen Menu entry stating " No activity installed
> to start entry"
> """
>

For an uninstantiated Journal entry in Sugar 0.88.1, the 'Start with' menu
item reveals an inactive, side sub-palette with the words 'No activity to
start entry' in gray.

Should we not try to keep the wording consistent for this similar condition?

Adding 'installed' to the terse wording may help the Learner understand, but
it is still quite technical for the general audience.  Would it be better to
use more general wording, such as, "No activity is available to start the
entry."

Since it is a side sub-palette, the additional length should not be a
hindrance, and any additional clarity would better match Sugar's goals.

In messages like this, a grammatically complete sentence (also ending with a
period) is also very helpful and instructive for Learners.

In summary, if this reasoning is accepted, the sub-palette message should be
changed in at least 2 places.

           --Fred

 +        else:
>> +            resume_label = _('No activity installed to start entry')
>> +            menu_item = MenuItem(resume_label)
>> +            menu_item.set_sensitive(False)
>> +            self.menu.append(menu_item)
>> +            menu_item.show()
>>
>>         client = gconf.client_get_default()
>>         color = XoColor(client.get_string('/desktop/sugar/user/color'))
>> --
>> 1.7.0.4
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20101015/55bd4627/attachment.html>


More information about the Sugar-devel mailing list