[Sugar-devel] [sugar PATCH] sl#3833: Now, the palettes appear fine in the bottom frame-tray.

Simon Schampijer simon at schampijer.de
Fri Mar 8 04:08:12 EST 2013


Hey Ajay,

thanks for the new patch, looks like this solves the previous issues we 
have been seeing there.

On 03/06/2013 01:30 PM, Ajay Garg wrote:
> The solution has been build upon the "no-caching" solution provided by erikos at
> http://bugs.sugarlabs.org/ticket/4419#comment:4
>
> Theerafter, the cause of http://bugs.sugarlabs.org/attachment/ticket/3833/Screenshot%20of%20_Journal_.png
> is not taking "style.GRID_CELL_SIZE" into account, when calucating the alignments for the palettes.
>
> I will have to thank manuq a great deal, for his comment http://bugs.sugarlabs.org/ticket/3833#comment:11,
> which helped me debug the real issue.
> In particular, his observation that the "landscape"-mode-obscurity occurs only in one of the erikos' solutions;
> while the "portrait-mode-obscurity" occurs only in both of erikos's solutions.
>
> Finally, this patch provides the no-obscurity solution for all cases :)

This is information I would expect in a ticket comment but the patch 
description needs to inform about the issue and its solution. See the 
following examples for a style guide:

http://git.sugarlabs.org/sugar/mainline/commit/c6e19b4df9e8c1a4216aa09b9c579b43da9684d2

http://git.sugarlabs.org/sugar/mainline/commit/0a98409be5eedb9ee27a9fd1b526e99c764f55f5

http://git.sugarlabs.org/sugar/mainline/commit/158f4384d1f3423a6c2063723434f4f331796f81

>   src/sugar3/graphics/palettewindow.py | 18 ++++++++----------
>   1 file changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py
> index c48ae55..e192a7c 100644
> --- a/src/sugar3/graphics/palettewindow.py
> +++ b/src/sugar3/graphics/palettewindow.py
> @@ -777,8 +777,6 @@ class Invoker(GObject.GObject):
>
>           self._screen_area = Gdk.Rectangle()
>           self._screen_area.x = self._screen_area.y = 0
> -        self._screen_area.width = Gdk.Screen.width()
> -        self._screen_area.height = Gdk.Screen.height()
>           self._position_hint = self.ANCHORED
>           self._cursor_x = -1
>           self._cursor_y = -1
> @@ -841,8 +839,8 @@ class Invoker(GObject.GObject):
>       def _in_screen(self, rect):
>           return rect.x >= self._screen_area.x and \
>                  rect.y >= self._screen_area.y and \
> -               rect.x + rect.width <= self._screen_area.width and \
> -               rect.y + rect.height <= self._screen_area.height
> +               rect.x + rect.width <= (Gdk.Screen.width() - style.GRID_CELL_SIZE) and \
> +               rect.y + rect.height <= (Gdk.Screen.height() - style.GRID_CELL_SIZE)
>
>       def _get_area_in_screen(self, rect):
>           """Return area of rectangle visible in the screen"""
> @@ -850,9 +848,9 @@ class Invoker(GObject.GObject):
>           x1 = max(rect.x, self._screen_area.x)
>           y1 = max(rect.y, self._screen_area.y)
>           x2 = min(rect.x + rect.width,
> -                self._screen_area.x + self._screen_area.width)
> +                self._screen_area.x + Gdk.Screen.width() - style.GRID_CELL_SIZE)
>           y2 = min(rect.y + rect.height,
> -                self._screen_area.y + self._screen_area.height)
> +                self._screen_area.y + Gdk.Screen.height() - style.GRID_CELL_SIZE)
>
>           return (x2 - x1) * (y2 - y1)
>
> @@ -882,8 +880,8 @@ class Invoker(GObject.GObject):
>           rect.x = max(0, rect.x)
>           rect.y = max(0, rect.y)
>
> -        rect.x = min(rect.x, self._screen_area.width - rect.width)
> -        rect.y = min(rect.y, self._screen_area.height - rect.height)
> +        rect.x = min(rect.x, Gdk.Screen.width() - style.GRID_CELL_SIZE - rect.width)
> +        rect.y = min(rect.y, Gdk.Screen.height()- style.GRID_CELL_SIZE - rect.height)
>
>           return rect
>
> @@ -913,7 +911,7 @@ class Invoker(GObject.GObject):
>
>           if best_alignment in self.LEFT or best_alignment in self.RIGHT:
>               dtop = rect.y - screen_area.y
> -            dbottom = screen_area.y + screen_area.height - rect.y - rect.width
> +            dbottom = screen_area.y + Gdk.Screen.height() - style.GRID_CELL_SIZE - rect.y - rect.width

This exceeds 79 chars.

>               iv = 0
>
> @@ -928,7 +926,7 @@ class Invoker(GObject.GObject):
>
>           elif best_alignment in self.TOP or best_alignment in self.BOTTOM:
>               dleft = rect.x - screen_area.x
> -            dright = screen_area.x + screen_area.width - rect.x - rect.width
> +            dright = screen_area.x + Gdk.Screen.width() - style.GRID_CELL_SIZE - rect.x - rect.width

Same here.

Please run another test for all the Palettes if we do not miss one, we 
already screwed up several times.

Would be great if thorough Manuel could have another testing run on the 
final patch with the fixups from above.

Thanks,
    Simon




More information about the Sugar-devel mailing list