diff options
author | Marco Pesenti Gritti <mpgritti@gmail.com> | 2008-09-19 09:34:34 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpgritti@gmail.com> | 2008-09-19 09:34:34 (GMT) |
commit | 3f33b1fc8686542d10ce268d0dc3de2f5093f07c (patch) | |
tree | b16ac5deeeaa213c210b24be01d1bcf4b84b42e4 /src | |
parent | 0b335e486ba09a528e10583e6a082c96dc376503 (diff) |
Ensure _calculate_position always has the same arguments.
Diffstat (limited to 'src')
-rw-r--r-- | src/view/home/HomeBox.py | 2 | ||||
-rw-r--r-- | src/view/home/favoriteslayout.py | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/view/home/HomeBox.py b/src/view/home/HomeBox.py index 0d569ca..87d8eb0 100644 --- a/src/view/home/HomeBox.py +++ b/src/view/home/HomeBox.py @@ -163,7 +163,7 @@ class HomeBox(gtk.VBox): self._set_view(view, layout) if layout is not None: current_profile = profile.get_profile() - profile_key = favoritesview._LAYOUT_MAP[layout].profile_key + profile_key = favoritesview.LAYOUT_MAP[layout].profile_key if profile_key != current_profile.favorites_layout: current_profile.favorites_layout = profile_key current_profile.save() diff --git a/src/view/home/favoriteslayout.py b/src/view/home/favoriteslayout.py index 0391288..288ab8d 100644 --- a/src/view/home/favoriteslayout.py +++ b/src/view/home/favoriteslayout.py @@ -340,7 +340,8 @@ class SunflowerLayout(RingLayout): i += 1 return i - def _calculate_position(self, radius, icon_size, oindex, children_count): + def _calculate_position(self, radius, icon_size, oindex, children_count, + sin=math.sin, cos=math.cos): """Calculate the position of sunflower floret number 'oindex'. If the result is outside the bounding box, use the next index which is inside the bounding box.""" @@ -361,9 +362,9 @@ class SunflowerLayout(RingLayout): # x,y are the top-left corner of the icon, so remove icon_size # from width/height to compensate. y has an extra GRID_CELL_SIZE/2 # removed to make room for the "active activity" icon. - x = r * math.cos(phi) + (width - icon_size) / 2 - y = r * math.sin(phi) + (height - icon_size - \ - (style.GRID_CELL_SIZE / 2) ) / 2 + x = r * cos(phi) + (width - icon_size) / 2 + y = r * sin(phi) + (height - icon_size - \ + (style.GRID_CELL_SIZE / 2) ) / 2 # skip allocations outside the allocation box. # give up once we can't fit @@ -390,7 +391,8 @@ class BoxLayout(RingLayout): def __init__(self): RingLayout.__init__(self) - def _calculate_position(self, radius, icon_size, index, children_count): + def _calculate_position(self, radius, icon_size, index, children_count, + sin=None, cos=None): # use "orthogonal" versions of cos and sin in order to square the # circle and turn the 'ring view' into a 'box view' @@ -434,7 +436,8 @@ class TriangleLayout(RingLayout): RingLayout._calculate_radius_and_icon_size(self, children_count) return max(radius, _MINIMUM_RADIUS + style.MEDIUM_ICON_SIZE), icon_size - def _calculate_position(self, radius, icon_size, index, children_count): + def _calculate_position(self, radius, icon_size, index, children_count, + sin=math.sin, cos=math.cos): # tweak cos and sin in order to make the 'ring' into an equilateral # triangle. |