Changes

Line 17: Line 17:  
Requirement: In the center of the view we do have an the owner buddy at a fixed position in a specified size and the current activity icon below it. We have different layouts that can be applied to position the icons and have them at different sizes. A special mode is here the random layout where icons can be dragged around to change their position.  
 
Requirement: In the center of the view we do have an the owner buddy at a fixed position in a specified size and the current activity icon below it. We have different layouts that can be applied to position the icons and have them at different sizes. A special mode is here the random layout where icons can be dragged around to change their position.  
    +
Implementation: Implements a [http://git.sugarlabs.org/~erikos/sugar/erikos-shell-port/blobs/master/src/jarabe/desktop/viewcontainer.py SugarViewContainer] a GTKContainer which provides adding/removing of children. It expects to be passed an owner_icon and optionally an activity icon and a LayoutManager to take care of the positioning and sizing of the icons. There are different LayoutManagers adopted to the specific needs in each view. When the allocation happens the first time a setup is run to [http://git.sugarlabs.org/~erikos/sugar/erikos-shell-port/blobs/master/src/jarabe/desktop/favoriteslayout.py#line55 create a grid] and allocate and position the owner icon. The grid is part of the ViewLayout: we will always have at least the owner icon in the Views with a fixed position so we need the grid in all of the views, the Grid is created the first time we are called to allocate the icons because we make it dependent on the requested allocation size of the container
 +
 +
The owner icon (+ activity icon) is positioned in the center: this is done when we do allocate the icons because we need to know the allocation size requested for the container in order to calculate the exact position, this is only done once on setup of the ViewLayout, this must happen before we add the other icons otherwise we risk collisions (maybe that is a bug in the grid, ideally if you add an icon with a fixed position and there is an icon at this position already the non-fixed one should be moved away, but this is not the case atm). The icons are added only once to the grid: when we need to allocate the size for the icons we do check if they are in the grid already, we use the positions if they are in the grid otherwise add them to the grid and get the position from the grid, this way the icons keep their positions when new icons are added or removed.
 +
 +
In the ViewLayout used in the Home View only the owner and current activity icon are added to the grid. The activity icons do already have collision detection in their layout algorithms.
    
===Group View===
 
===Group View===
 
Requirement: In the center of the view we do have an the owner buddy at a fixed position in a specified size. We have here an N number of buddy icons spread out over the view. There has to be some error handling that the icons do not overlap.  
 
Requirement: In the center of the view we do have an the owner buddy at a fixed position in a specified size. We have here an N number of buddy icons spread out over the view. There has to be some error handling that the icons do not overlap.  
   −
Implements a [http://git.sugarlabs.org/~erikos/sugar/erikos-shell-port/blobs/master/src/jarabe/desktop/viewcontainer.py SugarViewContainer] a GTKContainer which provides adding/removing of children. It expects to be passed an owner_icon and optionally an activity icon and a LayoutManager to take care of the positioning and sizing of the icons. There are different LayoutManagers adopted to the specific needs in each view. When the allocation happens the first time a setup is run to [http://git.sugarlabs.org/~erikos/sugar/erikos-shell-port/blobs/master/src/jarabe/desktop/favoriteslayout.py#line55 create a grid] and allocate and position the owner icon. The grid is part of the ViewLayout: we will always have at least the owner icon in the Views with a fixed position so we need the grid in all of the views, the Grid is created the first time we are called to allocate the icons because we make it dependent on the requested allocation size of the container
+
Implementation: In the Group view we use the [http://git.sugarlabs.org/~erikos/sugar/erikos-shell-port/blobs/master/src/jarabe/desktop/favoriteslayout.py#line143 SpreadLayout] to position the icons. All the icons are part of the grid in order to do collision detection.
 
  −
The owner icon (+ activity icon) is positioned in the center: this is done when we do allocate the icons because we need to know the allocation size requested for the container in order to calculate the exact position, this is only done once on setup of the ViewLayout, this must happen before we add the other icons otherwise we risk collisions (maybe that is a bug in the grid, ideally if you add an icon with a fixed position and there is an icon at this position already the non-fixed one should be moved away, but this is not the case atm). The icons are added only once to the grid: when we need to allocate the size for the icons we do check if they are in the grid already, we use the positions if they are in the grid otherwise add them to the grid and get the position from the grid, this way the icons keep their positions when new icons are added or removed.
      
===Neighborhood View===
 
===Neighborhood View===
 
Requirement: In the center of the view we do have an the owner buddy at a fixed position in a specified size. We have here an N number of buddy icons, activity icons and network icons spread out over the view. In addition the buddy icons can be grouped around an activity icon. There has to be some error handling that the icons do not overlap.  
 
Requirement: In the center of the view we do have an the owner buddy at a fixed position in a specified size. We have here an N number of buddy icons, activity icons and network icons spread out over the view. In addition the buddy icons can be grouped around an activity icon. There has to be some error handling that the icons do not overlap.  
    +
Implementation: In the Neighborhood view we use the [http://git.sugarlabs.org/~erikos/sugar/erikos-shell-port/blobs/master/src/jarabe/desktop/favoriteslayout.py#line143 SpreadLayout] to position the icons. All the icons are part of the grid in order to do collision detection. We use the exiting [http://git.sugarlabs.org/~erikos/sugar/erikos-shell-port/blobs/master/src/jarabe/desktop/snowflakelayout.py snowflakelayout] to do the grouping of the buddy icons around an activity.
       
* [http://git.sugarlabs.org/~erikos/sugar/erikos-shell-port shell port repository]
 
* [http://git.sugarlabs.org/~erikos/sugar/erikos-shell-port shell port repository]
3,267

edits