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

Ishan Bansal ishan at seeta.in
Wed Oct 20 15:17:23 EDT 2010


hi

i had submitted a patch for the ticket #1858.

Wish if you can review the patch and provide me suggestions on any changes
required.

regards

ishan

---------- Forwarded message ----------
From: Ishan Bansal <ishan at seeta.in>
Date: Sun, Sep 26, 2010 at 1:49 AM
Subject: [PATCH] Scale TA font proportional to Sugar font-settings.
(SL#1858)
To: sugar-devel at lists.sugarlabs.org


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

diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index ac16d9c..696a1bd 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -35,6 +35,7 @@ try:
    from sugar.graphics.objectchooser import ObjectChooser
    from sugar.datastore import datastore
    from sugar import profile
+    from sugar.graphics import style
 except ImportError:
    pass

@@ -127,17 +128,17 @@ class TurtleArtWindow():
        self.orientation = HORIZONTAL_PALETTE
        if olpc_xo_1():
            self.lead = 1.0
-            self.scale = 0.67
+            self.scale = 0.67 * style.zoom(1)
            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 * style.zoom(1)
            self.color_mode = '888' # TODO: Read visual mode from gtk image

        self.block_scale = BLOCK_SCALE
-        self.trash_scale = 0.5
+        self.trash_scale = 0.5 * style.zoom(1)
        self.myblock = None
        self.nop = 'nop'
        self.loaded = 0
@@ -2156,7 +2157,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 * style.zoom(1)
        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.0.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20101021/c60583bd/attachment.html>


More information about the Sugar-devel mailing list