Get rid of some of the obsolete units usage.

This commit is contained in:
Marco Pesenti Gritti 2007-07-31 14:56:05 +02:00
parent cca69e7012
commit d8faf0ba04
6 changed files with 11 additions and 26 deletions

View File

@ -59,13 +59,6 @@ sugar_menu_popdown(SugarMenu *menu)
gtk_widget_hide(window);
}
void
sugar_menu_set_min_width (SugarMenu *menu,
int min_width)
{
menu->min_width = min_width;
}
static void
sugar_menu_size_request (GtkWidget *widget,
GtkRequisition *requisition)

View File

@ -26,15 +26,6 @@
;; From sugar-menu.h
(define-method set_min_width
(of-object "SugarMenu")
(c-name "sugar_menu_set_min_width")
(return-type "none")
(parameters
'("gint" "width")
)
)
(define-method popup
(of-object "SugarMenu")
(c-name "sugar_menu_popup")

View File

@ -32,7 +32,7 @@ import dbus
from sugar import util
from sugar.presence import presenceservice
from sugar.activity.activityservice import ActivityService
from sugar.graphics import units
from sugar.graphics import style
from sugar.graphics.window import Window
from sugar.graphics.toolbox import Toolbox
from sugar.graphics.toolbutton import ToolButton
@ -345,8 +345,8 @@ class Activity(Window, gtk.Container):
preview_pixbuf = self.get_canvas_screenshot()
if preview_pixbuf is None:
return None
preview_pixbuf = preview_pixbuf.scale_simple(units.grid_to_pixels(4),
units.grid_to_pixels(3),
preview_pixbuf = preview_pixbuf.scale_simple(style.zoom(300),
style.zoom(225),
gtk.gdk.INTERP_BILINEAR)
# TODO: Find a way of taking a png out of the pixbuf without saving to a temp file.

View File

@ -21,8 +21,6 @@ import logging
import gobject
import gtk
from sugar.graphics import units
class ComboBox(gtk.ComboBox):
__gtype_name__ = 'SugarComboBox'
@ -66,7 +64,11 @@ class ComboBox(gtk.ComboBox):
def append_item(self, action_id, text, icon_name=None):
if not self._icon_renderer and icon_name:
self._icon_renderer = gtk.CellRendererPixbuf()
self._icon_renderer.props.stock_size = units.microgrid_to_pixels(3)
settings = self.get_settings()
w, h = gtk.icon_size_lookup_for_settings(settings, gtk.ICON_SIZE_MENU)
self._icon_renderer.props.stock_size = w
self.pack_start(self._icon_renderer, False)
self.add_attribute(self._icon_renderer, 'pixbuf', 2)

View File

@ -24,7 +24,6 @@ import hippo
from sugar.graphics import palettegroup
from sugar.graphics import animator
from sugar.graphics import units
from sugar.graphics import style
from sugar import _sugaruiext
@ -88,7 +87,6 @@ class Palette(gobject.GObject):
self._popdown_anim.add(_PopdownAnimation(self))
self._menu = _sugaruiext.Menu()
self._menu.set_min_width(units.grid_to_pixels(1))
self._primary = _PrimaryMenuItem(label, accel_path)
self._menu.append(self._primary)
@ -378,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(units.points_to_pixels(1))
self.set_border_width(style.DEFAULT_BORDER)
self._set_label(label, accel_path)
def set_label(self, label, accel_path):

View File

@ -89,6 +89,7 @@ _TAB_CURVATURE = 1
ZOOM_FACTOR = _compute_zoom_factor()
DEFAULT_SPACING = zoom(8)
DEFAULT_BORDER = zoom(6)
LINE_WIDTH = zoom(2)
FONT_SIZE = zoom(7 * _XO_DPI / _get_screen_dpi())
@ -103,7 +104,7 @@ TOOLBOX_TAB_VBORDER = int((zoom(36) - FONT_NORMAL_H - _FOCUS_LINE_WIDTH) / 2)
TOOLBOX_TAB_HBORDER = zoom(15) - _FOCUS_LINE_WIDTH - _TAB_CURVATURE
TOOLBOX_TAB_LABEL_WIDTH = zoom(150 - 15 * 2)
COLOR_WHITE = Color('#000000')
COLOR_BLACK = Color('#000000')
COLOR_WHITE = Color('#FFFFFF')
COLOR_PANEL_GREY = Color('#C0C0C0')
COLOR_SELECTION_GREY = Color('#A6A6A6')