[Sugar-devel] [PATCH Browse] Step scroll with the keypad arrow keys OLPC #11806

Simon Schampijer simon at schampijer.de
Mon Apr 30 07:54:46 EDT 2012


Hi Manuel,

thanks for the patch.

Please state in the patch description that it has been working before, 
that it is a regression and how it has been lost, why we need to re-add it.

On 04/29/2012 01:06 AM, Manuel Quiñones wrote:
> Signed-off-by: Manuel Quiñones<manuq at laptop.org>
> ---
>   webactivity.py |   17 +++++++++++++++++
>   1 files changed, 17 insertions(+), 0 deletions(-)
>
> diff --git a/webactivity.py b/webactivity.py
> index 156ea3c..2e93ae6 100644
> --- a/webactivity.py
> +++ b/webactivity.py
> @@ -464,6 +464,23 @@ class WebActivity(activity.Activity):
>
>               return True
>
> +        elif key_name in ('KP_Up', 'KP_Down', 'KP_Left', 'KP_Right'):
> +            scrolled = browser.get_parent()

scrolled_window is more descriptive here imho.

> +            if key_name in ('KP_Up', 'KP_Down'):
> +                adj = scrolled.get_vadjustment()
> +            elif key_name in ('KP_Left', 'KP_Right'):
> +                adj = scrolled.get_hadjustment()
> +            value = adj.get_value()
> +            step = adj.get_step_increment()
> +
> +            if key_name in ('KP_Up', 'KP_Left'):
> +                adj.set_value(value - step)
> +            elif key_name in ('KP_Down', 'KP_Right'):
> +                adj.set_value(value + step)
> +
> +            return True
> +
>           return False
>
>       def _add_link(self):

Looks good to me and does work fine on the XO.

Regards,
    Simon


More information about the Sugar-devel mailing list