Fix SnowflakeBox
This commit is contained in:
parent
a2de1f7f3f
commit
c738ac488e
@ -20,9 +20,11 @@ import math
|
|||||||
import cairo
|
import cairo
|
||||||
import hippo
|
import hippo
|
||||||
|
|
||||||
_BASE_RADIUS = 65
|
from sugar.graphics import units
|
||||||
|
|
||||||
|
_BASE_RADIUS = units.points_to_pixels(20)
|
||||||
_CHILDREN_FACTOR = 1
|
_CHILDREN_FACTOR = 1
|
||||||
_FLAKE_DISTANCE = 6
|
_FLAKE_DISTANCE = units.points_to_pixels(4)
|
||||||
|
|
||||||
class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
|
class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||||
__gtype_name__ = 'SugarSnowflakeBox'
|
__gtype_name__ = 'SugarSnowflakeBox'
|
||||||
@ -67,6 +69,13 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
|
|
||||||
self.set_position(child, int(x), int(y))
|
self.set_position(child, int(x), int(y))
|
||||||
|
|
||||||
|
def do_get_height_request(self, for_width):
|
||||||
|
hippo.CanvasBox.do_get_height_request(self, for_width)
|
||||||
|
|
||||||
|
height = for_width
|
||||||
|
|
||||||
|
return (height, height)
|
||||||
|
|
||||||
def do_get_width_request(self):
|
def do_get_width_request(self):
|
||||||
hippo.CanvasBox.do_get_width_request(self)
|
hippo.CanvasBox.do_get_width_request(self)
|
||||||
|
|
||||||
|
@ -33,14 +33,14 @@ from sugar.graphics.canvasicon import CanvasIcon
|
|||||||
|
|
||||||
def _create_snowflake(parent, children):
|
def _create_snowflake(parent, children):
|
||||||
color = XoColor()
|
color = XoColor()
|
||||||
icon = CanvasIcon(scale=0.5, xo_color=color,
|
icon = CanvasIcon(scale=1.0, xo_color=color,
|
||||||
icon_name='theme:object-link')
|
icon_name='theme:object-link')
|
||||||
parent.append(icon, hippo.PACK_FIXED)
|
parent.append(icon, hippo.PACK_FIXED)
|
||||||
parent.set_root(icon)
|
parent.set_root(icon)
|
||||||
|
|
||||||
for i in range(0, children):
|
for i in range(0, children):
|
||||||
color = XoColor()
|
color = XoColor()
|
||||||
icon = CanvasIcon(scale=1.0, xo_color=color,
|
icon = CanvasIcon(scale=0.5, xo_color=color,
|
||||||
icon_name='theme:stock-buddy')
|
icon_name='theme:stock-buddy')
|
||||||
parent.append(icon, hippo.PACK_FIXED)
|
parent.append(icon, hippo.PACK_FIXED)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user