Merge lp:~elachuni/software-center/pep8-test-part11 into lp:software-center
- pep8-test-part11
- Merge into trunk
Proposed by
Anthony Lenton
Status: | Merged |
---|---|
Merged at revision: | 2854 |
Proposed branch: | lp:~elachuni/software-center/pep8-test-part11 |
Merge into: | lp:software-center |
Prerequisite: | lp:~elachuni/software-center/pep8-test-part10 |
Diff against target: |
1071 lines (+162/-148) 8 files modified
softwarecenter/ui/gtk3/panes/pendingpane.py (+7/-6) softwarecenter/ui/gtk3/panes/softwarepane.py (+37/-41) softwarecenter/ui/gtk3/panes/unused__channelpane.py (+33/-30) softwarecenter/ui/gtk3/panes/viewswitcher.py (+17/-17) softwarecenter/ui/gtk3/session/appmanager.py (+25/-18) softwarecenter/ui/gtk3/session/navhistory.py (+17/-16) softwarecenter/ui/gtk3/session/viewmanager.py (+20/-19) test/test_pep8.py (+6/-1) |
To merge this branch: | bzr merge lp:~elachuni/software-center/pep8-test-part11 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary Lasker (community) | Approve | ||
Review via email: mp+97547@code.launchpad.net |
Commit message
Description of the change
Made all files from softwarecenter.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'softwarecenter/ui/gtk3/panes/pendingpane.py' | |||
2 | --- softwarecenter/ui/gtk3/panes/pendingpane.py 2011-10-06 02:53:27 +0000 | |||
3 | +++ softwarecenter/ui/gtk3/panes/pendingpane.py 2012-03-15 00:20:29 +0000 | |||
4 | @@ -30,7 +30,7 @@ | |||
5 | 30 | 30 | ||
6 | 31 | 31 | ||
7 | 32 | class PendingPane(Gtk.ScrolledWindow, BasePane): | 32 | class PendingPane(Gtk.ScrolledWindow, BasePane): |
9 | 33 | 33 | ||
10 | 34 | CANCEL_XPAD = StockEms.MEDIUM | 34 | CANCEL_XPAD = StockEms.MEDIUM |
11 | 35 | CANCEL_YPAD = StockEms.MEDIUM | 35 | CANCEL_YPAD = StockEms.MEDIUM |
12 | 36 | 36 | ||
13 | @@ -64,14 +64,14 @@ | |||
14 | 64 | tp.set_property("xpad", self.CANCEL_XPAD) | 64 | tp.set_property("xpad", self.CANCEL_XPAD) |
15 | 65 | tp.set_property("ypad", self.CANCEL_YPAD) | 65 | tp.set_property("ypad", self.CANCEL_YPAD) |
16 | 66 | tp.set_property("text", "") | 66 | tp.set_property("text", "") |
18 | 67 | column = Gtk.TreeViewColumn("Progress", tp, | 67 | column = Gtk.TreeViewColumn("Progress", tp, |
19 | 68 | value=PendingStore.COL_PROGRESS, | 68 | value=PendingStore.COL_PROGRESS, |
20 | 69 | pulse=PendingStore.COL_PULSE) | 69 | pulse=PendingStore.COL_PULSE) |
21 | 70 | column.set_min_width(200) | 70 | column.set_min_width(200) |
22 | 71 | self.tv.append_column(column) | 71 | self.tv.append_column(column) |
23 | 72 | # cancel icon | 72 | # cancel icon |
24 | 73 | tpix = Gtk.CellRendererPixbuf() | 73 | tpix = Gtk.CellRendererPixbuf() |
26 | 74 | column = Gtk.TreeViewColumn("Cancel", tpix, | 74 | column = Gtk.TreeViewColumn("Cancel", tpix, |
27 | 75 | stock_id=PendingStore.COL_CANCEL) | 75 | stock_id=PendingStore.COL_CANCEL) |
28 | 76 | self.tv.append_column(column) | 76 | self.tv.append_column(column) |
29 | 77 | # fake columns that eats the extra space at the end | 77 | # fake columns that eats the extra space at the end |
30 | @@ -81,7 +81,7 @@ | |||
31 | 81 | # add it | 81 | # add it |
32 | 82 | store = PendingStore(icons) | 82 | store = PendingStore(icons) |
33 | 83 | self.tv.set_model(store) | 83 | self.tv.set_model(store) |
35 | 84 | 84 | ||
36 | 85 | def _on_button_pressed(self, widget, event): | 85 | def _on_button_pressed(self, widget, event): |
37 | 86 | """button press handler to capture clicks on the cancel button""" | 86 | """button press handler to capture clicks on the cancel button""" |
38 | 87 | #print "_on_clicked: ", event | 87 | #print "_on_clicked: ", event |
39 | @@ -100,7 +100,7 @@ | |||
40 | 100 | # not cancelable (no icon) | 100 | # not cancelable (no icon) |
41 | 101 | model = self.tv.get_model() | 101 | model = self.tv.get_model() |
42 | 102 | if model[path][PendingStore.COL_CANCEL] == "": | 102 | if model[path][PendingStore.COL_CANCEL] == "": |
44 | 103 | return | 103 | return |
45 | 104 | # get tid | 104 | # get tid |
46 | 105 | tid = model[path][PendingStore.COL_TID] | 105 | tid = model[path][PendingStore.COL_TID] |
47 | 106 | trans = model._transactions_watcher.get_transaction(tid) | 106 | trans = model._transactions_watcher.get_transaction(tid) |
48 | @@ -125,6 +125,7 @@ | |||
49 | 125 | def get_callback_for_page(self, page_id, view_state): | 125 | def get_callback_for_page(self, page_id, view_state): |
50 | 126 | return None | 126 | return None |
51 | 127 | 127 | ||
52 | 128 | |||
53 | 128 | def get_test_window(): | 129 | def get_test_window(): |
54 | 129 | 130 | ||
55 | 130 | from softwarecenter.testutils import get_test_gtk3_icon_cache | 131 | from softwarecenter.testutils import get_test_gtk3_icon_cache |
56 | @@ -139,7 +140,7 @@ | |||
57 | 139 | win = Gtk.Window() | 140 | win = Gtk.Window() |
58 | 140 | win.add(scroll) | 141 | win.add(scroll) |
59 | 141 | view.grab_focus() | 142 | view.grab_focus() |
61 | 142 | win.set_size_request(500,200) | 143 | win.set_size_request(500, 200) |
62 | 143 | win.show_all() | 144 | win.show_all() |
63 | 144 | win.connect("destroy", Gtk.main_quit) | 145 | win.connect("destroy", Gtk.main_quit) |
64 | 145 | 146 | ||
65 | 146 | 147 | ||
66 | === modified file 'softwarecenter/ui/gtk3/panes/softwarepane.py' | |||
67 | --- softwarecenter/ui/gtk3/panes/softwarepane.py 2012-02-28 13:51:20 +0000 | |||
68 | +++ softwarecenter/ui/gtk3/panes/softwarepane.py 2012-03-15 00:20:29 +0000 | |||
69 | @@ -78,15 +78,16 @@ | |||
70 | 78 | self.filter = None | 78 | self.filter = None |
71 | 79 | self.previous_purchases_query = None | 79 | self.previous_purchases_query = None |
72 | 80 | self.vadjustment = 0.0 | 80 | self.vadjustment = 0.0 |
73 | 81 | return | ||
74 | 82 | 81 | ||
75 | 83 | def __setattr__(self, name, val): | 82 | def __setattr__(self, name, val): |
76 | 84 | attrs = self._attrs | 83 | attrs = self._attrs |
77 | 85 | if name not in attrs: | 84 | if name not in attrs: |
79 | 86 | raise AttributeError("The attr name \"%s\" is not permitted" % name) | 85 | raise AttributeError("The attr name \"%s\" is not permitted" % |
80 | 86 | name) | ||
81 | 87 | Gtk.main_quit() | 87 | Gtk.main_quit() |
82 | 88 | if not isinstance(val, attrs[name]): | 88 | if not isinstance(val, attrs[name]): |
84 | 89 | msg = "Attribute %s expects %s, got %s" % (name, attrs[name], type(val)) | 89 | msg = "Attribute %s expects %s, got %s" % (name, attrs[name], |
85 | 90 | type(val)) | ||
86 | 90 | raise TypeError(msg) | 91 | raise TypeError(msg) |
87 | 91 | Gtk.main_quit() | 92 | Gtk.main_quit() |
88 | 92 | return object.__setattr__(self, name, val) | 93 | return object.__setattr__(self, name, val) |
89 | @@ -124,7 +125,7 @@ | |||
90 | 124 | self.limit = 0 | 125 | self.limit = 0 |
91 | 125 | #~ self.filter = None | 126 | #~ self.filter = None |
92 | 126 | self.vadjustment = 0.0 | 127 | self.vadjustment = 0.0 |
94 | 127 | return | 128 | |
95 | 128 | 129 | ||
96 | 129 | class SoftwarePane(Gtk.VBox, BasePane): | 130 | class SoftwarePane(Gtk.VBox, BasePane): |
97 | 130 | """ Common base class for AvailablePane and InstalledPane""" | 131 | """ Common base class for AvailablePane and InstalledPane""" |
98 | @@ -136,10 +137,10 @@ | |||
99 | 136 | SPINNER = 2 | 137 | SPINNER = 2 |
100 | 137 | 138 | ||
101 | 138 | __gsignals__ = { | 139 | __gsignals__ = { |
106 | 139 | "app-list-changed" : (GObject.SignalFlags.RUN_LAST, | 140 | "app-list-changed": (GObject.SignalFlags.RUN_LAST, |
107 | 140 | None, | 141 | None, |
108 | 141 | (int,), | 142 | (int,), |
109 | 142 | ), | 143 | ), |
110 | 143 | } | 144 | } |
111 | 144 | PADDING = 6 | 145 | PADDING = 6 |
112 | 145 | 146 | ||
113 | @@ -148,7 +149,7 @@ | |||
114 | 148 | Gtk.VBox.__init__(self) | 149 | Gtk.VBox.__init__(self) |
115 | 149 | BasePane.__init__(self) | 150 | BasePane.__init__(self) |
116 | 150 | 151 | ||
118 | 151 | # other classes we need | 152 | # other classes we need |
119 | 152 | self.enquirer = AppEnquire(cache, db) | 153 | self.enquirer = AppEnquire(cache, db) |
120 | 153 | self._query_complete_handler = self.enquirer.connect( | 154 | self._query_complete_handler = self.enquirer.connect( |
121 | 154 | "query-complete", self.on_query_complete) | 155 | "query-complete", self.on_query_complete) |
122 | @@ -189,7 +190,7 @@ | |||
123 | 189 | 190 | ||
124 | 190 | # cursor | 191 | # cursor |
125 | 191 | self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH) | 192 | self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH) |
127 | 192 | 193 | ||
128 | 193 | # views to be created in init_view | 194 | # views to be created in init_view |
129 | 194 | self.app_view = None | 195 | self.app_view = None |
130 | 195 | self.app_details_view = None | 196 | self.app_details_view = None |
131 | @@ -200,7 +201,7 @@ | |||
132 | 200 | SoftwarePane. Note that this method is intended to be called by | 201 | SoftwarePane. Note that this method is intended to be called by |
133 | 201 | the subclass itself at the start of its own init_view() implementation. | 202 | the subclass itself at the start of its own init_view() implementation. |
134 | 202 | """ | 203 | """ |
136 | 203 | # common UI elements (applist and appdetails) | 204 | # common UI elements (applist and appdetails) |
137 | 204 | # its the job of the Child class to put it into a good location | 205 | # its the job of the Child class to put it into a good location |
138 | 205 | # list | 206 | # list |
139 | 206 | self.box_app_list = Gtk.VBox() | 207 | self.box_app_list = Gtk.VBox() |
140 | @@ -211,23 +212,24 @@ | |||
141 | 211 | 212 | ||
142 | 212 | self.app_view = AppView(self.db, self.cache, | 213 | self.app_view = AppView(self.db, self.cache, |
143 | 213 | self.icons, self.show_ratings) | 214 | self.icons, self.show_ratings) |
145 | 214 | self.app_view.connect("sort-method-changed", self.on_app_view_sort_method_changed) | 215 | self.app_view.connect("sort-method-changed", |
146 | 216 | self.on_app_view_sort_method_changed) | ||
147 | 215 | 217 | ||
148 | 216 | self.init_atk_name(self.app_view, "app_view") | 218 | self.init_atk_name(self.app_view, "app_view") |
149 | 217 | self.box_app_list.pack_start(self.app_view, True, True, 0) | 219 | self.box_app_list.pack_start(self.app_view, True, True, 0) |
151 | 218 | self.app_view.connect("application-selected", | 220 | self.app_view.connect("application-selected", |
152 | 219 | self.on_application_selected) | 221 | self.on_application_selected) |
154 | 220 | self.app_view.connect("application-activated", | 222 | self.app_view.connect("application-activated", |
155 | 221 | self.on_application_activated) | 223 | self.on_application_activated) |
157 | 222 | 224 | ||
158 | 223 | # details | 225 | # details |
159 | 224 | self.scroll_details = Gtk.ScrolledWindow() | 226 | self.scroll_details = Gtk.ScrolledWindow() |
161 | 225 | self.scroll_details.set_policy(Gtk.PolicyType.AUTOMATIC, | 227 | self.scroll_details.set_policy(Gtk.PolicyType.AUTOMATIC, |
162 | 226 | Gtk.PolicyType.AUTOMATIC) | 228 | Gtk.PolicyType.AUTOMATIC) |
164 | 227 | self.app_details_view = AppDetailsView(self.db, | 229 | self.app_details_view = AppDetailsView(self.db, |
165 | 228 | self.distro, | 230 | self.distro, |
168 | 229 | self.icons, | 231 | self.icons, |
169 | 230 | self.cache, | 232 | self.cache, |
170 | 231 | self.datadir) | 233 | self.datadir) |
171 | 232 | self.app_details_view.connect( | 234 | self.app_details_view.connect( |
172 | 233 | "different-application-selected", self.on_application_activated) | 235 | "different-application-selected", self.on_application_activated) |
173 | @@ -246,7 +248,7 @@ | |||
174 | 246 | """ init the atk name for a given gtk widget based on parent-pane | 248 | """ init the atk name for a given gtk widget based on parent-pane |
175 | 247 | and variable name (used for the mago tests) | 249 | and variable name (used for the mago tests) |
176 | 248 | """ | 250 | """ |
178 | 249 | name = self.__class__.__name__ + "." + name | 251 | name = self.__class__.__name__ + "." + name |
179 | 250 | Atk.Object.set_name(widget.get_accessible(), name) | 252 | Atk.Object.set_name(widget.get_accessible(), name) |
180 | 251 | 253 | ||
181 | 252 | def on_cache_ready(self, cache): | 254 | def on_cache_ready(self, cache): |
182 | @@ -254,7 +256,7 @@ | |||
183 | 254 | LOG.debug("on_cache_ready") | 256 | LOG.debug("on_cache_ready") |
184 | 255 | # it only makes sense to refresh if there is something to | 257 | # it only makes sense to refresh if there is something to |
185 | 256 | # refresh, otherwise we create a bunch of (not yet needed) | 258 | # refresh, otherwise we create a bunch of (not yet needed) |
187 | 257 | # AppStore objects on startup when the cache sends its | 259 | # AppStore objects on startup when the cache sends its |
188 | 258 | # initial "cache-ready" signal | 260 | # initial "cache-ready" signal |
189 | 259 | model = self.app_view.tree_view.get_model() | 261 | model = self.app_view.tree_view.get_model() |
190 | 260 | if model is None: | 262 | if model is None: |
191 | @@ -270,7 +272,8 @@ | |||
192 | 270 | self.state.application = app | 272 | self.state.application = app |
193 | 271 | 273 | ||
194 | 272 | vm = get_viewmanager() | 274 | vm = get_viewmanager() |
196 | 273 | vm.display_page(self, SoftwarePane.Pages.DETAILS, self.state, self.display_details_page) | 275 | vm.display_page(self, SoftwarePane.Pages.DETAILS, self.state, |
197 | 276 | self.display_details_page) | ||
198 | 274 | 277 | ||
199 | 275 | def show_app(self, app): | 278 | def show_app(self, app): |
200 | 276 | self.on_application_activated(None, app) | 279 | self.on_application_activated(None, app) |
201 | @@ -288,7 +291,6 @@ | |||
202 | 288 | self.app_view.display_matches(enquirer.matches, | 291 | self.app_view.display_matches(enquirer.matches, |
203 | 289 | self._is_in_search_mode()) | 292 | self._is_in_search_mode()) |
204 | 290 | self.hide_appview_spinner() | 293 | self.hide_appview_spinner() |
205 | 291 | return | ||
206 | 292 | 294 | ||
207 | 293 | def on_app_view_sort_method_changed(self, app_view, combo): | 295 | def on_app_view_sort_method_changed(self, app_view, combo): |
208 | 294 | if app_view.get_sort_mode() == self.enquirer.sortmode: | 296 | if app_view.get_sort_mode() == self.enquirer.sortmode: |
209 | @@ -298,7 +300,6 @@ | |||
210 | 298 | app_view.clear_model() | 300 | app_view.clear_model() |
211 | 299 | query = self.get_query() | 301 | query = self.get_query() |
212 | 300 | self._refresh_apps_with_apt_cache(query) | 302 | self._refresh_apps_with_apt_cache(query) |
213 | 301 | return | ||
214 | 302 | 303 | ||
215 | 303 | def _is_in_search_mode(self): | 304 | def _is_in_search_mode(self): |
216 | 304 | return (self.state.search_term and | 305 | return (self.state.search_term and |
217 | @@ -311,7 +312,7 @@ | |||
218 | 311 | if not self.state.search_term: | 312 | if not self.state.search_term: |
219 | 312 | self.action_bar.clear() | 313 | self.action_bar.clear() |
220 | 313 | self.spinner_notebook.show_spinner() | 314 | self.spinner_notebook.show_spinner() |
222 | 314 | 315 | ||
223 | 315 | def hide_appview_spinner(self): | 316 | def hide_appview_spinner(self): |
224 | 316 | """ hide the spinner and display the appview in the panel """ | 317 | """ hide the spinner and display the appview in the panel """ |
225 | 317 | LOG.debug("hide_appview_spinner") | 318 | LOG.debug("hide_appview_spinner") |
226 | @@ -320,11 +321,9 @@ | |||
227 | 320 | def set_section(self, section): | 321 | def set_section(self, section): |
228 | 321 | self.section = section | 322 | self.section = section |
229 | 322 | self.app_details_view.set_section(section) | 323 | self.app_details_view.set_section(section) |
230 | 323 | return | ||
231 | 324 | 324 | ||
232 | 325 | def section_sync(self): | 325 | def section_sync(self): |
233 | 326 | self.app_details_view.set_section(self.section) | 326 | self.app_details_view.set_section(self.section) |
234 | 327 | return | ||
235 | 328 | 327 | ||
236 | 329 | def on_app_list_changed(self, pane, length): | 328 | def on_app_list_changed(self, pane, length): |
237 | 330 | """internal helper that keeps the the action bar up-to-date by | 329 | """internal helper that keeps the the action bar up-to-date by |
238 | @@ -333,12 +332,10 @@ | |||
239 | 333 | 332 | ||
240 | 334 | self.show_nonapps_if_required(len(self.enquirer.matches)) | 333 | self.show_nonapps_if_required(len(self.enquirer.matches)) |
241 | 335 | self.search_aid.update_search_help(self.state) | 334 | self.search_aid.update_search_help(self.state) |
242 | 336 | return | ||
243 | 337 | 335 | ||
244 | 338 | def hide_nonapps(self): | 336 | def hide_nonapps(self): |
245 | 339 | """ hide non-applications control in the action bar """ | 337 | """ hide non-applications control in the action bar """ |
246 | 340 | self.action_bar.unset_label() | 338 | self.action_bar.unset_label() |
247 | 341 | return | ||
248 | 342 | 339 | ||
249 | 343 | def show_nonapps_if_required(self, length): | 340 | def show_nonapps_if_required(self, length): |
250 | 344 | """ | 341 | """ |
251 | @@ -360,7 +357,7 @@ | |||
252 | 360 | return | 357 | return |
253 | 361 | 358 | ||
254 | 362 | LOG.debug("nonapps_visible value=%s (always visible: %s)" % ( | 359 | LOG.debug("nonapps_visible value=%s (always visible: %s)" % ( |
256 | 363 | self.nonapps_visible, | 360 | self.nonapps_visible, |
257 | 364 | self.nonapps_visible == NonAppVisibility.ALWAYS_VISIBLE)) | 361 | self.nonapps_visible == NonAppVisibility.ALWAYS_VISIBLE)) |
258 | 365 | 362 | ||
259 | 366 | self.action_bar.unset_label() | 363 | self.action_bar.unset_label() |
260 | @@ -370,13 +367,13 @@ | |||
261 | 370 | # In most/all languages you will want the whole string as a link | 367 | # In most/all languages you will want the whole string as a link |
262 | 371 | label = gettext.ngettext("_Hide %(amount)i technical item_", | 368 | label = gettext.ngettext("_Hide %(amount)i technical item_", |
263 | 372 | "_Hide %(amount)i technical items_", | 369 | "_Hide %(amount)i technical items_", |
265 | 373 | n_pkgs) % { 'amount': n_pkgs, } | 370 | n_pkgs) % {'amount': n_pkgs} |
266 | 374 | self.action_bar.set_label( | 371 | self.action_bar.set_label( |
268 | 375 | label, link_result=self._hide_nonapp_pkgs) | 372 | label, link_result=self._hide_nonapp_pkgs) |
269 | 376 | else: | 373 | else: |
270 | 377 | label = gettext.ngettext("_Show %(amount)i technical item_", | 374 | label = gettext.ngettext("_Show %(amount)i technical item_", |
271 | 378 | "_Show %(amount)i technical items_", | 375 | "_Show %(amount)i technical items_", |
273 | 379 | n_pkgs) % { 'amount': n_pkgs, } | 376 | n_pkgs) % {'amount': n_pkgs} |
274 | 380 | self.action_bar.set_label( | 377 | self.action_bar.set_label( |
275 | 381 | label, link_result=self._show_nonapp_pkgs) | 378 | label, link_result=self._show_nonapp_pkgs) |
276 | 382 | 379 | ||
277 | @@ -388,7 +385,7 @@ | |||
278 | 388 | self.unset_current_category() | 385 | self.unset_current_category() |
279 | 389 | self.refresh_apps() | 386 | self.refresh_apps() |
280 | 390 | elif uri.startswith("search-parent:"): | 387 | elif uri.startswith("search-parent:"): |
282 | 391 | self.apps_subcategory = None; | 388 | self.apps_subcategory = None |
283 | 392 | self.refresh_apps() | 389 | self.refresh_apps() |
284 | 393 | elif uri.startswith("search-unsupported:"): | 390 | elif uri.startswith("search-unsupported:"): |
285 | 394 | self.apps_filter.set_supported_only(False) | 391 | self.apps_filter.set_supported_only(False) |
286 | @@ -424,7 +421,7 @@ | |||
287 | 424 | return channel_query | 421 | return channel_query |
288 | 425 | # ... otherwise show all | 422 | # ... otherwise show all |
289 | 426 | return xapian.Query("") | 423 | return xapian.Query("") |
291 | 427 | 424 | ||
292 | 428 | def refresh_apps(self, query=None): | 425 | def refresh_apps(self, query=None): |
293 | 429 | """refresh the applist and update the navigation bar """ | 426 | """refresh the applist and update the navigation bar """ |
294 | 430 | LOG.debug("refresh_apps") | 427 | LOG.debug("refresh_apps") |
295 | @@ -461,7 +458,6 @@ | |||
296 | 461 | exact=self.is_custom_list(), | 458 | exact=self.is_custom_list(), |
297 | 462 | nonapps_visible=self.nonapps_visible, | 459 | nonapps_visible=self.nonapps_visible, |
298 | 463 | filter=self.state.filter) | 460 | filter=self.state.filter) |
299 | 464 | return | ||
300 | 465 | 461 | ||
301 | 466 | def display_details_page(self, page, view_state): | 462 | def display_details_page(self, page, view_state): |
302 | 467 | self.app_details_view.show_app(view_state.application) | 463 | self.app_details_view.show_app(view_state.application) |
303 | @@ -486,11 +482,11 @@ | |||
304 | 486 | def get_sort_mode(self): | 482 | def get_sort_mode(self): |
305 | 487 | # if the category sets a custom sort order, that wins, this | 483 | # if the category sets a custom sort order, that wins, this |
306 | 488 | # is required for top-rated and whats-new | 484 | # is required for top-rated and whats-new |
308 | 489 | if (self.state.category and | 485 | if (self.state.category and |
309 | 490 | self.state.category.sortmode != SortMethods.BY_ALPHABET): | 486 | self.state.category.sortmode != SortMethods.BY_ALPHABET): |
310 | 491 | return self.state.category.sortmode | 487 | return self.state.category.sortmode |
311 | 492 | # searches are always by ranking unless the user decided differently | 488 | # searches are always by ranking unless the user decided differently |
313 | 493 | if (self._is_in_search_mode() and | 489 | if (self._is_in_search_mode() and |
314 | 494 | not self.app_view.user_defined_sort_method): | 490 | not self.app_view.user_defined_sort_method): |
315 | 495 | return SortMethods.BY_SEARCH_RANKING | 491 | return SortMethods.BY_SEARCH_RANKING |
316 | 496 | # use the appview combo | 492 | # use the appview combo |
317 | @@ -520,15 +516,15 @@ | |||
318 | 520 | def is_category_view_showing(self): | 516 | def is_category_view_showing(self): |
319 | 521 | " stub implementation " | 517 | " stub implementation " |
320 | 522 | pass | 518 | pass |
322 | 523 | 519 | ||
323 | 524 | def is_applist_view_showing(self): | 520 | def is_applist_view_showing(self): |
324 | 525 | " stub implementation " | 521 | " stub implementation " |
325 | 526 | pass | 522 | pass |
327 | 527 | 523 | ||
328 | 528 | def is_app_details_view_showing(self): | 524 | def is_app_details_view_showing(self): |
329 | 529 | " stub implementation " | 525 | " stub implementation " |
330 | 530 | pass | 526 | pass |
332 | 531 | 527 | ||
333 | 532 | def get_current_app(self): | 528 | def get_current_app(self): |
334 | 533 | " stub implementation " | 529 | " stub implementation " |
335 | 534 | pass | 530 | pass |
336 | 535 | 531 | ||
337 | === modified file 'softwarecenter/ui/gtk3/panes/unused__channelpane.py' | |||
338 | --- softwarecenter/ui/gtk3/panes/unused__channelpane.py 2011-08-10 07:35:53 +0000 | |||
339 | +++ softwarecenter/ui/gtk3/panes/unused__channelpane.py 2012-03-15 00:20:29 +0000 | |||
340 | @@ -37,6 +37,7 @@ | |||
341 | 37 | 37 | ||
342 | 38 | LOG = logging.getLogger(__name__) | 38 | LOG = logging.getLogger(__name__) |
343 | 39 | 39 | ||
344 | 40 | |||
345 | 40 | class ChannelPane(SoftwarePane): | 41 | class ChannelPane(SoftwarePane): |
346 | 41 | """Widget that represents the channel pane for display of | 42 | """Widget that represents the channel pane for display of |
347 | 42 | individual channels (PPAs, partner repositories, etc.) | 43 | individual channels (PPAs, partner repositories, etc.) |
348 | @@ -47,10 +48,10 @@ | |||
349 | 47 | (PAGE_APPLIST, | 48 | (PAGE_APPLIST, |
350 | 48 | PAGE_APP_DETAILS, | 49 | PAGE_APP_DETAILS, |
351 | 49 | PAGE_APP_PURCHASE) = range(3) | 50 | PAGE_APP_PURCHASE) = range(3) |
356 | 50 | 51 | ||
357 | 51 | __gsignals__ = {'channel-pane-created':(GObject.SignalFlags.RUN_FIRST, | 52 | __gsignals__ = {'channel-pane-created': (GObject.SignalFlags.RUN_FIRST, |
358 | 52 | None, | 53 | None, |
359 | 53 | ())} | 54 | ())} |
360 | 54 | 55 | ||
361 | 55 | def __init__(self, cache, db, distro, icons, datadir): | 56 | def __init__(self, cache, db, distro, icons, datadir): |
362 | 56 | # parent | 57 | # parent |
363 | @@ -66,11 +67,14 @@ | |||
364 | 66 | def init_view(self): | 67 | def init_view(self): |
365 | 67 | if not self.view_initialized: | 68 | if not self.view_initialized: |
366 | 68 | SoftwarePane.init_view(self) | 69 | SoftwarePane.init_view(self) |
368 | 69 | self.notebook.append_page(self.box_app_list, Gtk.Label(label="channel")) | 70 | self.notebook.append_page(self.box_app_list, |
369 | 71 | Gtk.Label(label="channel")) | ||
370 | 70 | # details | 72 | # details |
372 | 71 | self.notebook.append_page(self.scroll_details, Gtk.Label(label="details")) | 73 | self.notebook.append_page(self.scroll_details, |
373 | 74 | Gtk.Label(label="details")) | ||
374 | 72 | # purchase view | 75 | # purchase view |
376 | 73 | self.notebook.append_page(self.purchase_view, Gtk.Label(label="purchase")) | 76 | self.notebook.append_page(self.purchase_view, |
377 | 77 | Gtk.Label(label="purchase")) | ||
378 | 74 | # now we are initialized | 78 | # now we are initialized |
379 | 75 | self.emit("channel-pane-created") | 79 | self.emit("channel-pane-created") |
380 | 76 | self.show_all() | 80 | self.show_all() |
381 | @@ -82,7 +86,7 @@ | |||
382 | 82 | self.navigation_bar.remove_ids(NavButtons.PURCHASE) | 86 | self.navigation_bar.remove_ids(NavButtons.PURCHASE) |
383 | 83 | self.notebook.set_current_page(self.PAGE_APPLIST) | 87 | self.notebook.set_current_page(self.PAGE_APPLIST) |
384 | 84 | self.searchentry.show() | 88 | self.searchentry.show() |
386 | 85 | 89 | ||
387 | 86 | def _clear_search(self): | 90 | def _clear_search(self): |
388 | 87 | # remove the details and clear the search | 91 | # remove the details and clear the search |
389 | 88 | self.searchentry.clear() | 92 | self.searchentry.clear() |
390 | @@ -109,7 +113,7 @@ | |||
391 | 109 | dialog.set_title("") | 113 | dialog.set_title("") |
392 | 110 | dialog.set_markup("<big><b>%s</b></big>" % _("Add channel")) | 114 | dialog.set_markup("<big><b>%s</b></big>" % _("Add channel")) |
393 | 111 | dialog.format_secondary_text(_("The selected channel is not yet " | 115 | dialog.format_secondary_text(_("The selected channel is not yet " |
395 | 112 | "added. Do you want to add it now?")) | 116 | "added. Do you want to add it now?")) |
396 | 113 | dialog.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, | 117 | dialog.add_buttons(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, |
397 | 114 | Gtk.STOCK_ADD, Gtk.ResponseType.YES) | 118 | Gtk.STOCK_ADD, Gtk.ResponseType.YES) |
398 | 115 | res = dialog.run() | 119 | res = dialog.run() |
399 | @@ -130,7 +134,7 @@ | |||
400 | 130 | self.apps_filter.set_installed_only(True) | 134 | self.apps_filter.set_installed_only(True) |
401 | 131 | # switch to applist, this will clear searches too | 135 | # switch to applist, this will clear searches too |
402 | 132 | self.display_list() | 136 | self.display_list() |
404 | 133 | 137 | ||
405 | 134 | def on_search_terms_changed(self, searchentry, terms): | 138 | def on_search_terms_changed(self, searchentry, terms): |
406 | 135 | """callback when the search entry widget changes""" | 139 | """callback when the search entry widget changes""" |
407 | 136 | LOG.debug("on_search_terms_changed: '%s'" % terms) | 140 | LOG.debug("on_search_terms_changed: '%s'" % terms) |
408 | @@ -139,7 +143,7 @@ | |||
409 | 139 | self._clear_search() | 143 | self._clear_search() |
410 | 140 | self.refresh_apps() | 144 | self.refresh_apps() |
411 | 141 | self.notebook.set_current_page(self.PAGE_APPLIST) | 145 | self.notebook.set_current_page(self.PAGE_APPLIST) |
413 | 142 | 146 | ||
414 | 143 | def on_db_reopen(self, db): | 147 | def on_db_reopen(self, db): |
415 | 144 | LOG.debug("got db-reopen signal") | 148 | LOG.debug("got db-reopen signal") |
416 | 145 | self.refresh_apps() | 149 | self.refresh_apps() |
417 | @@ -154,7 +158,7 @@ | |||
418 | 154 | if not button.get_active(): | 158 | if not button.get_active(): |
419 | 155 | return | 159 | return |
420 | 156 | self.display_list() | 160 | self.display_list() |
422 | 157 | 161 | ||
423 | 158 | def display_list(self): | 162 | def display_list(self): |
424 | 159 | self._clear_search() | 163 | self._clear_search() |
425 | 160 | self._show_channel_overview() | 164 | self._show_channel_overview() |
426 | @@ -168,7 +172,7 @@ | |||
427 | 168 | if not button.get_active(): | 172 | if not button.get_active(): |
428 | 169 | return | 173 | return |
429 | 170 | self.display_details() | 174 | self.display_details() |
431 | 171 | 175 | ||
432 | 172 | def display_details(self): | 176 | def display_details(self): |
433 | 173 | self.navigation_bar.remove_ids(NavButtons.PURCHASE) | 177 | self.navigation_bar.remove_ids(NavButtons.PURCHASE) |
434 | 174 | self.notebook.set_current_page(self.PAGE_APP_DETAILS) | 178 | self.notebook.set_current_page(self.PAGE_APP_DETAILS) |
435 | @@ -176,20 +180,21 @@ | |||
436 | 176 | self.action_bar.clear() | 180 | self.action_bar.clear() |
437 | 177 | # we want to re-enable the buy button if this is an app for purchase | 181 | # we want to re-enable the buy button if this is an app for purchase |
438 | 178 | # FIXME: hacky, find a better approach | 182 | # FIXME: hacky, find a better approach |
442 | 179 | if self.app_details_view.pkg_statusbar.button.get_label() == _(u'Buy\u2026'): | 183 | button = self.app_details_view.pkg_statusbar.button |
443 | 180 | self.app_details_view.pkg_statusbar.button.set_sensitive(True) | 184 | if button.get_label() == _(u'Buy\u2026'): |
444 | 181 | 185 | button.set_sensitive(True) | |
445 | 186 | |||
446 | 182 | def on_navigation_purchase(self, button, part): | 187 | def on_navigation_purchase(self, button, part): |
447 | 183 | """callback when the navigation button with id 'purchase' is clicked""" | 188 | """callback when the navigation button with id 'purchase' is clicked""" |
448 | 184 | if not button.get_active(): | 189 | if not button.get_active(): |
449 | 185 | return | 190 | return |
450 | 186 | self.display_purchase() | 191 | self.display_purchase() |
452 | 187 | 192 | ||
453 | 188 | def display_purchase(self): | 193 | def display_purchase(self): |
454 | 189 | self.notebook.set_current_page(self.PAGE_APP_PURCHASE) | 194 | self.notebook.set_current_page(self.PAGE_APP_PURCHASE) |
455 | 190 | self.searchentry.hide() | 195 | self.searchentry.hide() |
456 | 191 | self.action_bar.clear() | 196 | self.action_bar.clear() |
458 | 192 | 197 | ||
459 | 193 | def on_application_selected(self, appview, app): | 198 | def on_application_selected(self, appview, app): |
460 | 194 | """callback when an app is selected""" | 199 | """callback when an app is selected""" |
461 | 195 | LOG.debug("on_application_selected: '%s'" % app) | 200 | LOG.debug("on_application_selected: '%s'" % app) |
462 | @@ -204,7 +209,7 @@ | |||
463 | 204 | length = len(self.app_view.get_model()) | 209 | length = len(self.app_view.get_model()) |
464 | 205 | self.emit("app-list-changed", length) | 210 | self.emit("app-list-changed", length) |
465 | 206 | self.searchentry.show() | 211 | self.searchentry.show() |
467 | 207 | 212 | ||
468 | 208 | def get_status_text(self): | 213 | def get_status_text(self): |
469 | 209 | """return user readable status text suitable for a status bar""" | 214 | """return user readable status text suitable for a status bar""" |
470 | 210 | # no status text in the details page | 215 | # no status text in the details page |
471 | @@ -219,34 +224,34 @@ | |||
472 | 219 | if len(self.searchentry.get_text()) > 0: | 224 | if len(self.searchentry.get_text()) > 0: |
473 | 220 | return gettext.ngettext("%(amount)s matching item", | 225 | return gettext.ngettext("%(amount)s matching item", |
474 | 221 | "%(amount)s matching items", | 226 | "%(amount)s matching items", |
476 | 222 | length) % { 'amount' : length, } | 227 | length) % {'amount': length} |
477 | 223 | else: | 228 | else: |
478 | 224 | return gettext.ngettext("%(amount)s item installed", | 229 | return gettext.ngettext("%(amount)s item installed", |
479 | 225 | "%(amount)s items installed", | 230 | "%(amount)s items installed", |
481 | 226 | length) % { 'amount' : length, } | 231 | length) % {'amount': length} |
482 | 227 | else: | 232 | else: |
483 | 228 | if len(self.searchentry.get_text()) > 0: | 233 | if len(self.searchentry.get_text()) > 0: |
484 | 229 | return gettext.ngettext("%(amount)s matching item", | 234 | return gettext.ngettext("%(amount)s matching item", |
485 | 230 | "%(amount)s matching items", | 235 | "%(amount)s matching items", |
487 | 231 | length) % { 'amount' : length, } | 236 | length) % {'amount': length} |
488 | 232 | else: | 237 | else: |
489 | 233 | return gettext.ngettext("%(amount)s item available", | 238 | return gettext.ngettext("%(amount)s item available", |
490 | 234 | "%(amount)s items available", | 239 | "%(amount)s items available", |
493 | 235 | length) % { 'amount' : length, } | 240 | length) % {'amount': length} |
494 | 236 | 241 | ||
495 | 237 | def get_current_app(self): | 242 | def get_current_app(self): |
496 | 238 | """return the current active application object applicable | 243 | """return the current active application object applicable |
497 | 239 | to the context""" | 244 | to the context""" |
498 | 240 | return self.current_appview_selection | 245 | return self.current_appview_selection |
500 | 241 | 246 | ||
501 | 242 | def is_category_view_showing(self): | 247 | def is_category_view_showing(self): |
502 | 243 | # there is no category view in the channel pane | 248 | # there is no category view in the channel pane |
503 | 244 | return False | 249 | return False |
505 | 245 | 250 | ||
506 | 246 | def is_applist_view_showing(self): | 251 | def is_applist_view_showing(self): |
507 | 247 | """Return True if we are in the applist view """ | 252 | """Return True if we are in the applist view """ |
508 | 248 | return self.notebook.get_current_page() == self.PAGE_APPLIST | 253 | return self.notebook.get_current_page() == self.PAGE_APPLIST |
510 | 249 | 254 | ||
511 | 250 | def is_app_details_view_showing(self): | 255 | def is_app_details_view_showing(self): |
512 | 251 | """Return True if we are in the app_details view """ | 256 | """Return True if we are in the app_details view """ |
513 | 252 | return self.notebook.get_current_page() == self.PAGE_APP_DETAILS | 257 | return self.notebook.get_current_page() == self.PAGE_APP_DETAILS |
514 | @@ -288,14 +293,13 @@ | |||
515 | 288 | db.open() | 293 | db.open() |
516 | 289 | except xapian.DatabaseCorruptError as e: | 294 | except xapian.DatabaseCorruptError as e: |
517 | 290 | logging.exception("xapian open failed") | 295 | logging.exception("xapian open failed") |
519 | 291 | dialogs.error(None, | 296 | dialogs.error(None, |
520 | 292 | _("Sorry, can not open the software database"), | 297 | _("Sorry, can not open the software database"), |
521 | 293 | _("Please re-install the 'software-center' " | 298 | _("Please re-install the 'software-center' " |
522 | 294 | "package.")) | 299 | "package.")) |
523 | 295 | # FIXME: force rebuild by providing a dbus service for this | 300 | # FIXME: force rebuild by providing a dbus service for this |
524 | 296 | sys.exit(1) | 301 | sys.exit(1) |
525 | 297 | 302 | ||
526 | 298 | |||
527 | 299 | import softwarecenter.distro | 303 | import softwarecenter.distro |
528 | 300 | distro = softwarecenter.distro.get_distro() | 304 | distro = softwarecenter.distro.get_distro() |
529 | 301 | 305 | ||
530 | @@ -310,4 +314,3 @@ | |||
531 | 310 | win.connect("destroy", Gtk.main_quit) | 314 | win.connect("destroy", Gtk.main_quit) |
532 | 311 | 315 | ||
533 | 312 | Gtk.main() | 316 | Gtk.main() |
534 | 313 | |||
535 | 314 | 317 | ||
536 | === modified file 'softwarecenter/ui/gtk3/panes/viewswitcher.py' | |||
537 | --- softwarecenter/ui/gtk3/panes/viewswitcher.py 2012-02-20 15:59:17 +0000 | |||
538 | +++ softwarecenter/ui/gtk3/panes/viewswitcher.py 2012-03-15 00:20:29 +0000 | |||
539 | @@ -38,6 +38,8 @@ | |||
540 | 38 | 38 | ||
541 | 39 | 39 | ||
542 | 40 | _last_button = None | 40 | _last_button = None |
543 | 41 | |||
544 | 42 | |||
545 | 41 | class ViewSwitcher(Gtk.Box): | 43 | class ViewSwitcher(Gtk.Box): |
546 | 42 | 44 | ||
547 | 43 | ICON_SIZE = Gtk.IconSize.LARGE_TOOLBAR | 45 | ICON_SIZE = Gtk.IconSize.LARGE_TOOLBAR |
548 | @@ -45,6 +47,7 @@ | |||
549 | 45 | def __init__(self, view_manager, datadir, db, cache, icons): | 47 | def __init__(self, view_manager, datadir, db, cache, icons): |
550 | 46 | # boring stuff | 48 | # boring stuff |
551 | 47 | self.view_manager = view_manager | 49 | self.view_manager = view_manager |
552 | 50 | |||
553 | 48 | def on_view_changed(widget, view_id): | 51 | def on_view_changed(widget, view_id): |
554 | 49 | self.view_buttons[view_id].set_active(True) | 52 | self.view_buttons[view_id].set_active(True) |
555 | 50 | self.view_manager.connect('view-changed', on_view_changed) | 53 | self.view_manager.connect('view-changed', on_view_changed) |
556 | @@ -70,7 +73,6 @@ | |||
557 | 70 | self._prev_item = None # track the previous active menu-item | 73 | self._prev_item = None # track the previous active menu-item |
558 | 71 | self._handlers = [] | 74 | self._handlers = [] |
559 | 72 | 75 | ||
560 | 73 | |||
561 | 74 | # order is important here! | 76 | # order is important here! |
562 | 75 | # first, the availablepane items | 77 | # first, the availablepane items |
563 | 76 | icon = SymbolicIcon("available") | 78 | icon = SymbolicIcon("available") |
564 | @@ -112,13 +114,14 @@ | |||
565 | 112 | else: | 114 | else: |
566 | 113 | self.stop_icon_animation() | 115 | self.stop_icon_animation() |
567 | 114 | pending_btn = self.view_buttons[ViewPages.PENDING] | 116 | pending_btn = self.view_buttons[ViewPages.PENDING] |
569 | 115 | from softwarecenter.ui.gtk3.session.viewmanager import get_viewmanager | 117 | from softwarecenter.ui.gtk3.session.viewmanager import ( |
570 | 118 | get_viewmanager, | ||
571 | 119 | ) | ||
572 | 116 | vm = get_viewmanager() | 120 | vm = get_viewmanager() |
573 | 117 | if vm.get_active_view() == 'view-page-pending': | 121 | if vm.get_active_view() == 'view-page-pending': |
574 | 118 | vm.nav_back() | 122 | vm.nav_back() |
575 | 119 | vm.clear_forward_history() | 123 | vm.clear_forward_history() |
576 | 120 | pending_btn.set_visible(False) | 124 | pending_btn.set_visible(False) |
577 | 121 | return | ||
578 | 122 | 125 | ||
579 | 123 | def start_icon_animation(self): | 126 | def start_icon_animation(self): |
580 | 124 | # the pending button ProgressImage is special, see: | 127 | # the pending button ProgressImage is special, see: |
581 | @@ -135,9 +138,8 @@ | |||
582 | 135 | image.set_transaction_count(count) | 138 | image.set_transaction_count(count) |
583 | 136 | 139 | ||
584 | 137 | def on_transaction_finished(self, backend, result): | 140 | def on_transaction_finished(self, backend, result): |
586 | 138 | if result.success: | 141 | if result.success: |
587 | 139 | self.on_channels_changed() | 142 | self.on_channels_changed() |
588 | 140 | return | ||
589 | 141 | 143 | ||
590 | 142 | def on_section_sel_clicked(self, button, event, view_id): | 144 | def on_section_sel_clicked(self, button, event, view_id): |
591 | 143 | # mvo: this check causes bug LP: #828675 | 145 | # mvo: this check causes bug LP: #828675 |
592 | @@ -166,7 +168,6 @@ | |||
593 | 166 | 168 | ||
594 | 167 | self._prev_view = view_id | 169 | self._prev_view = view_id |
595 | 168 | GObject.idle_add(config_view) | 170 | GObject.idle_add(config_view) |
596 | 169 | return | ||
597 | 170 | 171 | ||
598 | 171 | def on_get_available_channels(self, popup): | 172 | def on_get_available_channels(self, popup): |
599 | 172 | return self.build_channel_list(popup, ViewPages.AVAILABLE) | 173 | return self.build_channel_list(popup, ViewPages.AVAILABLE) |
600 | @@ -179,7 +180,6 @@ | |||
601 | 179 | # setting popup to None will cause a rebuild of the popup | 180 | # setting popup to None will cause a rebuild of the popup |
602 | 180 | # menu the next time the selector is clicked | 181 | # menu the next time the selector is clicked |
603 | 181 | sel.popup = None | 182 | sel.popup = None |
604 | 182 | return | ||
605 | 183 | 183 | ||
606 | 184 | def append_section(self, view_id, label, icon): | 184 | def append_section(self, view_id, label, icon): |
607 | 185 | btn = SectionSelector(label, icon, self.ICON_SIZE) | 185 | btn = SectionSelector(label, icon, self.ICON_SIZE) |
608 | @@ -196,7 +196,8 @@ | |||
609 | 196 | # to the group, toggled & clicked gets emitted... causing | 196 | # to the group, toggled & clicked gets emitted... causing |
610 | 197 | # all panes to fully initialise on USC startup, which is | 197 | # all panes to fully initialise on USC startup, which is |
611 | 198 | # undesirable! | 198 | # undesirable! |
613 | 199 | btn.connect("button-release-event", self.on_section_sel_clicked, view_id) | 199 | btn.connect("button-release-event", self.on_section_sel_clicked, |
614 | 200 | view_id) | ||
615 | 200 | return btn | 201 | return btn |
616 | 201 | 202 | ||
617 | 202 | def append_channel_selector(self, section_btn, view_id, build_func): | 203 | def append_channel_selector(self, section_btn, view_id, build_func): |
618 | @@ -206,7 +207,8 @@ | |||
619 | 206 | self.pack_start(sel, False, False, 0) | 207 | self.pack_start(sel, False, False, 0) |
620 | 207 | return sel | 208 | return sel |
621 | 208 | 209 | ||
623 | 209 | def append_section_with_channel_sel(self, view_id, label, icon, build_func): | 210 | def append_section_with_channel_sel(self, view_id, label, icon, |
624 | 211 | build_func): | ||
625 | 210 | btn = self.append_section(view_id, label, icon) | 212 | btn = self.append_section(view_id, label, icon) |
626 | 211 | btn.draw_hint_has_channel_selector = True | 213 | btn.draw_hint_has_channel_selector = True |
627 | 212 | sel = self.append_channel_selector(btn, view_id, build_func) | 214 | sel = self.append_channel_selector(btn, view_id, build_func) |
628 | @@ -227,15 +229,16 @@ | |||
629 | 227 | for i, channel in enumerate(channels): | 229 | for i, channel in enumerate(channels): |
630 | 228 | # only calling it with a explicit new() makes it a really | 230 | # only calling it with a explicit new() makes it a really |
631 | 229 | # empty one, otherwise the following error is raised: | 231 | # empty one, otherwise the following error is raised: |
633 | 230 | # """Attempting to add a widget with type GtkBox to a | 232 | # """Attempting to add a widget with type GtkBox to a |
634 | 231 | # GtkCheckMenuItem, but as a GtkBin subclass a | 233 | # GtkCheckMenuItem, but as a GtkBin subclass a |
636 | 232 | # GtkCheckMenuItem can only contain one widget at a time; | 234 | # GtkCheckMenuItem can only contain one widget at a time; |
637 | 233 | # it already contains a widget of type GtkAccelLabel """ | 235 | # it already contains a widget of type GtkAccelLabel """ |
638 | 234 | 236 | ||
639 | 235 | item = Gtk.MenuItem.new() | 237 | item = Gtk.MenuItem.new() |
640 | 236 | 238 | ||
641 | 237 | label = Gtk.Label.new(channel.display_name) | 239 | label = Gtk.Label.new(channel.display_name) |
643 | 238 | image = Gtk.Image.new_from_icon_name(channel.icon, Gtk.IconSize.MENU) | 240 | image = Gtk.Image.new_from_icon_name(channel.icon, |
644 | 241 | Gtk.IconSize.MENU) | ||
645 | 239 | 242 | ||
646 | 240 | box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, StockEms.SMALL) | 243 | box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, StockEms.SMALL) |
647 | 241 | box.pack_start(image, False, False, 0) | 244 | box.pack_start(image, False, False, 0) |
648 | @@ -252,8 +255,7 @@ | |||
649 | 252 | view_id | 255 | view_id |
650 | 253 | ) | 256 | ) |
651 | 254 | ) | 257 | ) |
654 | 255 | popup.attach(item, 0, 1, i, i+1) | 258 | popup.attach(item, 0, 1, i, i + 1) |
653 | 256 | return | ||
655 | 257 | 259 | ||
656 | 258 | def on_channel_selected(self, item, event, channel, view_id): | 260 | def on_channel_selected(self, item, event, channel, view_id): |
657 | 259 | vm = self.view_manager | 261 | vm = self.view_manager |
658 | @@ -279,7 +281,6 @@ | |||
659 | 279 | return False | 281 | return False |
660 | 280 | 282 | ||
661 | 281 | GObject.idle_add(config_view) | 283 | GObject.idle_add(config_view) |
662 | 282 | return | ||
663 | 283 | 284 | ||
664 | 284 | 285 | ||
665 | 285 | def get_test_window_viewswitcher(): | 286 | def get_test_window_viewswitcher(): |
666 | @@ -305,7 +306,7 @@ | |||
667 | 305 | scroll.add_with_viewport(view) | 306 | scroll.add_with_viewport(view) |
668 | 306 | 307 | ||
669 | 307 | win.add(box) | 308 | win.add(box) |
671 | 308 | win.set_size_request(400,200) | 309 | win.set_size_request(400, 200) |
672 | 309 | win.connect("destroy", Gtk.main_quit) | 310 | win.connect("destroy", Gtk.main_quit) |
673 | 310 | win.show_all() | 311 | win.show_all() |
674 | 311 | return win | 312 | return win |
675 | @@ -317,5 +318,4 @@ | |||
676 | 317 | softwarecenter.paths.datadir = "./data" | 318 | softwarecenter.paths.datadir = "./data" |
677 | 318 | win = get_test_window_viewswitcher() | 319 | win = get_test_window_viewswitcher() |
678 | 319 | 320 | ||
679 | 320 | |||
680 | 321 | Gtk.main() | 321 | Gtk.main() |
681 | 322 | 322 | ||
682 | === modified file 'softwarecenter/ui/gtk3/session/appmanager.py' | |||
683 | --- softwarecenter/ui/gtk3/session/appmanager.py 2012-02-07 16:56:40 +0000 | |||
684 | +++ softwarecenter/ui/gtk3/session/appmanager.py 2012-03-15 00:20:29 +0000 | |||
685 | @@ -31,10 +31,14 @@ | |||
686 | 31 | from softwarecenter.distro import get_current_arch, get_distro | 31 | from softwarecenter.distro import get_current_arch, get_distro |
687 | 32 | from softwarecenter.i18n import get_language | 32 | from softwarecenter.i18n import get_language |
688 | 33 | from softwarecenter.ui.gtk3.dialogs import dependency_dialogs | 33 | from softwarecenter.ui.gtk3.dialogs import dependency_dialogs |
690 | 34 | from softwarecenter.backend.transactionswatcher import TransactionFinishedResult | 34 | from softwarecenter.backend.transactionswatcher import ( |
691 | 35 | TransactionFinishedResult, | ||
692 | 36 | ) | ||
693 | 35 | import softwarecenter.paths | 37 | import softwarecenter.paths |
694 | 36 | 38 | ||
695 | 37 | _appmanager = None # the global AppManager instance | 39 | _appmanager = None # the global AppManager instance |
696 | 40 | |||
697 | 41 | |||
698 | 38 | def get_appmanager(): | 42 | def get_appmanager(): |
699 | 39 | """ get a existing appmanager instance (or None if none is created yet) """ | 43 | """ get a existing appmanager instance (or None if none is created yet) """ |
700 | 40 | return _appmanager | 44 | return _appmanager |
701 | @@ -43,10 +47,10 @@ | |||
702 | 43 | class ApplicationManager(GObject.GObject): | 47 | class ApplicationManager(GObject.GObject): |
703 | 44 | 48 | ||
704 | 45 | __gsignals__ = { | 49 | __gsignals__ = { |
709 | 46 | "purchase-requested" : (GObject.SignalFlags.RUN_LAST, | 50 | "purchase-requested": (GObject.SignalFlags.RUN_LAST, |
710 | 47 | None, | 51 | None, |
711 | 48 | (GObject.TYPE_PYOBJECT, str, str,) | 52 | (GObject.TYPE_PYOBJECT, str, str,) |
712 | 49 | ), | 53 | ), |
713 | 50 | } | 54 | } |
714 | 51 | 55 | ||
715 | 52 | def __init__(self, db, backend, icons): | 56 | def __init__(self, db, backend, icons): |
716 | @@ -72,25 +76,26 @@ | |||
717 | 72 | if action is "remove", must check if other dependencies have to be | 76 | if action is "remove", must check if other dependencies have to be |
718 | 73 | removed as well and show a dialog in that case | 77 | removed as well and show a dialog in that case |
719 | 74 | """ | 78 | """ |
721 | 75 | #~ LOG.debug("on_application_action_requested: '%s' %s" % (app, action)) | 79 | #~ LOG.debug("on_application_action_requested: '%s' %s" |
722 | 80 | #~ % (app, action)) | ||
723 | 76 | appdetails = app.get_details(self.db) | 81 | appdetails = app.get_details(self.db) |
724 | 77 | if action == AppActions.REMOVE: | 82 | if action == AppActions.REMOVE: |
725 | 78 | if not dependency_dialogs.confirm_remove( | 83 | if not dependency_dialogs.confirm_remove( |
726 | 79 | None, self.datadir, app, self.db, self.icons): | 84 | None, self.datadir, app, self.db, self.icons): |
729 | 80 | # craft an instance of TransactionFinishedResult to send with the | 85 | # craft an instance of TransactionFinishedResult to send |
730 | 81 | # transaction-stopped signal | 86 | # with the transaction-stopped signal |
731 | 82 | result = TransactionFinishedResult(None, False) | 87 | result = TransactionFinishedResult(None, False) |
732 | 83 | result.pkgname = app.pkgname | 88 | result.pkgname = app.pkgname |
733 | 84 | self.backend.emit("transaction-stopped", result) | 89 | self.backend.emit("transaction-stopped", result) |
734 | 85 | return | 90 | return |
735 | 86 | elif action == AppActions.INSTALL: | 91 | elif action == AppActions.INSTALL: |
737 | 87 | # If we are installing a package, check for dependencies that will | 92 | # If we are installing a package, check for dependencies that will |
738 | 88 | # also be removed and show a dialog for confirmation | 93 | # also be removed and show a dialog for confirmation |
739 | 89 | # generic removal text (fixing LP bug #554319) | 94 | # generic removal text (fixing LP bug #554319) |
740 | 90 | if not dependency_dialogs.confirm_install( | 95 | if not dependency_dialogs.confirm_install( |
741 | 91 | None, self.datadir, app, self.db, self.icons): | 96 | None, self.datadir, app, self.db, self.icons): |
744 | 92 | # craft an instance of TransactionFinishedResult to send with the | 97 | # craft an instance of TransactionFinishedResult to send |
745 | 93 | # transaction-stopped signal | 98 | # with the transaction-stopped signal |
746 | 94 | result = TransactionFinishedResult(None, False) | 99 | result = TransactionFinishedResult(None, False) |
747 | 95 | result.pkgname = app.pkgname | 100 | result.pkgname = app.pkgname |
748 | 96 | self.backend.emit("transaction-stopped", result) | 101 | self.backend.emit("transaction-stopped", result) |
749 | @@ -100,8 +105,9 @@ | |||
750 | 100 | if (action == AppActions.UPGRADE and app.request and | 105 | if (action == AppActions.UPGRADE and app.request and |
751 | 101 | isinstance(app, DebFileApplication)): | 106 | isinstance(app, DebFileApplication)): |
752 | 102 | action = AppActions.INSTALL | 107 | action = AppActions.INSTALL |
755 | 103 | 108 | ||
756 | 104 | # action_func is one of: "install", "remove", "upgrade", "apply_changes" | 109 | # action_func is one of: |
757 | 110 | # "install", "remove", "upgrade", "apply_changes" | ||
758 | 105 | action_func = getattr(self.backend, action) | 111 | action_func = getattr(self.backend, action) |
759 | 106 | if action == AppActions.INSTALL: | 112 | if action == AppActions.INSTALL: |
760 | 107 | # the package.deb path name is in the request | 113 | # the package.deb path name is in the request |
761 | @@ -117,7 +123,8 @@ | |||
762 | 117 | addons_install=addons_install, | 123 | addons_install=addons_install, |
763 | 118 | addons_remove=addons_remove) | 124 | addons_remove=addons_remove) |
764 | 119 | #~ else: | 125 | #~ else: |
766 | 120 | #~ LOG.error("Not a valid action in AptdaemonBackend: '%s'" % action) | 126 | #~ LOG.error("Not a valid action in AptdaemonBackend: '%s'" % |
767 | 127 | #~ action) | ||
768 | 121 | 128 | ||
769 | 122 | # public interface | 129 | # public interface |
770 | 123 | def reload(self): | 130 | def reload(self): |
771 | @@ -149,10 +156,10 @@ | |||
772 | 149 | lang = get_language() | 156 | lang = get_language() |
773 | 150 | appdetails = app.get_details(self.db) | 157 | appdetails = app.get_details(self.db) |
774 | 151 | url = self.distro.PURCHASE_APP_URL % ( | 158 | url = self.distro.PURCHASE_APP_URL % ( |
779 | 152 | lang, self.distro.get_codename(), urlencode( | 159 | lang, self.distro.get_codename(), urlencode({ |
780 | 153 | {'archive_id' : appdetails.ppaname, | 160 | 'archive_id': appdetails.ppaname, |
781 | 154 | 'arch' : get_current_arch(),} | 161 | 'arch': get_current_arch() |
782 | 155 | ) | 162 | }) |
783 | 156 | ) | 163 | ) |
784 | 157 | self.emit("purchase-requested", app, appdetails.icon, url) | 164 | self.emit("purchase-requested", app, appdetails.icon, url) |
785 | 158 | 165 | ||
786 | 159 | 166 | ||
787 | === modified file 'softwarecenter/ui/gtk3/session/navhistory.py' | |||
788 | --- softwarecenter/ui/gtk3/session/navhistory.py 2011-10-22 00:13:32 +0000 | |||
789 | +++ softwarecenter/ui/gtk3/session/navhistory.py 2012-03-15 00:20:29 +0000 | |||
790 | @@ -20,7 +20,8 @@ | |||
791 | 20 | 20 | ||
792 | 21 | import logging | 21 | import logging |
793 | 22 | 22 | ||
795 | 23 | LOG=logging.getLogger(__name__) | 23 | LOG = logging.getLogger(__name__) |
796 | 24 | |||
797 | 24 | 25 | ||
798 | 25 | class NavigationHistory(object): | 26 | class NavigationHistory(object): |
799 | 26 | """ | 27 | """ |
800 | @@ -34,7 +35,6 @@ | |||
801 | 34 | self.in_replay_history_mode = False | 35 | self.in_replay_history_mode = False |
802 | 35 | self._nav_back_set_sensitive(False) | 36 | self._nav_back_set_sensitive(False) |
803 | 36 | self._nav_forward_set_sensitive(False) | 37 | self._nav_forward_set_sensitive(False) |
804 | 37 | return | ||
805 | 38 | 38 | ||
806 | 39 | def append(self, nav_item): | 39 | def append(self, nav_item): |
807 | 40 | """ | 40 | """ |
808 | @@ -81,7 +81,7 @@ | |||
809 | 81 | if self.back_forward.left.has_focus(): | 81 | if self.back_forward.left.has_focus(): |
810 | 82 | self.back_forward.right.grab_focus() | 82 | self.back_forward.right.grab_focus() |
811 | 83 | self._nav_back_set_sensitive(False) | 83 | self._nav_back_set_sensitive(False) |
813 | 84 | 84 | ||
814 | 85 | def clear_forward_history(self): | 85 | def clear_forward_history(self): |
815 | 86 | """ | 86 | """ |
816 | 87 | clear the forward history and set the corresponding forward | 87 | clear the forward history and set the corresponding forward |
817 | @@ -100,7 +100,7 @@ | |||
818 | 100 | self.stack.reset() | 100 | self.stack.reset() |
819 | 101 | self._nav_back_set_sensitive(False) | 101 | self._nav_back_set_sensitive(False) |
820 | 102 | self._nav_forward_set_sensitive(False) | 102 | self._nav_forward_set_sensitive(False) |
822 | 103 | 103 | ||
823 | 104 | def _nav_back_set_sensitive(self, is_sensitive): | 104 | def _nav_back_set_sensitive(self, is_sensitive): |
824 | 105 | self.back_forward.left.set_sensitive(is_sensitive) | 105 | self.back_forward.left.set_sensitive(is_sensitive) |
825 | 106 | #~ self.navhistory_back_action.set_sensitive(is_sensitive) | 106 | #~ self.navhistory_back_action.set_sensitive(is_sensitive) |
826 | @@ -121,7 +121,6 @@ | |||
827 | 121 | self.page = page | 121 | self.page = page |
828 | 122 | self.view_state = view_state | 122 | self.view_state = view_state |
829 | 123 | self.callback = callback | 123 | self.callback = callback |
830 | 124 | return | ||
831 | 125 | 124 | ||
832 | 126 | def __str__(self): | 125 | def __str__(self): |
833 | 127 | facet = self.pane.pane_name.replace(' ', '')[:6] | 126 | facet = self.pane.pane_name.replace(' ', '')[:6] |
834 | @@ -154,7 +153,7 @@ | |||
835 | 154 | self.stack = [] | 153 | self.stack = [] |
836 | 155 | self.cursor = 0 | 154 | self.cursor = 0 |
837 | 156 | 155 | ||
839 | 157 | if not options or not options.display_navlog: | 156 | if not options or not options.display_navlog: |
840 | 158 | return | 157 | return |
841 | 159 | 158 | ||
842 | 160 | import softwarecenter.ui.gtk3.widgets.navlog as navlog | 159 | import softwarecenter.ui.gtk3.widgets.navlog as navlog |
843 | @@ -186,7 +185,8 @@ | |||
844 | 186 | last = self[-1] | 185 | last = self[-1] |
845 | 187 | last_vs = last.view_state | 186 | last_vs = last.view_state |
846 | 188 | item_vs = item.view_state | 187 | item_vs = item.view_state |
848 | 189 | # FIXME: This is getting messy, this stuff should be cleaned up somehow... | 188 | # FIXME: This is getting messy, this stuff should be cleaned up |
849 | 189 | # somehow... | ||
850 | 190 | # hacky: special case, check for subsequent searches | 190 | # hacky: special case, check for subsequent searches |
851 | 191 | # if subsequent search, update previous item_vs.search_term | 191 | # if subsequent search, update previous item_vs.search_term |
852 | 192 | # to current. | 192 | # to current. |
853 | @@ -212,11 +212,12 @@ | |||
854 | 212 | if len(self) == 1: | 212 | if len(self) == 1: |
855 | 213 | self.history._nav_back_set_sensitive(False) | 213 | self.history._nav_back_set_sensitive(False) |
856 | 214 | self.history._nav_forward_set_sensitive(False) | 214 | self.history._nav_forward_set_sensitive(False) |
858 | 215 | LOG.debug("also remove 'spurious' list navigation item (Bug #854047)") | 215 | LOG.debug("also remove 'spurious' list navigation item " |
859 | 216 | "(Bug #854047)") | ||
860 | 216 | return False | 217 | return False |
861 | 217 | 218 | ||
862 | 218 | elif (item.page != AvailablePane.Pages.LIST and | 219 | elif (item.page != AvailablePane.Pages.LIST and |
864 | 219 | last.page == AvailablePane.Pages.LIST and | 220 | last.page == AvailablePane.Pages.LIST and |
865 | 220 | not item_vs.search_term and last_vs.search_term): | 221 | not item_vs.search_term and last_vs.search_term): |
866 | 221 | LOG.debug("search has been cleared. ignoring history item") | 222 | LOG.debug("search has been cleared. ignoring history item") |
867 | 222 | if len(self) > 1: | 223 | if len(self) > 1: |
868 | @@ -224,7 +225,8 @@ | |||
869 | 224 | if len(self) == 1: | 225 | if len(self) == 1: |
870 | 225 | self.history._nav_back_set_sensitive(False) | 226 | self.history._nav_back_set_sensitive(False) |
871 | 226 | self.history._nav_forward_set_sensitive(False) | 227 | self.history._nav_forward_set_sensitive(False) |
873 | 227 | LOG.debug("also remove 'spurious' list navigation item (Bug #854047)") | 228 | LOG.debug("also remove 'spurious' list navigation item " |
874 | 229 | "(Bug #854047)") | ||
875 | 228 | return False | 230 | return False |
876 | 229 | 231 | ||
877 | 230 | if item.__str__() == last.__str__(): | 232 | if item.__str__() == last.__str__(): |
878 | @@ -234,19 +236,18 @@ | |||
879 | 234 | 236 | ||
880 | 235 | def append(self, item): | 237 | def append(self, item): |
881 | 236 | if not self._isok(item): | 238 | if not self._isok(item): |
883 | 237 | self.cursor = len(self.stack)-1 | 239 | self.cursor = len(self.stack) - 1 |
884 | 238 | LOG.debug('A:%s' % repr(self)) | 240 | LOG.debug('A:%s' % repr(self)) |
885 | 239 | #~ print ('A:%s' % repr(self)) | 241 | #~ print ('A:%s' % repr(self)) |
886 | 240 | return | 242 | return |
887 | 241 | if len(self.stack) + 1 > self.max_length: | 243 | if len(self.stack) + 1 > self.max_length: |
888 | 242 | self.stack.pop(1) | 244 | self.stack.pop(1) |
889 | 243 | self.stack.append(item) | 245 | self.stack.append(item) |
891 | 244 | self.cursor = len(self.stack)-1 | 246 | self.cursor = len(self.stack) - 1 |
892 | 245 | LOG.debug('A:%s' % repr(self)) | 247 | LOG.debug('A:%s' % repr(self)) |
893 | 246 | #~ print ('A:%s' % repr(self)) | 248 | #~ print ('A:%s' % repr(self)) |
894 | 247 | if hasattr(self, "navlog"): | 249 | if hasattr(self, "navlog"): |
895 | 248 | self.navlog.log.notify_append(item) | 250 | self.navlog.log.notify_append(item) |
896 | 249 | return | ||
897 | 250 | 251 | ||
898 | 251 | def step_back(self): | 252 | def step_back(self): |
899 | 252 | did_step = False | 253 | did_step = False |
900 | @@ -263,11 +264,11 @@ | |||
901 | 263 | 264 | ||
902 | 264 | def step_forward(self): | 265 | def step_forward(self): |
903 | 265 | did_step = False | 266 | did_step = False |
905 | 266 | if self.cursor < len(self.stack)-1: | 267 | if self.cursor < len(self.stack) - 1: |
906 | 267 | self.cursor += 1 | 268 | self.cursor += 1 |
907 | 268 | did_step = True | 269 | did_step = True |
908 | 269 | else: | 270 | else: |
910 | 270 | self.cursor = len(self.stack)-1 | 271 | self.cursor = len(self.stack) - 1 |
911 | 271 | LOG.debug('B:%s' % repr(self)) | 272 | LOG.debug('B:%s' % repr(self)) |
912 | 272 | #~ print ('B:%s' % repr(self)) | 273 | #~ print ('B:%s' % repr(self)) |
913 | 273 | if hasattr(self, "navlog") and did_step: | 274 | if hasattr(self, "navlog") and did_step: |
914 | @@ -280,7 +281,7 @@ | |||
915 | 280 | self.navlog.log.notify_clear_forward_items() | 281 | self.navlog.log.notify_clear_forward_items() |
916 | 281 | 282 | ||
917 | 282 | def at_end(self): | 283 | def at_end(self): |
919 | 283 | return self.cursor == len(self.stack)-1 | 284 | return self.cursor == len(self.stack) - 1 |
920 | 284 | 285 | ||
921 | 285 | def at_start(self): | 286 | def at_start(self): |
922 | 286 | return self.cursor == 0 | 287 | return self.cursor == 0 |
923 | 287 | 288 | ||
924 | === modified file 'softwarecenter/ui/gtk3/session/viewmanager.py' | |||
925 | --- softwarecenter/ui/gtk3/session/viewmanager.py 2012-02-16 14:14:01 +0000 | |||
926 | +++ softwarecenter/ui/gtk3/session/viewmanager.py 2012-03-15 00:20:29 +0000 | |||
927 | @@ -22,17 +22,21 @@ | |||
928 | 22 | from softwarecenter.ui.gtk3.widgets.backforward import BackForwardButton | 22 | from softwarecenter.ui.gtk3.widgets.backforward import BackForwardButton |
929 | 23 | from softwarecenter.ui.gtk3.widgets.searchentry import SearchEntry | 23 | from softwarecenter.ui.gtk3.widgets.searchentry import SearchEntry |
930 | 24 | 24 | ||
932 | 25 | _viewmanager = None # the global Viewmanager instance | 25 | |
933 | 26 | _viewmanager = None # the global Viewmanager instance | ||
934 | 27 | |||
935 | 28 | |||
936 | 26 | def get_viewmanager(): | 29 | def get_viewmanager(): |
937 | 27 | return _viewmanager | 30 | return _viewmanager |
938 | 28 | 31 | ||
939 | 32 | |||
940 | 29 | class ViewManager(GObject.GObject): | 33 | class ViewManager(GObject.GObject): |
941 | 30 | 34 | ||
942 | 31 | __gsignals__ = { | 35 | __gsignals__ = { |
947 | 32 | "view-changed" : (GObject.SignalFlags.RUN_LAST, | 36 | "view-changed": (GObject.SignalFlags.RUN_LAST, |
948 | 33 | None, | 37 | None, |
949 | 34 | (GObject.TYPE_PYOBJECT, ), | 38 | (GObject.TYPE_PYOBJECT, ), |
950 | 35 | ), | 39 | ), |
951 | 36 | } | 40 | } |
952 | 37 | 41 | ||
953 | 38 | def __init__(self, notebook_view, options=None): | 42 | def __init__(self, notebook_view, options=None): |
954 | @@ -69,30 +73,27 @@ | |||
955 | 69 | pane = self.get_current_view_widget() | 73 | pane = self.get_current_view_widget() |
956 | 70 | if hasattr(pane, "on_search_terms_changed"): | 74 | if hasattr(pane, "on_search_terms_changed"): |
957 | 71 | pane.on_search_terms_changed(widget, new_text) | 75 | pane.on_search_terms_changed(widget, new_text) |
958 | 72 | return | ||
959 | 73 | 76 | ||
960 | 74 | def on_nav_back_clicked(self, widget): | 77 | def on_nav_back_clicked(self, widget): |
961 | 75 | pane = self.get_current_view_widget() | 78 | pane = self.get_current_view_widget() |
962 | 76 | if hasattr(pane, "on_nav_back_clicked"): | 79 | if hasattr(pane, "on_nav_back_clicked"): |
963 | 77 | pane.on_nav_back_clicked(widget) | 80 | pane.on_nav_back_clicked(widget) |
964 | 78 | return | ||
965 | 79 | 81 | ||
966 | 80 | def on_nav_forward_clicked(self, widget): | 82 | def on_nav_forward_clicked(self, widget): |
967 | 81 | pane = self.get_current_view_widget() | 83 | pane = self.get_current_view_widget() |
968 | 82 | if hasattr(pane, "on_nav_forward_clicked"): | 84 | if hasattr(pane, "on_nav_forward_clicked"): |
969 | 83 | pane.on_nav_forward_clicked(widget) | 85 | pane.on_nav_forward_clicked(widget) |
972 | 84 | return | 86 | |
971 | 85 | |||
973 | 86 | def on_search_entry_key_press_event(self, widget, event): | 87 | def on_search_entry_key_press_event(self, widget, event): |
975 | 87 | 88 | ||
976 | 88 | pane = self.get_current_view_widget() | 89 | pane = self.get_current_view_widget() |
977 | 89 | if hasattr(pane, "on_search_entry_key_press_event"): | 90 | if hasattr(pane, "on_search_entry_key_press_event"): |
978 | 90 | pane.on_search_entry_key_press_event(event) | 91 | pane.on_search_entry_key_press_event(event) |
979 | 91 | return | ||
980 | 92 | 92 | ||
981 | 93 | def register(self, pane, view_id): | 93 | def register(self, pane, view_id): |
982 | 94 | page_id = self.notebook_view.append_page( | 94 | page_id = self.notebook_view.append_page( |
984 | 95 | pane, Gtk.Label.new("View %s" % view_id)) # label is for debugging only | 95 | pane, |
985 | 96 | Gtk.Label.new("View %s" % view_id)) # label is for debugging only | ||
986 | 96 | self.all_views[view_id] = page_id | 97 | self.all_views[view_id] = page_id |
987 | 97 | self.view_to_pane[view_id] = pane | 98 | self.view_to_pane[view_id] = pane |
988 | 98 | 99 | ||
989 | @@ -115,7 +116,7 @@ | |||
990 | 115 | 116 | ||
991 | 116 | def set_active_view(self, view_id): | 117 | def set_active_view(self, view_id): |
992 | 117 | # no views yet | 118 | # no views yet |
994 | 118 | if not self.all_views: | 119 | if not self.all_views: |
995 | 119 | return | 120 | return |
996 | 120 | # if the view switches, ensure that the global spinner is hidden | 121 | # if the view switches, ensure that the global spinner is hidden |
997 | 121 | self.spinner.hide() | 122 | self.spinner.hide() |
998 | @@ -135,7 +136,7 @@ | |||
999 | 135 | view_widget.state.search_term): | 136 | view_widget.state.search_term): |
1000 | 136 | self.search_entry.set_text_with_no_signal( | 137 | self.search_entry.set_text_with_no_signal( |
1001 | 137 | view_widget.state.search_term) | 138 | view_widget.state.search_term) |
1003 | 138 | 139 | ||
1004 | 139 | # callback = view_widget.get_callback_for_page(view_page, | 140 | # callback = view_widget.get_callback_for_page(view_page, |
1005 | 140 | # view_state) | 141 | # view_state) |
1006 | 141 | 142 | ||
1007 | @@ -157,7 +158,7 @@ | |||
1008 | 157 | 158 | ||
1009 | 158 | def get_notebook_page_from_view_id(self, view_id): | 159 | def get_notebook_page_from_view_id(self, view_id): |
1010 | 159 | return self.all_views[view_id] | 160 | return self.all_views[view_id] |
1012 | 160 | 161 | ||
1013 | 161 | def get_view_widget(self, view_id): | 162 | def get_view_widget(self, view_id): |
1014 | 162 | return self.view_to_pane.get(view_id, None) | 163 | return self.view_to_pane.get(view_id, None) |
1015 | 163 | 164 | ||
1016 | @@ -194,8 +195,9 @@ | |||
1017 | 194 | if self.get_current_view_widget() != pane: | 195 | if self.get_current_view_widget() != pane: |
1018 | 195 | view_id = None | 196 | view_id = None |
1019 | 196 | for view_id, widget in self.view_to_pane.items(): | 197 | for view_id, widget in self.view_to_pane.items(): |
1022 | 197 | if widget == pane: break | 198 | if widget == pane: |
1023 | 198 | 199 | break | |
1024 | 200 | |||
1025 | 199 | self.set_active_view(view_id) | 201 | self.set_active_view(view_id) |
1026 | 200 | 202 | ||
1027 | 201 | if (not pane.searchentry or | 203 | if (not pane.searchentry or |
1028 | @@ -209,14 +211,13 @@ | |||
1029 | 209 | else: | 211 | else: |
1030 | 210 | self.search_entry.show() | 212 | self.search_entry.show() |
1031 | 211 | self.spinner.hide() | 213 | self.spinner.hide() |
1032 | 212 | return | ||
1033 | 213 | 214 | ||
1034 | 214 | def nav_back(self): | 215 | def nav_back(self): |
1035 | 215 | self.navhistory.nav_back() | 216 | self.navhistory.nav_back() |
1036 | 216 | 217 | ||
1037 | 217 | def nav_forward(self): | 218 | def nav_forward(self): |
1038 | 218 | self.navhistory.nav_forward() | 219 | self.navhistory.nav_forward() |
1040 | 219 | 220 | ||
1041 | 220 | def clear_forward_history(self): | 221 | def clear_forward_history(self): |
1042 | 221 | self.navhistory.clear_forward_history() | 222 | self.navhistory.clear_forward_history() |
1043 | 222 | 223 | ||
1044 | 223 | 224 | ||
1045 | === modified file 'test/test_pep8.py' | |||
1046 | --- test/test_pep8.py 2012-03-15 00:20:29 +0000 | |||
1047 | +++ test/test_pep8.py 2012-03-15 00:20:29 +0000 | |||
1048 | @@ -8,6 +8,8 @@ | |||
1049 | 8 | 8 | ||
1050 | 9 | # Only test these two packages for now: | 9 | # Only test these two packages for now: |
1051 | 10 | import softwarecenter.db.pkginfo_impl | 10 | import softwarecenter.db.pkginfo_impl |
1052 | 11 | import softwarecenter.ui.gtk3.panes | ||
1053 | 12 | import softwarecenter.ui.gtk3.session | ||
1054 | 11 | import softwarecenter.ui.gtk3.views | 13 | import softwarecenter.ui.gtk3.views |
1055 | 12 | import softwarecenter.ui.gtk3.widgets | 14 | import softwarecenter.ui.gtk3.widgets |
1056 | 13 | import softwarecenter.ui.qml | 15 | import softwarecenter.ui.qml |
1057 | @@ -15,10 +17,13 @@ | |||
1058 | 15 | class PackagePep8TestCase(unittest.TestCase): | 17 | class PackagePep8TestCase(unittest.TestCase): |
1059 | 16 | maxDiff = None | 18 | maxDiff = None |
1060 | 17 | packages = [softwarecenter.ui.qml, | 19 | packages = [softwarecenter.ui.qml, |
1061 | 20 | softwarecenter.ui.gtk3.panes, | ||
1062 | 21 | softwarecenter.ui.gtk3.session, | ||
1063 | 18 | softwarecenter.ui.gtk3.views, | 22 | softwarecenter.ui.gtk3.views, |
1064 | 19 | softwarecenter.ui.gtk3.widgets, | 23 | softwarecenter.ui.gtk3.widgets, |
1065 | 20 | softwarecenter.db.pkginfo_impl] | 24 | softwarecenter.db.pkginfo_impl] |
1067 | 21 | exclude = [] | 25 | exclude = ['availablepane.py', 'basepane.py', 'globalpane.py', |
1068 | 26 | 'historypane.py', 'installedpane.py'] | ||
1069 | 22 | 27 | ||
1070 | 23 | def message(self, text): | 28 | def message(self, text): |
1071 | 24 | self.errors.append(text) | 29 | self.errors.append(text) |
Thanks, Anthony!!