2007-02-15 18:48:58 +01:00
|
|
|
import gtk
|
|
|
|
|
|
|
|
import _sugar
|
|
|
|
|
2007-02-15 19:03:24 +01:00
|
|
|
_screen_factor = gtk.gdk.screen_width() / 1200.0
|
|
|
|
|
|
|
|
STANDARD_ICON_SCALE = 1.0 * _screen_factor
|
|
|
|
SMALL_ICON_SCALE = 0.5 * _screen_factor
|
|
|
|
MEDIUM_ICON_SCALE = 1.5 * _screen_factor
|
|
|
|
LARGE_ICON_SCALE = 2.0 * _screen_factor
|
|
|
|
XLARGE_ICON_SCALE = 3.0 * _screen_factor
|
|
|
|
|
2007-02-15 18:48:58 +01:00
|
|
|
def points_to_pixels(points):
|
2007-02-15 19:03:24 +01:00
|
|
|
return points * _sugar.get_screen_dpi() / 72.0 * _screen_factor
|
2007-02-15 18:48:58 +01:00
|
|
|
|
|
|
|
def grid_to_pixels(units):
|
|
|
|
return units * gtk.gdk.screen_width() / 16
|
|
|
|
|
|
|
|
def microgrid_to_pixels(units):
|
|
|
|
return units * gtk.gdk.screen_width() / 80
|