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

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Wed Jun 17 18:19:42 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 tch):

 Replying to [comment:12 godiard]:
 > I tested the patches and work, but I found the following issues:
 >
 > * Add more descriptive header to the commits.
 >

 DONE.

 >
 > * In particular, I would merge the first and last patches to make easier
 understand the change.
 >

 If I do that, I will also have to merge the removal and addition of
 .defaults and .hidden files in the same commit, making it too big. This
 because the commits should respect the transition when the files are
 needed. Also, I think is easier to understand now.

 >
 > * _scan_new_favorites() does not have in account the case of multiple
 home views (see load_favorites).
 >

 DONE.

 I made the conversion of old JSON file more explicit now and covers all
 home views.

 Note that activities made favorite by the shell always go to the main home
 view and never to the others. This is also true when activities are
 installed when the shell is running, so is better to keep the consistency.

 >
 > * 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}
 > }}}
 >

 DONE.

 Now that I separated the old JSON file conversion from the scanning, it is
 simpler now.

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

 DONE.

 >
 >
 > 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.
 >

 I also tested it with multiple views so is more robust now. I added other
 e.g., having Log and Terminal in the activities.hidden as defaults.

 Please give it a try [1]!

 [1] https://github.com/tchx84/sugar/tree/enhance-favorites-try2
\
\
\

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


More information about the Bugs mailing list