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): |
280 | 280 | self._jobject = None |
281 | 281 | self._read_file_called = False |
282 | 282 | |
| 283 | settings = gtk.settings_get_default() |
| 284 | settings.set_property("gtk-font-name", "%s %f" % (style.FONT_FACE, style.FONT_SIZE)) |
| 285 | |
283 | 286 | self._session = _get_session() |
284 | 287 | self._session.register(self) |
285 | 288 | self._session.connect('quit-requested', |
diff --git a/src/sugar/graphics/style.py b/src/sugar/graphics/style.py
index 6d5e35e..ccc6912 100644
a
|
b
|
import logging |
27 | 27 | |
28 | 28 | import gtk |
29 | 29 | import pango |
| 30 | import gconf |
30 | 31 | |
31 | 32 | |
32 | 33 | FOCUS_LINE_WIDTH = 2 |
… |
… |
MEDIUM_ICON_SIZE = zoom(55 * 1.5) |
115 | 116 | LARGE_ICON_SIZE = zoom(55 * 2.0) |
116 | 117 | XLARGE_ICON_SIZE = zoom(55 * 2.75) |
117 | 118 | |
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) |
| 119 | client = gconf.client_get_default() |
| 120 | FONT_SIZE = client.get_float('/desktop/sugar/font/default_size') |
| 121 | FONT_FACE = client.get_string('/desktop/sugar/font/default_face') |
| 122 | |
| 123 | FONT_NORMAL = Font('%s %f' % (FONT_FACE, FONT_SIZE)) |
| 124 | FONT_BOLD = Font('%s %f' % (FONT_FACE, FONT_SIZE)) |
121 | 125 | FONT_NORMAL_H = zoom(24) |
122 | 126 | FONT_BOLD_H = zoom(24) |
123 | 127 | |