Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@sugarlabs.org>2009-03-03 13:53:00 (GMT)
committer Tomeu Vizoso <tomeu@sugarlabs.org>2009-03-03 13:53:00 (GMT)
commitc6ea764c897b5430bf86430271599d38dd6d8cf8 (patch)
tree330fd63cfbbb5af1e237eab91aed95df7ee1bcbe
parent449dc5c43b1b034cb0a269a6ff13b3077e849bae (diff)
Favorites' focus rectangle corners should be rounded #406
-rw-r--r--src/jarabe/desktop/favoritesview.py51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
index 0f842c8..2bfe383 100644
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -17,9 +17,10 @@
import logging
from gettext import gettext as _
-import gconf
+import math
import gobject
+import gconf
import gtk
import hippo
import dbus
@@ -399,7 +400,7 @@ class DatastoreListener(object):
class ActivityIcon(CanvasIcon):
__gtype_name__ = 'SugarFavoriteActivityIcon'
- _BORDER_WIDTH = 4
+ _BORDER_WIDTH = style.zoom(3)
__gsignals__ = {
'erase-activated' : (gobject.SIGNAL_RUN_FIRST,
@@ -482,31 +483,29 @@ class ActivityIcon(CanvasIcon):
self.emit_paint_needed(0, 0, -1, -1)
def do_paint_above_children(self, cr, damaged_box):
- if self._hovering:
- width, height = self.get_allocation()
-
- color = style.COLOR_SELECTION_GREY.get_int()
- hippo.cairo_set_source_rgba32(cr, color)
-
- x = ActivityIcon._BORDER_WIDTH / 2
- y = ActivityIcon._BORDER_WIDTH / 2
- width -= ActivityIcon._BORDER_WIDTH
- height -= ActivityIcon._BORDER_WIDTH
-
- cr.move_to(0, y)
- cr.line_to(width, y)
-
- cr.move_to(width, 0)
- cr.line_to(width, height + ActivityIcon._BORDER_WIDTH / 2)
-
- cr.move_to(width, height)
- cr.line_to(0, height)
-
- cr.move_to(x, height)
- cr.line_to(x, 0)
+ if not self._hovering:
+ return
- cr.set_line_width(style.zoom(ActivityIcon._BORDER_WIDTH))
- cr.stroke()
+ width, height = self.get_allocation()
+
+ x = ActivityIcon._BORDER_WIDTH / 2
+ y = ActivityIcon._BORDER_WIDTH / 2
+ width -= ActivityIcon._BORDER_WIDTH
+ height -= ActivityIcon._BORDER_WIDTH
+ radius = width / 10
+
+ cr.move_to(x + radius, y)
+ cr.arc(x + width - radius, y + radius, radius, math.pi * 1.5,
+ math.pi * 2)
+ cr.arc(x + width - radius, x + height - radius, radius, 0,
+ math.pi * 0.5)
+ cr.arc(x + radius, y + height - radius, radius, math.pi * 0.5, math.pi)
+ cr.arc(x + radius, y + radius, radius, math.pi, math.pi * 1.5)
+
+ color = style.COLOR_SELECTION_GREY.get_int()
+ hippo.cairo_set_source_rgba32(cr, color)
+ cr.set_line_width(ActivityIcon._BORDER_WIDTH)
+ cr.stroke()
def do_get_content_height_request(self, for_width):
height, height = CanvasIcon.do_get_content_height_request(self,