Ticket #2256: add-scroll-view.patch

File add-scroll-view.patch, 5.5 KB (added by earias, 4 weeks ago)
  • olpc-switch-desktop-0.7

    diff -u -r -N olpc-switch-desktop-0.7.original/sugar/view.py olpc-switch-desktop-0.7/sugar/view.py
    old new  
    11# Copyright (C) 2009 One Laptop per Child 
     2# Copyright (C) 2010 Plan Ceibal <comunidad@plan.ceibal.edu.uy> 
    23# 
    34# This program is free software; you can redistribute it and/or modify 
    45# it under the terms of the GNU General Public License as published by 
     
    4142        self.set_border_width(style.DEFAULT_SPACING * 2) 
    4243        self.set_spacing(style.DEFAULT_SPACING) 
    4344 
     45        self._scrollwindow = gtk.ScrolledWindow() 
     46        self._scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) 
     47        self.pack_start(self._scrollwindow, expand=True) 
     48        self._scrollwindow.show() 
     49 
     50        self._vbox_section = gtk.VBox() 
     51        self._scrollwindow.add_with_viewport(self._vbox_section) 
     52        self._vbox_section.show() 
     53 
    4454        self._active_desktop_label = gtk.Label() 
    45         self.pack_start(self._active_desktop_label, False) 
     55        self._vbox_section.pack_start(self._active_desktop_label, False) 
    4656 
    4757        self._sugar_desc_label = gtk.Label( 
    4858            _("Sugar is the graphical user interface that you are looking at. " 
    4959              "It is a learning environment designed for children.")) 
    5060        self._sugar_desc_label.set_size_request(gtk.gdk.screen_width() / 2, -1) 
    5161        self._sugar_desc_label.set_line_wrap(True) 
    52         self.pack_start(self._sugar_desc_label, False) 
     62        self._vbox_section.pack_start(self._sugar_desc_label, False) 
    5363 
    5464        self._gnome_opt_label = gtk.Label( 
    5565            _("As an alternative to Sugar, you can switch to the GNOME " 
    5666              "desktop environment by clicking the button below.")) 
    5767        self._gnome_opt_label.set_line_wrap(True) 
    5868        self._gnome_opt_label.set_size_request(gtk.gdk.screen_width() / 2, -1) 
    59         self.pack_start(self._gnome_opt_label, False) 
     69        self._vbox_section.pack_start(self._gnome_opt_label, False) 
    6070 
    6171        self._restart_label = gtk.Label( 
    6272            _("Restart your computer to complete the change to the GNOME " 
    6373              "desktop environment.")) 
    6474        self._restart_label.set_line_wrap(True) 
    6575        self._restart_label.set_size_request(gtk.gdk.screen_width() / 2, -1) 
    66         self.pack_start(self._restart_label, False) 
     76        self._vbox_section.pack_start(self._restart_label, False) 
    6777 
    6878        self._undo_return_label = gtk.Label() 
    6979        self._undo_return_label.set_markup( 
     
    7383              "continue using Sugar as your desktop environment.")) 
    7484        self._undo_return_label.set_line_wrap(True) 
    7585        self._undo_return_label.set_size_request(gtk.gdk.screen_width() / 2, -1) 
    76         self.pack_start(self._undo_return_label, False) 
     86        self._vbox_section.pack_start(self._undo_return_label, False) 
    7787 
    7888 
    7989        self._switch_align = gtk.Alignment(xalign=0.5, yalign=0.5) 
    80         self.pack_start(self._switch_align) 
     90        self._vbox_section.pack_start(self._switch_align) 
    8191 
    8292        self._switch_button = gtk.Button(_("Switch to GNOME")) 
    8393        self._switch_button.set_image(Icon(icon_name="module-switch-desktop")) 
     
    8595 
    8696 
    8797        self._undo_align = gtk.Alignment(xalign=0.5, yalign=0.5) 
    88         self.pack_start(self._undo_align) 
     98        self._vbox_section.pack_start(self._undo_align) 
    8999 
    90100        hbox = gtk.HButtonBox() 
    91101        hbox.set_layout(gtk.BUTTONBOX_END) 
     
    101111        hbox.add(self._restart_button) 
    102112 
    103113        self._unknown_align = gtk.Alignment(xalign=0.5, yalign=0.5) 
    104         self.pack_start(self._unknown_align) 
     114        self._vbox_section.pack_start(self._unknown_align) 
    105115 
    106116        self._fix_unknown_button = gtk.Button(_("Set Sugar as active desktop")) 
    107117        self._fix_unknown_button.set_image(Icon(icon_name="computer-xo")) 
     
    114124              "from the GNOME <b>Applications</b> menu.")) 
    115125        self._return_label.set_line_wrap(True) 
    116126        self._return_label.set_size_request(gtk.gdk.screen_width() / 2, -1) 
    117         self.pack_start(self._return_label, False) 
     127        self._vbox_section.pack_start(self._return_label, False) 
    118128 
    119129        self._img_table = gtk.Table(rows=2, columns=2) 
    120         self.pack_start(self._img_table, False); 
     130        self._vbox_section.pack_start(self._img_table, False); 
    121131 
    122132        img_path = os.path.join(config.ext_path, 'cpsection', 'switchdesktop') 
    123133 
     
    151161 
    152162    def _update(self): 
    153163        self.hide_all() 
    154         self.show() 
     164        self.show_all() 
    155165 
    156166        active = self._model.get_active_desktop() 
    157167        self._active_desktop_label.set_markup("<big>" + _("Active desktop environment: ") 
     
    159169        self._active_desktop_label.show() 
    160170         
    161171        if active == "Sugar": 
     172            self._restart_label.hide() 
     173            self._undo_return_label.hide() 
     174            self._undo_align.hide_all() 
     175            self._unknown_align.hide_all() 
     176 
    162177            self._sugar_desc_label.show() 
    163178            self._gnome_opt_label.show() 
    164179            self._switch_align.show_all() 
    165180            self._return_label.show() 
    166181        elif active == "GNOME": 
     182            self._unknown_align.hide_all() 
     183            self._sugar_desc_label.hide() 
     184            self._gnome_opt_label.hide() 
     185            self._switch_align.hide_all() 
     186            self._return_label.hide() 
     187 
    167188            self._restart_label.show() 
    168189            self._undo_return_label.show() 
    169190            self._undo_align.show_all()