Re: [Sugar-devel] [REVIEW] adding spiral to Home View

2010-08-07 Thread Gonzalo Odiard


 P.S. Random Paint related question. Are you still in the process of tidying
 up the toolbar and paint tools? I'm thinking of spending some time there
 with the main intention of designing and implementing support for the new
 Sugar toolbars. I didn't want to duplicate our effort if you're already
 working in that direction.

 I'm not working on this. Is very good if you can do it.

-- 

Gonzalo
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [REVIEW] adding spiral to Home View

2010-08-06 Thread Gary Martin
Hi Walter,

Wanted to give it a quick run in my vm, but when I tried to apply it using 
patch, it gave me the error:

   patch:  malformed patch at line 35: @@ -201,6 +202,11 @@ class 
RingLayout(FavoritesLayout):

I'm probably doing something dumb, is this the expected way to apply the patch?

--Gary

On 6 Aug 2010, at 13:58, Walter Bender wrote:

 As per http://lists.sugarlabs.org/archive/sugar-devel/2010-August/025874.html
 I have been experimenting with a variant of the Home View in which the
 circle morphs into a spiral when the number of icons grows too large.
 Icons don't shrink until the spiral runs off the screen. With this
 scheme, we can support on the order of 200+ icons on the Home View.
 
 This is just a first pass. Please review. Thanks.
 
 
 From 4ad5ad7e003fdd9eeb703c1287bd9f5c8484e967 Mon Sep 17 00:00:00 2001
 From: Walter Bender wal...@sugarlabs.org
 Date: Fri, 6 Aug 2010 08:53:10 -0400
 Subject: [PATCH] adding spiral to circle view
 
 ---
 src/jarabe/desktop/favoriteslayout.py |   92 ++---
 1 files changed, 73 insertions(+), 19 deletions(-)
 
 diff --git a/src/jarabe/desktop/favoriteslayout.py
 b/src/jarabe/desktop/favoriteslayout.py
 index 85e1b59..a945c49 100644
 --- a/src/jarabe/desktop/favoriteslayout.py
 +++ b/src/jarabe/desktop/favoriteslayout.py
 @@ -1,4 +1,5 @@
 # Copyright (C) 2008 One Laptop Per Child
 +# Copyright (C) 2010 Sugar Labs
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 @@ -201,6 +202,11 @@ class RingLayout(FavoritesLayout):
 def __init__(self):
 FavoritesLayout.__init__(self)
 self._locked_children = {}
 +self._spiral = False
 +self._radius = _MINIMUM_RADIUS
 +self._orientation = math.pi
 +self._icon_size = style.STANDARD_ICON_SIZE
 +self._count = -1
 
 def append(self, icon, locked=False):
 FavoritesLayout.append(self, icon, locked)
 @@ -221,31 +227,79 @@ class RingLayout(FavoritesLayout):
 self._locked_children[child] = (x, y)
 
 def _calculate_radius_and_icon_size(self, children_count):
 -# what's the radius required without downscaling?
 + determine if we are drawing a circle or a spiral 
 distance = style.STANDARD_ICON_SIZE + style.DEFAULT_SPACING
 -icon_size = style.STANDARD_ICON_SIZE
 -# circumference is 2*pi*r; we want this to be at least
 -# 'children_count * distance'
 +
 radius = children_count * distance / (2 * math.pi)
 -# limit computed radius to reasonable bounds.
 -radius = max(radius, _MINIMUM_RADIUS)
 -radius = min(radius, _MAXIMUM_RADIUS)
 -# recompute icon size from limited radius
 -if children_count  0:
 -icon_size = (2 * math.pi * radius / children_count) \
 -- style.DEFAULT_SPACING
 -# limit adjusted icon size.
 -icon_size = max(icon_size, style.SMALL_ICON_SIZE)
 -icon_size = min(icon_size, style.MEDIUM_ICON_SIZE)
 -return radius, icon_size
 +if radius  _MAXIMUM_RADIUS:
 +self._spiral = False
 +self._icon_size = style.STANDARD_ICON_SIZE
 +else:
 +self._spiral = True
 +radius = _MINIMUM_RADIUS
 +
 +# If there are fewer children, try increasing icon_size.
 +if self._count  children_count:
 +logging.debug('resetting count: %d  %d' % (self._count,
 children_count))
 +if self._icon_size == style.MEDIUM_ICON_SIZE:
 +self._icon_size = style.STANDARD_ICON_SIZE
 +elif self._icon_size == style.SMALL_ICON_SIZE:
 +self._icon_size = style.MEDIUM_ICON_SIZE
 +self._count = children_count
 +
 +return radius, self._icon_size
 +
 +def _calculate_xy(self, icon_size, width, height):
 + Convert r, o to x, y 
 +x = -math.sin(self._orientation) * self._radius
 +y = math.cos(self._orientation) * self._radius
 +self._calculate_new_radius_orientation(icon_size +\
 +   style.DEFAULT_SPACING)
 +
 +x = int(x) + (width - icon_size) / 2
 +y = int(y) + (height - icon_size - (style.GRID_CELL_SIZE / 2) ) / 2
 +return x, y
 +
 +def _calculate_new_radius_orientation(self, icon_size):
 + Based upon current radius, calculate new increments 
 +circumference = self._radius * 2 * math.pi
 +n = circumference / icon_size
 +self._orientation += 2 * math.pi / n
 +self._radius += float(icon_size) / n
 
 def _calculate_position(self, radius, icon_size, index, children_count,
 sin=math.sin, cos=math.cos):
 + Try fitting a circle or a spiral 
 +
 width, height = self.box.get_allocation()
 -angle = index * (2 * math.pi / children_count) - math.pi / 

