More units cleanups

master
Marco Pesenti Gritti 17 years ago
parent 445a79231d
commit f2eca57d13

@ -25,7 +25,6 @@ from sugar.graphics.frame import Frame
from sugar.activity.bundle import Bundle
from sugar.date import Date
from sugar.graphics import style
from sugar.graphics import units
from sugar.graphics.canvasicon import CanvasIcon
from sugar.graphics.xocolor import XoColor
from sugar.datastore import datastore
@ -43,8 +42,8 @@ class ObjectChooser(gtk.Dialog):
self._box = hippo.CanvasBox()
self._box.props.background_color = style.COLOR_PANEL_GREY.get_int()
self._box.props.spacing = units.points_to_pixels(5)
self._box.props.padding = units.points_to_pixels(5)
self._box.props.spacing = style.DEFAULT_SPACING
self._box.props.padding = style.DEFAULT_SPACING
canvas = hippo.Canvas()
canvas.set_root(self._box)
@ -97,13 +96,13 @@ class ObjectChooser(gtk.Dialog):
return None
class CollapsedEntry(Frame):
_DATE_COL_WIDTH = units.points_to_pixels(75)
_BUDDIES_COL_WIDTH = units.points_to_pixels(30)
_DATE_COL_WIDTH = style.zoom(100)
_BUDDIES_COL_WIDTH = style.zoom(50)
def __init__(self, jobject):
Frame.__init__(self)
self.props.box_height = units.grid_to_pixels(1)
self.props.spacing = units.points_to_pixels(5)
self.props.box_height = style.zoom(75)
self.props.spacing = style.DEFAULT_SPACING
self.props.border_color = style.COLOR_BLACK.get_int()
self.props.background_color = style.COLOR_PANEL_GREY.get_int()
@ -117,7 +116,7 @@ class CollapsedEntry(Frame):
self.append(date)
icon = CanvasIcon(icon_name=self._get_icon_name(),
box_width=units.grid_to_pixels(1))
box_width=style.zoom(75))
if self.jobject.metadata.has_key('icon-color'):
icon.props.xo_color = XoColor(self.jobject.metadata['icon-color'])

@ -376,7 +376,7 @@ class Palette(gobject.GObject):
class _PrimaryMenuItem(gtk.MenuItem):
def __init__(self, label, accel_path):
gtk.MenuItem.__init__(self)
self.set_border_width(style.DEFAULT_BORDER)
self.set_border_width(style.DEFAULT_PADDING)
self._set_label(label, accel_path)
def set_label(self, label, accel_path):

@ -19,19 +19,18 @@ import math
import hippo
from sugar.graphics import units
from sugar.graphics import style
class RoundBox(hippo.CanvasBox, hippo.CanvasItem):
__gtype_name__ = 'SugarRoundBox'
_BORDER_DEFAULT = units.points_to_pixels(1.0)
_BORDER_DEFAULT = style.LINE_WIDTH
def __init__(self, **kwargs):
hippo.CanvasBox.__init__(self, **kwargs)
# TODO: we should calculate this value depending on the height of the box.
self._radius = units.points_to_pixels(7)
self._radius = style.zoom(10)
self.props.orientation = hippo.ORIENTATION_HORIZONTAL
self.props.border = self._BORDER_DEFAULT

@ -89,7 +89,7 @@ _TAB_CURVATURE = 1
ZOOM_FACTOR = _compute_zoom_factor()
DEFAULT_SPACING = zoom(8)
DEFAULT_BORDER = zoom(6)
DEFAULT_PADDING = zoom(6)
LINE_WIDTH = zoom(2)
FONT_SIZE = zoom(7 * _XO_DPI / _get_screen_dpi())

Loading…
Cancel
Save