[Sugar-devel] [PATCH] Scale TA font proportional to Sugar font-settings. (SL#1858)

Kandarp Kaushik kandarp at seeta.in
Tue Sep 21 23:40:21 EDT 2010


This patch scales the font in TA by using ZOOM_FACTOR
set in sugar.graphics.style (SL#1858)
---
 TurtleArt/tawindow.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index 3100d7c..39c1612 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -33,10 +33,11 @@ from gettext import gettext as _
 
 try:
     from sugar.graphics.objectchooser import ObjectChooser
+    from sugar.graphics.style import ZOOM_FACTOR
     from sugar.datastore import datastore
     from sugar import profile
 except ImportError:
-    pass
+    ZOOM_FACTOR = 1
 
 from taconstants import HORIZONTAL_PALETTE, VERTICAL_PALETTE, BLOCK_SCALE, \
                         PALETTE_NAMES, TITLEXY, MEDIA_SHAPES, STATUS_SHAPES, \
@@ -125,16 +126,16 @@ class TurtleArtWindow():
         self.orientation = HORIZONTAL_PALETTE
         if olpc_xo_1():
             self.lead = 1.0
-            self.scale = 0.67
+            self.scale = 0.67 * ZOOM_FACTOR
             self.color_mode = '565'
             if self.running_sugar and not self.activity.new_sugar_system:
                 self.orientation = VERTICAL_PALETTE
         else:
             self.lead = 1.0
-            self.scale = 1.0
+            self.scale = 1.0 * ZOOM_FACTOR
             self.color_mode = '888' # TODO: Read visual mode from gtk image
 
-        self.block_scale = BLOCK_SCALE
+        self.block_scale = BLOCK_SCALE * ZOOM_FACTOR
         self.trash_scale = 0.5
         self.myblock = None
         self.nop = 'nop'
@@ -2035,7 +2036,7 @@ class TurtleArtWindow():
             blk.spr.set_label(blk.values[0].replace('\n', RETURN))
         elif btype == 'start': # block size is saved in start block
             if value is not None:
-                self.block_scale = value
+                self.block_scale = value * ZOOM_FACTOR
         elif btype in EXPANDABLE or btype in EXPANDABLE_BLOCKS or \
              btype in EXPANDABLE_ARGS or btype == 'nop':
             if btype == 'vspace' or btype in EXPANDABLE_BLOCKS:
-- 
1.7.1



More information about the Sugar-devel mailing list