Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
This commit is contained in:
commit
9333af3d07
@ -9,5 +9,6 @@ sugar_PYTHON = \
|
||||
clipboardicon.py \
|
||||
clipboardmenu.py \
|
||||
keyhandler.py \
|
||||
pulsingicon.py \
|
||||
OverlayWindow.py \
|
||||
Shell.py
|
||||
|
@ -14,7 +14,7 @@
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
import gobject
|
||||
@ -137,7 +137,7 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
||||
'icon-name' : (str, None, None, None,
|
||||
gobject.PARAM_READWRITE),
|
||||
'xo-color' : (object, None, None,
|
||||
gobject.PARAM_READWRITE),
|
||||
gobject.PARAM_WRITABLE),
|
||||
'fill-color' : (object, None, None,
|
||||
gobject.PARAM_READWRITE),
|
||||
'stroke-color' : (object, None, None,
|
||||
@ -148,6 +148,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
||||
'cache' : (bool, None, None, False,
|
||||
gobject.PARAM_READWRITE),
|
||||
'tooltip' : (str, None, None, None,
|
||||
gobject.PARAM_READWRITE),
|
||||
'active' : (bool, None, None, True,
|
||||
gobject.PARAM_READWRITE)
|
||||
}
|
||||
|
||||
@ -165,6 +167,7 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
||||
self._popup = None
|
||||
self._hover_popup = False
|
||||
self._tooltip = False
|
||||
self._active = True
|
||||
|
||||
self._timeline = Timeline(self)
|
||||
self._timeline.add_tag('popup', 6, 6)
|
||||
@ -216,38 +219,47 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
||||
self._cache = value
|
||||
elif pspec.name == 'tooltip':
|
||||
self._tooltip = value
|
||||
elif pspec.name == 'active':
|
||||
if self._active != value:
|
||||
if not self._cache:
|
||||
self._clear_buffers()
|
||||
self._active = value
|
||||
self._handle = None
|
||||
self.emit_paint_needed(0, 0, -1, -1)
|
||||
|
||||
def _choose_colors(self):
|
||||
fill_color = None
|
||||
stroke_color = None
|
||||
if self._active:
|
||||
if self._fill_color:
|
||||
fill_color = self._fill_color.get_html()
|
||||
if self._stroke_color:
|
||||
stroke_color = self._stroke_color.get_html()
|
||||
else:
|
||||
stroke_color = color.ICON_STROKE_INACTIVE.get_html()
|
||||
if self._fill_color:
|
||||
fill_color = self._fill_color.get_html()
|
||||
return [fill_color, stroke_color]
|
||||
|
||||
def _get_handle(self):
|
||||
if not self._handle:
|
||||
cache = CanvasIcon._cache
|
||||
|
||||
fill_color = None
|
||||
if self._fill_color:
|
||||
fill_color = self._fill_color.get_html()
|
||||
|
||||
stroke_color = None
|
||||
if self._stroke_color:
|
||||
stroke_color = self._stroke_color.get_html()
|
||||
[fill_color, stroke_color] = self._choose_colors()
|
||||
|
||||
self._handle = cache.get_handle(self._icon_name, fill_color,
|
||||
stroke_color)
|
||||
return self._handle
|
||||
|
||||
def _get_current_buffer_key(self):
|
||||
return (self._icon_name, self._fill_color, self._stroke_color, self._scale)
|
||||
[fill_color, stroke_color] = self._choose_colors()
|
||||
return (self._icon_name, fill_color, stroke_color, self._scale)
|
||||
|
||||
def do_get_property(self, pspec):
|
||||
if pspec.name == 'scale':
|
||||
return self._scale
|
||||
elif pspec.name == 'icon-name':
|
||||
return self._icon_name
|
||||
elif pspec.name == 'xo-color':
|
||||
if self._stroke_color and self._fill_color:
|
||||
xo_color = XoColor('%s,%s' % (self._stroke_color.get_html(),
|
||||
self._fill_color.get_html()))
|
||||
return xo_color
|
||||
else:
|
||||
return None
|
||||
elif pspec.name == 'fill-color':
|
||||
return self._fill_color
|
||||
elif pspec.name == 'stroke-color':
|
||||
@ -256,6 +268,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
||||
return self._cache
|
||||
elif pspec.name == 'tooltip':
|
||||
return self._tooltip
|
||||
elif pspec.name == 'active':
|
||||
return self._active
|
||||
|
||||
def _get_icon_size(self):
|
||||
handle = self._get_handle()
|
||||
|
@ -20,8 +20,6 @@ _system_colors = {
|
||||
'button-background-normal' : '#424242',
|
||||
'button-hover' : '#808080',
|
||||
'button-background-hover' : '#000000',
|
||||
'button-inactive' : '#808080',
|
||||
'button-background-inactive' : '#424242',
|
||||
'icon-stroke-inactive' : '#757575',
|
||||
'icon-fill-inactive' : '#9D9FA1'
|
||||
}
|
||||
@ -100,7 +98,5 @@ BUTTON_NORMAL = SystemColor('button-normal')
|
||||
BUTTON_BACKGROUND_NORMAL = SystemColor('button-background-normal')
|
||||
BUTTON_HOVER = SystemColor('button-hover')
|
||||
BUTTON_BACKGROUND_HOVER = SystemColor('button-background-hover')
|
||||
BUTTON_INACTIVE = SystemColor('button-inactive')
|
||||
BUTTON_BACKGROUND_INACTIVE = SystemColor('button-background-inactive')
|
||||
ICON_FILL_INACTIVE = SystemColor('icon-fill-inactive')
|
||||
ICON_STROKE_INACTIVE = SystemColor('icon-stroke-inactive')
|
||||
|
@ -3,8 +3,8 @@ import pango
|
||||
from sugar.graphics import units
|
||||
|
||||
_system_fonts = {
|
||||
'default' : 'Bitstream Vera Sans %dpx' % units.points_to_pixels(9),
|
||||
'default-bold' : 'Bitstream Vera Sans bold %dpx' % units.points_to_pixels(9)
|
||||
'default' : 'Bitstream Vera Sans %d' % units.points_to_device(9),
|
||||
'default-bold' : 'Bitstream Vera Sans bold %d' % units.points_to_device(9)
|
||||
}
|
||||
|
||||
class Font(object):
|
||||
|
@ -33,26 +33,15 @@ class IconButton(CanvasIcon):
|
||||
__gproperties__ = {
|
||||
'size' : (int, None, None,
|
||||
0, sys.maxint, STANDARD_SIZE,
|
||||
gobject.PARAM_READWRITE),
|
||||
'active' : (bool, None, None, True,
|
||||
gobject.PARAM_READWRITE)
|
||||
}
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self._active = True
|
||||
|
||||
CanvasIcon.__init__(self, cache=True, **kwargs)
|
||||
|
||||
if self._active:
|
||||
if not self.props.fill_color and not self.props.stroke_color:
|
||||
self.props.fill_color = color.BUTTON_BACKGROUND_NORMAL
|
||||
self.props.stroke_color = color.BUTTON_NORMAL
|
||||
self.props.background_color = \
|
||||
color.BUTTON_BACKGROUND_NORMAL.get_int()
|
||||
else:
|
||||
self.props.fill_color = color.BUTTON_BACKGROUND_INACTIVE
|
||||
self.props.stroke_color = color.BUTTON_INACTIVE
|
||||
self.props.background_color = \
|
||||
color.BUTTON_BACKGROUND_INACTIVE.get_int()
|
||||
|
||||
self._set_size(STANDARD_SIZE)
|
||||
|
||||
@ -74,22 +63,12 @@ class IconButton(CanvasIcon):
|
||||
def do_set_property(self, pspec, value):
|
||||
if pspec.name == 'size':
|
||||
self._set_size(value)
|
||||
elif pspec.name == 'active':
|
||||
self._active = value
|
||||
if self._active:
|
||||
self.props.fill_color = color.BUTTON_BACKGROUND_NORMAL
|
||||
self.props.stroke_color = color.BUTTON_NORMAL
|
||||
else:
|
||||
self.props.fill_color = color.BUTTON_BACKGROUND_INACTIVE
|
||||
self.props.stroke_color = color.BUTTON_INACTIVE
|
||||
else:
|
||||
CanvasIcon.do_set_property(self, pspec, value)
|
||||
|
||||
def do_get_property(self, pspec):
|
||||
if pspec.name == 'size':
|
||||
return self._size
|
||||
elif pspec.name == 'active':
|
||||
return self._active
|
||||
else:
|
||||
return CanvasIcon.do_get_property(self, pspec)
|
||||
|
||||
@ -100,7 +79,7 @@ class IconButton(CanvasIcon):
|
||||
|
||||
def prelight(self, enter):
|
||||
if enter:
|
||||
if self._active:
|
||||
if self.props.active:
|
||||
self.props.background_color = color.BLACK.get_int()
|
||||
else:
|
||||
self.props.background_color = \
|
||||
|
@ -64,7 +64,7 @@ import gtk
|
||||
import _sugar
|
||||
|
||||
_MAX_ZOOM_FACTOR = 1.5
|
||||
_ZOOM_CONSTANT = 600.0
|
||||
_ZOOM_CONSTANT = 800.0
|
||||
|
||||
def _compute_zoom_factor():
|
||||
screen_width = gtk.gdk.screen_width()
|
||||
@ -73,7 +73,8 @@ def _compute_zoom_factor():
|
||||
else:
|
||||
return min(_MAX_ZOOM_FACTOR, screen_width / _ZOOM_CONSTANT)
|
||||
|
||||
_dpi_factor = float(_sugar.get_screen_dpi()) / 201.0
|
||||
_screen_dpi = float(_sugar.get_screen_dpi())
|
||||
_dpi_factor = _screen_dpi / 201.0
|
||||
_zoom_factor = _compute_zoom_factor()
|
||||
|
||||
STANDARD_ICON_SCALE = 1.0 * _dpi_factor * _zoom_factor
|
||||
@ -82,9 +83,12 @@ MEDIUM_ICON_SCALE = 1.5 * _dpi_factor * _zoom_factor
|
||||
LARGE_ICON_SCALE = 2.0 * _dpi_factor * _zoom_factor
|
||||
XLARGE_ICON_SCALE = 3.0 * _dpi_factor * _zoom_factor
|
||||
|
||||
def points_to_pixels(points):
|
||||
def points_to_device(points):
|
||||
return int(points * _zoom_factor)
|
||||
|
||||
def points_to_pixels(points):
|
||||
return int(points * _screen_dpi / 72.0 * _zoom_factor)
|
||||
|
||||
def grid_to_pixels(units):
|
||||
return int(units * 75.0 * _dpi_factor * _zoom_factor)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
VERSION=0.63
|
||||
DATE=`date +%Y%m%d`
|
||||
RELEASE=2.25
|
||||
RELEASE=2.29
|
||||
TARBALL=sugar-$VERSION-$RELEASE.${DATE}git.tar.bz2
|
||||
|
||||
rm sugar-$VERSION.tar.bz2
|
||||
|
Loading…
Reference in New Issue
Block a user