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

Walter Bender walter.bender at gmail.com
Fri Sep 10 14:57:11 EDT 2010


On Fri, Sep 10, 2010 at 12:51 PM, Kandarp Kaushik <kandarp at seeta.in> wrote:
> This patch scales the font in TA by using ZOOM_FACTOR
> set in sugar.graphics.style (SL#1858)
> ---
>  tawindow.py |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/tawindow.py b/tawindow.py
> index 6a5629e..271c78b 100644
> --- a/tawindow.py
> +++ b/tawindow.py
> @@ -33,6 +33,7 @@ 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:
> @@ -124,16 +125,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'
> @@ -2001,7 +2002,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 == 'nop':
>             if btype == 'vspace':
>                 if value is not None:
> --
> 1.7.1

The ZOOM_FACTOR is only defined if we are in the Sugar environment.
Alas, this is not taken into account in your patch.

-walter

>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>



-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org


More information about the Sugar-devel mailing list