[sugar] [PATCH] scroll activity list with the arrow keys

Marco Pesenti Gritti mpgritti at gmail.com
Thu May 15 06:56:00 EDT 2008


Any reason to not use key_press events or similar? I don't think we
should "patch" gtk.ScrolledWindow behavior.

Marco

On Thu, May 15, 2008 at 12:38 PM, Tomeu Vizoso <tomeu at tomeuvizoso.net> wrote:
> Hi,
>
> the patch below adds the Up and Down arrow keys to the
> gtk.ScrolledWindow key bindings in the activity list as requested by
> Eben.
>
> But, if I understand correctly, this code alters the behavior of _all_
> the gtk.ScrolledWindow instances in the shell. Two questions:
>
> - To Eben: Is this desired?
>
> - To anyone: Which place would be best for this code?
>
> Thanks,
>
> Tomeu
>
> diff --git a/src/view/home/activitieslist.py b/src/view/home/activitieslist.py
> index f638738..7264852 100644
> --- a/src/view/home/activitieslist.py
> +++ b/src/view/home/activitieslist.py
> @@ -15,6 +15,7 @@
>  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
>
>  import gobject
> +import gtk
>  import hippo
>
>  from sugar import profile
> @@ -31,7 +32,17 @@ class ActivitiesList(hippo.CanvasScrollbars):
>     def __init__(self):
>         hippo.CanvasScrollbars.__init__(self)
>         self.set_policy(hippo.ORIENTATION_HORIZONTAL, hippo.SCROLLBAR_NEVER)
> -
> +
> +        gtk.binding_entry_add_signal(gtk.ScrolledWindow, gtk.keysyms.Up, 0,
> +                                     'scroll-child',
> +                                     gtk.ScrollType, gtk.SCROLL_STEP_BACKWARD,
> +                                     bool, False)
> +
> +        gtk.binding_entry_add_signal(gtk.ScrolledWindow, gtk.keysyms.Down, 0,
> +                                     'scroll-child',
> +                                     gtk.ScrollType, gtk.SCROLL_STEP_FORWARD,
> +                                     bool, False)
> +
>         self._box = hippo.CanvasBox( \
>                 background_color=style.COLOR_WHITE.get_int())
>         self.set_root(self._box)
> _______________________________________________
> Sugar mailing list
> Sugar at lists.laptop.org
> http://lists.laptop.org/listinfo/sugar
>


More information about the Sugar mailing list