Re: [Sugar-devel] [REVIEW] adding spiral to Home View

2010-08-06 Thread Walter Bender
On Fri, Aug 6, 2010 at 12:19 PM, Sascha Silbe
sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Gary Martin's message of Fri Aug 06 17:48:36 +0200 2010:

    patch:  malformed patch at line 35: @@ -201,6 +202,11 @@ class 
 RingLayout(FavoritesLayout):
 It also doesn't apply for me, though at a different point:

 sascha.si...@twin:~/sugar-jhbuild/source/sugar-toolkit$ git am ~/x.patch
 Applying: adding spiral to Home View
 fatal: corrupt patch at line 62
 Patch failed at 0001 adding spiral to Home View
 When you have resolved this problem run git am --resolved.
 If you would prefer to skip this patch, instead run git am --skip.
 To restore the original branch and stop patching run git am --abort.


 Line 62 has been wrapped by Walters MUA:

 +            logging.debug('resetting count: %d  %d' % (self._count,
 children_count))


 The easiest way to avoid this kind of issue is to use git send-email.
 If anyone has trouble getting git send-email to talk to their regular
 mail server, we can configure sunjammer to accept mails via SMTP/AUTH.

 Sascha

 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel



Sorrry about that. I've had trouble getting git sendmail to work on my
machine...

I'll also attach the patch to the ticket for this enhancement, which I
don't think has been created yet.

-walter

-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [REVIEW] adding spiral to Home View

2010-08-06 Thread Walter Bender
On Fri, Aug 6, 2010 at 2:18 PM, Walter Bender walter.ben...@gmail.com wrote:
 On Fri, Aug 6, 2010 at 12:19 PM, Sascha Silbe
 sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Gary Martin's message of Fri Aug 06 17:48:36 +0200 2010:

    patch:  malformed patch at line 35: @@ -201,6 +202,11 @@ class 
 RingLayout(FavoritesLayout):
 It also doesn't apply for me, though at a different point:

 sascha.si...@twin:~/sugar-jhbuild/source/sugar-toolkit$ git am ~/x.patch
 Applying: adding spiral to Home View
 fatal: corrupt patch at line 62
 Patch failed at 0001 adding spiral to Home View
 When you have resolved this problem run git am --resolved.
 If you would prefer to skip this patch, instead run git am --skip.
 To restore the original branch and stop patching run git am --abort.


 Line 62 has been wrapped by Walters MUA:

 +            logging.debug('resetting count: %d  %d' % (self._count,
 children_count))


 The easiest way to avoid this kind of issue is to use git send-email.
 If anyone has trouble getting git send-email to talk to their regular
 mail server, we can configure sunjammer to accept mails via SMTP/AUTH.

 Sascha

 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel



 Sorrry about that. I've had trouble getting git sendmail to work on my
 machine...

 I'll also attach the patch to the ticket for this enhancement, which I
 don't think has been created yet.

