Make activity icons in frame outline-only. #2668

This commit is contained in:
Dan Winship 2007-08-08 18:19:05 -04:00
parent a1302ccbb2
commit 985fe6ef35
4 changed files with 16 additions and 6 deletions

View File

@ -20,6 +20,7 @@ import logging
from sugar.graphics.palette import Palette from sugar.graphics.palette import Palette
from sugar.graphics.xocolor import XoColor from sugar.graphics.xocolor import XoColor
from sugar.graphics.iconbutton import IconButton from sugar.graphics.iconbutton import IconButton
from sugar.graphics import style
from sugar import profile from sugar import profile
from model import bundleregistry from model import bundleregistry
@ -27,7 +28,9 @@ from frameinvoker import FrameCanvasInvoker
class ActivityButton(IconButton): class ActivityButton(IconButton):
def __init__(self, activity): def __init__(self, activity):
IconButton.__init__(self, icon_name=activity.get_icon()) IconButton.__init__(self, icon_name=activity.get_icon(),
stroke_color=style.COLOR_WHITE,
fill_color=style.COLOR_TRANSPARENT)
palette = Palette(activity.get_name()) palette = Palette(activity.get_name())
palette.props.invoker = FrameCanvasInvoker(self) palette.props.invoker = FrameCanvasInvoker(self)

View File

@ -231,13 +231,13 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
stroke_color = None stroke_color = None
if self._active: if self._active:
if self._fill_color: if self._fill_color:
fill_color = self._fill_color.get_html() fill_color = self._fill_color.get_svg()
if self._stroke_color: if self._stroke_color:
stroke_color = self._stroke_color.get_html() stroke_color = self._stroke_color.get_svg()
else: else:
stroke_color = color.ICON_STROKE_INACTIVE.get_html() stroke_color = color.ICON_STROKE_INACTIVE.get_svg()
if self._fill_color: if self._fill_color:
fill_color = self._fill_color.get_html() fill_color = self._fill_color.get_svg()
return [fill_color, stroke_color] return [fill_color, stroke_color]
def _get_handle(self, name, handle): def _get_handle(self, name, handle):

View File

@ -53,7 +53,7 @@ class IconButton(CanvasIcon, hippo.CanvasItem):
if self.props.active: if self.props.active:
self.props.background_color = 0x000000FF self.props.background_color = 0x000000FF
else: else:
self.props.background_color = 0x404040FF self.props.background_color = 0x00000000
def _icon_clicked_cb(self, button): def _icon_clicked_cb(self, button):
if self._palette: if self._palette:

View File

@ -81,6 +81,12 @@ class Color(object):
return (r, g, b) return (r, g, b)
def get_svg(self):
if self._a == 0.0:
return 'none'
else:
return self.get_html()
_XO_DPI = 200.0 _XO_DPI = 200.0
_FOCUS_LINE_WIDTH = 2 _FOCUS_LINE_WIDTH = 2
@ -113,6 +119,7 @@ TOOLBOX_TAB_LABEL_WIDTH = zoom(150 - 15 * 2)
COLOR_BLACK = Color('#000000') COLOR_BLACK = Color('#000000')
COLOR_WHITE = Color('#FFFFFF') COLOR_WHITE = Color('#FFFFFF')
COLOR_TRANSPARENT = Color('#FFFFFF', alpha=0.0)
COLOR_PANEL_GREY = Color('#C0C0C0') COLOR_PANEL_GREY = Color('#C0C0C0')
COLOR_SELECTION_GREY = Color('#A6A6A6') COLOR_SELECTION_GREY = Color('#A6A6A6')
COLOR_INACTIVE_FILL = Color('#9D9FA1') COLOR_INACTIVE_FILL = Color('#9D9FA1')