Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-07-08 17:57:55 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-07-08 17:57:55 (GMT)
commit1166a79a395753cc8e6f5e6a36cf402d8b86f9de (patch)
tree0edc681c888bb1e362162b4e70b8ce8ae80bcada
parentdc7c1f3445c68d706ccf5a4283547822d93f8cc3 (diff)
Temporary work-around to alignment problem in do_expose_event since requisition and allocation are not always set properly
-rw-r--r--src/sugar/graphics/icon.py28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/sugar/graphics/icon.py b/src/sugar/graphics/icon.py
index feeaa00..e8bf09c 100644
--- a/src/sugar/graphics/icon.py
+++ b/src/sugar/graphics/icon.py
@@ -415,16 +415,28 @@ class Icon(gtk.Image):
xalign = 1.0 - xalign
allocation = self.get_allocation()
+
+ # FIXME: It seems that the requisition and allocation width
+ # are sometime wrong.
+ if requisition[0] == 0:
+ x = allocation.x + xpad
+ else:
+ x = math.floor(allocation.x + xpad +
+ (allocation.width - requisition[0]) * xalign)
+ if requisition[1] == 0:
+ y = allocation.y + ypad
+ else:
+ y = math.floor(allocation.y + ypad +
+ (allocation.height - requisition[1]) * yalign)
+
'''
if allocation.x != -1:
- logging.debug('DO_EXPOSE_EVENT %d %d %d %d %d',
- allocation.x, xpad, allocation.width, requisition[0],
- xalign)
+ logging.debug('DO_EXPOSE_EVENT (%d %d) (%d %d) (%d %d) (%f %f) (%d, %d)',
+ allocation.x, allocation.y,
+ allocation.width, allocation.height,
+ requisition[0], requisition[1],
+ xalign, yalign, x, y)
'''
- x = math.floor(allocation.x + xpad +
- (allocation.width - requisition[0]) * xalign)
- y = math.floor(allocation.y + ypad +
- (allocation.height - requisition[1]) * yalign)
if self.window is not None:
cr = self.window.cairo_create()
@@ -802,7 +814,7 @@ class CanvasIcon(gtk.EventBox):
if self._icon._buffer.width != value:
self._icon._buffer.width = value
self._icon._buffer.height = value
- self._icon.set_size_request(value, value)
+ self._icon.do_size_request([value, value])
self.emit_request_changed()
def get_size(self):