Tracking this enhancement here:

http://bugs.sugarlabs.org/attachment/ticket/2143/

A feature page to come shortly.

-walter

 -walter

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




-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [REVIEW] adding spiral to Home View

2010-08-06 Thread Gary Martin
Hi Walter,

On 6 Aug 2010, at 19:27, Walter Bender wrote:

 On Fri, Aug 6, 2010 at 2:18 PM, Walter Bender walter.ben...@gmail.com wrote:
 On Fri, Aug 6, 2010 at 12:19 PM, Sascha Silbe
 sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Gary Martin's message of Fri Aug 06 17:48:36 +0200 2010:
 
patch:  malformed patch at line 35: @@ -201,6 +202,11 @@ class 
 RingLayout(FavoritesLayout):
 It also doesn't apply for me, though at a different point:
 
 sascha.si...@twin:~/sugar-jhbuild/source/sugar-toolkit$ git am ~/x.patch
 Applying: adding spiral to Home View
 fatal: corrupt patch at line 62
 Patch failed at 0001 adding spiral to Home View
 When you have resolved this problem run git am --resolved.
 If you would prefer to skip this patch, instead run git am --skip.
 To restore the original branch and stop patching run git am --abort.
 
 
 Line 62 has been wrapped by Walters MUA:
 
 +logging.debug('resetting count: %d  %d' % (self._count,
 children_count))
 
 
 The easiest way to avoid this kind of issue is to use git send-email.
 If anyone has trouble getting git send-email to talk to their regular
 mail server, we can configure sunjammer to accept mails via SMTP/AUTH.
 
 Sascha
 
 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/
 
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel
 
 
 
 Sorrry about that. I've had trouble getting git sendmail to work on my
 machine...
 
 I'll also attach the patch to the ticket for this enhancement, which I
 don't think has been created yet.
 
 Tracking this enhancement here:
 
 http://bugs.sugarlabs.org/attachment/ticket/2143/

Thanks, the patch from this ticket applied just fine. Few of quick 
observations/questions:

- We should think how Sugar handles downloaded patches a little better ;-) 
Downloads to Journal fine, but then it will only want to open in Etoys so no 
easy way to get the patch out of Journal to apply. In the end I copy and pasted 
from the raw text version of the patch with Browse on the ticket, then went to 
Terminal and created a new patch file with vi and pasted, saved, patched. Hmmm, 
I wonder if all we would need to close this dog food gap is a simple Patch 
activity that can resume and apply .patch files from the Journal.

- Downloaded a load more activities to try and trigger the spiral, and notices 
another three svg icons that don't render correctly in the latest F13 builds. 
Scratch, Paint, and Kandid. I'll fix them up and email the activity authors.

- I should go look through the code... But does the circle/spiral correctly 
adapt to screen resolutions? Are you testing in an 800x600 window? In my 
default 1024x768 looks like it could be a little more generous with the 
spacing/size as there's plenty of white space (will try 1200x900 later). Maybe 
this is another case where the SUGAR_SCALING value of 72 or 100 is limiting 
layout flexibility for different resolution screens.

--Gary

 A feature page to come shortly.
 
 -walter
 
 -walter
 
 --
 Walter Bender
 Sugar Labs
 http://www.sugarlabs.org
 
 
 -- 
 Walter Bender
 Sugar Labs
 http://www.sugarlabs.org
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [REVIEW] adding spiral to Home View

