Get rid of some of the obsolete units usage.
This commit is contained in:
parent
cca69e7012
commit
d8faf0ba04
@ -59,13 +59,6 @@ sugar_menu_popdown(SugarMenu *menu)
|
|||||||
gtk_widget_hide(window);
|
gtk_widget_hide(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
sugar_menu_set_min_width (SugarMenu *menu,
|
|
||||||
int min_width)
|
|
||||||
{
|
|
||||||
menu->min_width = min_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sugar_menu_size_request (GtkWidget *widget,
|
sugar_menu_size_request (GtkWidget *widget,
|
||||||
GtkRequisition *requisition)
|
GtkRequisition *requisition)
|
||||||
|
@ -26,15 +26,6 @@
|
|||||||
|
|
||||||
;; From sugar-menu.h
|
;; 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
|
(define-method popup
|
||||||
(of-object "SugarMenu")
|
(of-object "SugarMenu")
|
||||||
(c-name "sugar_menu_popup")
|
(c-name "sugar_menu_popup")
|
||||||
|
@ -32,7 +32,7 @@ import dbus
|
|||||||
from sugar import util
|
from sugar import util
|
||||||
from sugar.presence import presenceservice
|
from sugar.presence import presenceservice
|
||||||
from sugar.activity.activityservice import ActivityService
|
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.window import Window
|
||||||
from sugar.graphics.toolbox import Toolbox
|
from sugar.graphics.toolbox import Toolbox
|
||||||
from sugar.graphics.toolbutton import ToolButton
|
from sugar.graphics.toolbutton import ToolButton
|
||||||
@ -345,8 +345,8 @@ class Activity(Window, gtk.Container):
|
|||||||
preview_pixbuf = self.get_canvas_screenshot()
|
preview_pixbuf = self.get_canvas_screenshot()
|
||||||
if preview_pixbuf is None:
|
if preview_pixbuf is None:
|
||||||
return None
|
return None
|
||||||
preview_pixbuf = preview_pixbuf.scale_simple(units.grid_to_pixels(4),
|
preview_pixbuf = preview_pixbuf.scale_simple(style.zoom(300),
|
||||||
units.grid_to_pixels(3),
|
style.zoom(225),
|
||||||
gtk.gdk.INTERP_BILINEAR)
|
gtk.gdk.INTERP_BILINEAR)
|
||||||
|
|
||||||
# TODO: Find a way of taking a png out of the pixbuf without saving to a temp file.
|
# TODO: Find a way of taking a png out of the pixbuf without saving to a temp file.
|
||||||
|
@ -21,8 +21,6 @@ import logging
|
|||||||
import gobject
|
import gobject
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
from sugar.graphics import units
|
|
||||||
|
|
||||||
class ComboBox(gtk.ComboBox):
|
class ComboBox(gtk.ComboBox):
|
||||||
__gtype_name__ = 'SugarComboBox'
|
__gtype_name__ = 'SugarComboBox'
|
||||||
|
|
||||||
@ -66,7 +64,11 @@ class ComboBox(gtk.ComboBox):
|
|||||||
def append_item(self, action_id, text, icon_name=None):
|
def append_item(self, action_id, text, icon_name=None):
|
||||||
if not self._icon_renderer and icon_name:
|
if not self._icon_renderer and icon_name:
|
||||||
self._icon_renderer = gtk.CellRendererPixbuf()
|
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.pack_start(self._icon_renderer, False)
|
||||||
self.add_attribute(self._icon_renderer, 'pixbuf', 2)
|
self.add_attribute(self._icon_renderer, 'pixbuf', 2)
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ import hippo
|
|||||||
|
|
||||||
from sugar.graphics import palettegroup
|
from sugar.graphics import palettegroup
|
||||||
from sugar.graphics import animator
|
from sugar.graphics import animator
|
||||||
from sugar.graphics import units
|
|
||||||
from sugar.graphics import style
|
from sugar.graphics import style
|
||||||
from sugar import _sugaruiext
|
from sugar import _sugaruiext
|
||||||
|
|
||||||
@ -88,7 +87,6 @@ class Palette(gobject.GObject):
|
|||||||
self._popdown_anim.add(_PopdownAnimation(self))
|
self._popdown_anim.add(_PopdownAnimation(self))
|
||||||
|
|
||||||
self._menu = _sugaruiext.Menu()
|
self._menu = _sugaruiext.Menu()
|
||||||
self._menu.set_min_width(units.grid_to_pixels(1))
|
|
||||||
|
|
||||||
self._primary = _PrimaryMenuItem(label, accel_path)
|
self._primary = _PrimaryMenuItem(label, accel_path)
|
||||||
self._menu.append(self._primary)
|
self._menu.append(self._primary)
|
||||||
@ -378,7 +376,7 @@ class Palette(gobject.GObject):
|
|||||||
class _PrimaryMenuItem(gtk.MenuItem):
|
class _PrimaryMenuItem(gtk.MenuItem):
|
||||||
def __init__(self, label, accel_path):
|
def __init__(self, label, accel_path):
|
||||||
gtk.MenuItem.__init__(self)
|
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)
|
self._set_label(label, accel_path)
|
||||||
|
|
||||||
def set_label(self, label, accel_path):
|
def set_label(self, label, accel_path):
|
||||||
|
@ -89,6 +89,7 @@ _TAB_CURVATURE = 1
|
|||||||
ZOOM_FACTOR = _compute_zoom_factor()
|
ZOOM_FACTOR = _compute_zoom_factor()
|
||||||
|
|
||||||
DEFAULT_SPACING = zoom(8)
|
DEFAULT_SPACING = zoom(8)
|
||||||
|
DEFAULT_BORDER = zoom(6)
|
||||||
LINE_WIDTH = zoom(2)
|
LINE_WIDTH = zoom(2)
|
||||||
|
|
||||||
FONT_SIZE = zoom(7 * _XO_DPI / _get_screen_dpi())
|
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_HBORDER = zoom(15) - _FOCUS_LINE_WIDTH - _TAB_CURVATURE
|
||||||
TOOLBOX_TAB_LABEL_WIDTH = zoom(150 - 15 * 2)
|
TOOLBOX_TAB_LABEL_WIDTH = zoom(150 - 15 * 2)
|
||||||
|
|
||||||
COLOR_WHITE = Color('#000000')
|
COLOR_BLACK = Color('#000000')
|
||||||
COLOR_WHITE = Color('#FFFFFF')
|
COLOR_WHITE = Color('#FFFFFF')
|
||||||
COLOR_PANEL_GREY = Color('#C0C0C0')
|
COLOR_PANEL_GREY = Color('#C0C0C0')
|
||||||
COLOR_SELECTION_GREY = Color('#A6A6A6')
|
COLOR_SELECTION_GREY = Color('#A6A6A6')
|
||||||
|
Loading…
Reference in New Issue
Block a user