Ticket #1584: 0001-Apply-font-configuration-from-GConf.patch

File 0001-Apply-font-configuration-from-GConf.patch, 1.9 KB (added by dsd, 14 years ago)

sugar-toolkit patch

  • src/sugar/activity/activity.py

    From fa78bc1e1dbe2fcbbf14e94e1b6c068ce9bc1f84 Mon Sep 17 00:00:00 2001
    From: Daniel Drake <dsd@laptop.org>
    Date: Fri, 27 Nov 2009 11:31:42 +0000
    Subject: [PATCH] Apply font configuration from GConf
    
    Sugar font settings are now stored in GConf. This patch applies them
    to all users of sugar.style and all standard activities.
    ---
     src/sugar/activity/activity.py |    3 +++
     src/sugar/graphics/style.py    |   10 +++++++---
     2 files changed, 10 insertions(+), 3 deletions(-)
    
    diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
    index d4892d0..a3db42e 100644
    a b class Activity(Window, gtk.Container): 
    280280        self._jobject = None
    281281        self._read_file_called = False
    282282
     283        settings = gtk.settings_get_default()
     284        settings.set_property("gtk-font-name", "%s %f" % (style.FONT_FACE, style.FONT_SIZE))
     285
    283286        self._session = _get_session()
    284287        self._session.register(self)
    285288        self._session.connect('quit-requested',
  • src/sugar/graphics/style.py

    diff --git a/src/sugar/graphics/style.py b/src/sugar/graphics/style.py
    index 6d5e35e..ccc6912 100644
    a b import logging 
    2727
    2828import gtk
    2929import pango
     30import gconf
    3031
    3132
    3233FOCUS_LINE_WIDTH = 2
    MEDIUM_ICON_SIZE = zoom(55 * 1.5) 
    115116LARGE_ICON_SIZE = zoom(55 * 2.0)
    116117XLARGE_ICON_SIZE = zoom(55 * 2.75)
    117118
    118 FONT_SIZE = 10
    119 FONT_NORMAL = Font('Bitstream Vera Sans %d' % FONT_SIZE)
    120 FONT_BOLD = Font('Bitstream Vera Sans bold %d' % FONT_SIZE)
     119client = gconf.client_get_default()
     120FONT_SIZE = client.get_float('/desktop/sugar/font/default_size')
     121FONT_FACE = client.get_string('/desktop/sugar/font/default_face')
     122
     123FONT_NORMAL = Font('%s %f' % (FONT_FACE, FONT_SIZE))
     124FONT_BOLD = Font('%s %f' % (FONT_FACE, FONT_SIZE))
    121125FONT_NORMAL_H = zoom(24)
    122126FONT_BOLD_H = zoom(24)
    123127