Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Schampijer <simon@laptop.org>2012-10-17 07:38:10 (GMT)
committer Simon Schampijer <simon@laptop.org>2012-10-18 11:50:29 (GMT)
commit8aa631eb57847574615bc59a0f974033b815fec2 (patch)
treed40b361a50fe1923921baa56588c720024ef2057 /src
parent6b40a450d348d51286e4b979cca0173b1ef8983c (diff)
SnowflakeLayout: fix remaining issues, SL #3939
- remove unneeded style call - size_request returns a GtkRequisition - use a Gdk.Rectangle to pass to size_allocate Signed-off-by: Simon Schampijer <simon@laptop.org> Acked-by: Manuel QuiƱones <manuq@laptop.org>
Diffstat (limited to 'src')
-rw-r--r--src/jarabe/desktop/snowflakelayout.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/jarabe/desktop/snowflakelayout.py b/src/jarabe/desktop/snowflakelayout.py
index 7b33ddd..5ad5f26 100644
--- a/src/jarabe/desktop/snowflakelayout.py
+++ b/src/jarabe/desktop/snowflakelayout.py
@@ -17,6 +17,7 @@
import math
from gi.repository import Gtk
+from gi.repository import Gdk
from sugar3.graphics import style
@@ -35,10 +36,8 @@ class SnowflakeLayout(Gtk.Container):
self._children = {}
def do_realize(self):
- # FIXME what is this for?
self.set_realized(True)
self.set_window(self.get_parent_window())
- self.style.attach(self.window)
for child in self._children.keys():
child.set_parent_window(self.get_parent_window())
self.queue_resize()
@@ -78,12 +77,20 @@ class SnowflakeLayout(Gtk.Container):
requisition.height = size
def do_size_allocate(self, allocation):
+ self.set_allocation(allocation)
+
r = self._get_radius()
index = 0
for child, centered in self._children.items():
- child_width, child_height = child.size_request()
- rect = (0, 0, child_width, child_height)
+ child_request = child.size_request()
+ child_width, child_height = \
+ child_request.width, child_request.height
+ rect = Gdk.Rectangle()
+ rect.x = 0
+ rect.y = 0
+ rect.width = child_width
+ rect.height = child_height
width = allocation.width - child_width
height = allocation.height - child_height
@@ -110,15 +117,19 @@ class SnowflakeLayout(Gtk.Container):
radius = int(_BASE_DISTANCE + _CHILDREN_FACTOR * self._nflakes)
for child, centered in self._children.items():
if centered:
- child_w, child_h = child.size_request()
- radius += max(child_w, child_h) / 2
+ child_request = child.size_request()
+ child_width, child_height = \
+ child_request.width, child_request.height
+ radius += max(child_width, child_height) / 2
return radius
def _calculate_size(self):
thickness = 0
for child in self._children.keys():
- width, height = child.size_request()
- thickness = max(thickness, max(width, height))
+ child_request = child.size_request()
+ child_width, child_height = \
+ child_request.width, child_request.height
+ thickness = max(thickness, max(child_width, child_height))
return self._get_radius() * 2 + thickness