[Bugs] #4841 Sugar NORM: Only some newly installed system-wide activities are favorites

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Wed Jun 17 09:09:56 EDT 2015


#4841: Only some newly installed system-wide activities are favorites
---------------------+-------------------------------------
  Reporter:  quozl   |            Owner:
      Type:  defect  |           Status:  new
  Priority:  Normal  |        Milestone:
 Component:  Sugar   |          Version:  Git as of bugdate
  Severity:  Minor   |       Resolution:
  Keywords:          |  Distribution/OS:  Ubuntu
Bug Status:  New     |
---------------------+-------------------------------------
\
\
\
\
\
\

Comment (by godiard):

 I tested the patches and work, but I found the following issues:

 * Add more descriptive header to the commits.
 * In particular, I would merge the first and last patches to make easier
 understand the change.
 * _scan_new_favorites() does not have in account the case of multiple home
 views (see load_favorites).
 * In particular this part is over-complicated:
 {{{
 #!python
         for bundle in self:
             bundle_id = bundle.get_bundle_id()
             key = self._get_favorite_key(
                 bundle_id, bundle.get_activity_version())
             if key not in self._favorite_bundles[_DEFAULT_VIEW] and \
                     bundle_id in hidden_activities:
                 self._favorite_bundles[_DEFAULT_VIEW][key] = \
                     {'favorite': False}
             elif not self._favorite_bundles[_DEFAULT_VIEW].get(key, None):
                 self._favorite_bundles[_DEFAULT_VIEW][key] = \
                     {'favorite': True}
             elif 'favorite' not in
 self._favorite_bundles[_DEFAULT_VIEW][key]:
                 self._favorite_bundles[_DEFAULT_VIEW][key]['favorite'] =
 True
 }}}

 I think this should be enough

 {{{
 #!python

         for bundle in self:
             bundle_id = bundle.get_bundle_id()
             key = self._get_favorite_key(
                 bundle_id, bundle.get_activity_version())

             if key not in self._favorite_bundles[_DEFAULT_VIEW]:
                 self._favorite_bundles[_DEFAULT_VIEW][key] = {
                     'favorite': bundle_id not in hidden_activities}
 }}}

 * In "with open(path) as hidden_file:", hidden_file is a confusing name,
 hidden_activities_files should be better.

 Is clear we don't allow change the hidden_activities file after the user
 setup is done and hide activities already set as favorites by the user,
 these are activities hidden by default.
\
\
\

--
Ticket URL: <http://bugs.sugarlabs.org/ticket/4841#comment:12>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list