From d8faf0ba047a7f33fd9d5ba21a428cdc5ca509d5 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 31 Jul 2007 14:56:05 +0200 Subject: [PATCH] Get rid of some of the obsolete units usage. --- lib/ui/sugar-menu.c | 7 ------- sugar/_sugaruiext.defs | 9 --------- sugar/activity/activity.py | 6 +++--- sugar/graphics/combobox.py | 8 +++++--- sugar/graphics/palette.py | 4 +--- sugar/graphics/style.py | 3 ++- 6 files changed, 11 insertions(+), 26 deletions(-) diff --git a/lib/ui/sugar-menu.c b/lib/ui/sugar-menu.c index 874c534b..6ed482ee 100644 --- a/lib/ui/sugar-menu.c +++ b/lib/ui/sugar-menu.c @@ -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) diff --git a/sugar/_sugaruiext.defs b/sugar/_sugaruiext.defs index 1a976377..c4efbbc3 100644 --- a/sugar/_sugaruiext.defs +++ b/sugar/_sugaruiext.defs @@ -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") diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 31b8d95d..2c887b94 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -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. diff --git a/sugar/graphics/combobox.py b/sugar/graphics/combobox.py index 46e7249a..3251dc2c 100644 --- a/sugar/graphics/combobox.py +++ b/sugar/graphics/combobox.py @@ -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) diff --git a/sugar/graphics/palette.py b/sugar/graphics/palette.py index 37e70b1a..a4efca1a 100644 --- a/sugar/graphics/palette.py +++ b/sugar/graphics/palette.py @@ -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): diff --git a/sugar/graphics/style.py b/sugar/graphics/style.py index 97a6ca85..336fe109 100644 --- a/sugar/graphics/style.py +++ b/sugar/graphics/style.py @@ -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')