2010-08-06 Thread Walter Bender
On Fri, Aug 6, 2010 at 3:51 PM, Gary Martin garycmar...@googlemail.com wrote:
 Hi Walter,

 On 6 Aug 2010, at 19:27, Walter Bender wrote:

 On Fri, Aug 6, 2010 at 2:18 PM, Walter Bender walter.ben...@gmail.com 
 wrote:
 On Fri, Aug 6, 2010 at 12:19 PM, Sascha Silbe
 sascha-ml-ui-sugar-de...@silbe.org wrote:
 Excerpts from Gary Martin's message of Fri Aug 06 17:48:36 +0200 2010:

    patch:  malformed patch at line 35: @@ -201,6 +202,11 @@ class 
 RingLayout(FavoritesLayout):
 It also doesn't apply for me, though at a different point:

 sascha.si...@twin:~/sugar-jhbuild/source/sugar-toolkit$ git am ~/x.patch
 Applying: adding spiral to Home View
 fatal: corrupt patch at line 62
 Patch failed at 0001 adding spiral to Home View
 When you have resolved this problem run git am --resolved.
 If you would prefer to skip this patch, instead run git am --skip.
 To restore the original branch and stop patching run git am --abort.


 Line 62 has been wrapped by Walters MUA:

 +            logging.debug('resetting count: %d  %d' % (self._count,
 children_count))


 The easiest way to avoid this kind of issue is to use git send-email.
 If anyone has trouble getting git send-email to talk to their regular
 mail server, we can configure sunjammer to accept mails via SMTP/AUTH.

 Sascha

 --
 http://sascha.silbe.org/
 http://www.infra-silbe.de/

 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel



 Sorrry about that. I've had trouble getting git sendmail to work on my
 machine...

 I'll also attach the patch to the ticket for this enhancement, which I
 don't think has been created yet.

 Tracking this enhancement here:

 http://bugs.sugarlabs.org/attachment/ticket/2143/

 Thanks, the patch from this ticket applied just fine. Few of quick 
 observations/questions:

 - We should think how Sugar handles downloaded patches a little better ;-) 
 Downloads to Journal fine, but then it will only want to open in Etoys so no 
 easy way to get the patch out of Journal to apply. In the end I copy and 
 pasted from the raw text version of the patch with Browse on the ticket, then 
 went to Terminal and created a new patch file with vi and pasted, saved, 
 patched. Hmmm, I wonder if all we would need to close this dog food gap is a 
 simple Patch activity that can resume and apply .patch files from the Journal.

 - Downloaded a load more activities to try and trigger the spiral, and 
 notices another three svg icons that don't render correctly in the latest F13 
 builds. Scratch, Paint, and Kandid. I'll fix them up and email the activity 
 authors.

I had sent a new icon to the Scratch team a while ago... there may be
a ticket associated with it as well.


 - I should go look through the code... But does the circle/spiral correctly 
 adapt to screen resolutions? Are you testing in an 800x600 window? In my 
 default 1024x768 looks like it could be a little more generous with the 
 spacing/size as there's plenty of white space (will try 1200x900 later). 
 Maybe this is another case where the SUGAR_SCALING value of 72 or 100 is 
 limiting layout flexibility for different resolution screens.

Hmm. I did most of my testing at 832x624 to approximate the XO in the
Sugar emulator. I didn't do anything to change the circle spacing --
at least not intentionally -- and I use the same Sugar constant for
the spiral spacing:

distance = style.STANDARD_ICON_SIZE + style.DEFAULT_SPACING

We could play with it some more.

-walter

 --Gary

 A feature page to come shortly.

 -walter

 -walter

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


 --
 Walter Bender
 Sugar Labs
 http://www.sugarlabs.org
 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel





-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [REVIEW] adding spiral to Home View

2010-08-06 Thread Gonzalo Odiard
 - Downloaded a load more activities to try and trigger the spiral, and
 notices another three svg icons that don't render correctly in the latest
 F13 builds. Scratch, Paint, and Kandid. I'll fix them up and email the
 activity authors.

 The Paint icon has been corrected. In the next version will be ok (you can
check from git if you want)

Gonzalo
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel