diff -u -r -N olpc-switch-desktop-0.7.original/sugar/view.py olpc-switch-desktop-0.7/sugar/view.py
old
|
new
|
|
1 | 1 | # Copyright (C) 2009 One Laptop per Child |
| 2 | # Copyright (C) 2010 Plan Ceibal <comunidad@plan.ceibal.edu.uy> |
2 | 3 | # |
3 | 4 | # This program is free software; you can redistribute it and/or modify |
4 | 5 | # it under the terms of the GNU General Public License as published by |
… |
… |
|
41 | 42 | self.set_border_width(style.DEFAULT_SPACING * 2) |
42 | 43 | self.set_spacing(style.DEFAULT_SPACING) |
43 | 44 | |
| 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 | |
44 | 54 | 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) |
46 | 56 | |
47 | 57 | self._sugar_desc_label = gtk.Label( |
48 | 58 | _("Sugar is the graphical user interface that you are looking at. " |
49 | 59 | "It is a learning environment designed for children.")) |
50 | 60 | self._sugar_desc_label.set_size_request(gtk.gdk.screen_width() / 2, -1) |
51 | 61 | 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) |
53 | 63 | |
54 | 64 | self._gnome_opt_label = gtk.Label( |
55 | 65 | _("As an alternative to Sugar, you can switch to the GNOME " |
56 | 66 | "desktop environment by clicking the button below.")) |
57 | 67 | self._gnome_opt_label.set_line_wrap(True) |
58 | 68 | 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) |
60 | 70 | |
61 | 71 | self._restart_label = gtk.Label( |
62 | 72 | _("Restart your computer to complete the change to the GNOME " |
63 | 73 | "desktop environment.")) |
64 | 74 | self._restart_label.set_line_wrap(True) |
65 | 75 | 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) |
67 | 77 | |
68 | 78 | self._undo_return_label = gtk.Label() |
69 | 79 | self._undo_return_label.set_markup( |
… |
… |
|
73 | 83 | "continue using Sugar as your desktop environment.")) |
74 | 84 | self._undo_return_label.set_line_wrap(True) |
75 | 85 | 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) |
77 | 87 | |
78 | 88 | |
79 | 89 | 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) |
81 | 91 | |
82 | 92 | self._switch_button = gtk.Button(_("Switch to GNOME")) |
83 | 93 | self._switch_button.set_image(Icon(icon_name="module-switch-desktop")) |
… |
… |
|
85 | 95 | |
86 | 96 | |
87 | 97 | 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) |
89 | 99 | |
90 | 100 | hbox = gtk.HButtonBox() |
91 | 101 | hbox.set_layout(gtk.BUTTONBOX_END) |
… |
… |
|
101 | 111 | hbox.add(self._restart_button) |
102 | 112 | |
103 | 113 | 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) |
105 | 115 | |
106 | 116 | self._fix_unknown_button = gtk.Button(_("Set Sugar as active desktop")) |
107 | 117 | self._fix_unknown_button.set_image(Icon(icon_name="computer-xo")) |
… |
… |
|
114 | 124 | "from the GNOME <b>Applications</b> menu.")) |
115 | 125 | self._return_label.set_line_wrap(True) |
116 | 126 | 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) |
118 | 128 | |
119 | 129 | 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); |
121 | 131 | |
122 | 132 | img_path = os.path.join(config.ext_path, 'cpsection', 'switchdesktop') |
123 | 133 | |
… |
… |
|
151 | 161 | |
152 | 162 | def _update(self): |
153 | 163 | self.hide_all() |
154 | | self.show() |
| 164 | self.show_all() |
155 | 165 | |
156 | 166 | active = self._model.get_active_desktop() |
157 | 167 | self._active_desktop_label.set_markup("<big>" + _("Active desktop environment: ") |
… |
… |
|
159 | 169 | self._active_desktop_label.show() |
160 | 170 | |
161 | 171 | 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 | |
162 | 177 | self._sugar_desc_label.show() |
163 | 178 | self._gnome_opt_label.show() |
164 | 179 | self._switch_align.show_all() |
165 | 180 | self._return_label.show() |
166 | 181 | 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 | |
167 | 188 | self._restart_label.show() |
168 | 189 | self._undo_return_label.show() |
169 | 190 | self._undo_align.show_all() |