Merge lp:~elachuni/software-center/pep8-test-part5 into lp:software-center
- pep8-test-part5
- Merge into trunk
Proposed by
Anthony Lenton
Status: | Merged |
---|---|
Merged at revision: | 2840 |
Proposed branch: | lp:~elachuni/software-center/pep8-test-part5 |
Merge into: | lp:software-center |
Diff against target: |
1056 lines (+210/-190) 7 files modified
softwarecenter/ui/gtk3/widgets/exhibits.py (+82/-87) softwarecenter/ui/gtk3/widgets/imagedialog.py (+7/-2) softwarecenter/ui/gtk3/widgets/labels.py (+19/-13) softwarecenter/ui/gtk3/widgets/menubutton.py (+30/-20) softwarecenter/ui/gtk3/widgets/oneconfviews.py (+33/-27) softwarecenter/ui/gtk3/widgets/recommendations.py (+38/-39) test/test_pep8.py (+1/-2) |
To merge this branch: | bzr merge lp:~elachuni/software-center/pep8-test-part5 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary Lasker (community) | Approve | ||
Review via email: mp+96758@code.launchpad.net |
Commit message
Description of the change
Made 6 more files in 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/widgets/exhibits.py' | |||
2 | --- softwarecenter/ui/gtk3/widgets/exhibits.py 2012-02-27 16:56:32 +0000 | |||
3 | +++ softwarecenter/ui/gtk3/widgets/exhibits.py 2012-03-09 13:04:23 +0000 | |||
4 | @@ -37,7 +37,7 @@ | |||
5 | 37 | from softwarecenter.ui.gtk3.utils import point_in | 37 | from softwarecenter.ui.gtk3.utils import point_in |
6 | 38 | import softwarecenter.paths | 38 | import softwarecenter.paths |
7 | 39 | 39 | ||
9 | 40 | LOG=logging.getLogger(__name__) | 40 | LOG = logging.getLogger(__name__) |
10 | 41 | 41 | ||
11 | 42 | _asset_cache = {} | 42 | _asset_cache = {} |
12 | 43 | _HAND = Gdk.Cursor.new(Gdk.CursorType.HAND2) | 43 | _HAND = Gdk.Cursor.new(Gdk.CursorType.HAND2) |
13 | @@ -75,34 +75,40 @@ | |||
14 | 75 | </body></html> | 75 | </body></html> |
15 | 76 | """ | 76 | """ |
16 | 77 | 77 | ||
17 | 78 | |||
18 | 78 | class FeaturedExhibit(object): | 79 | class FeaturedExhibit(object): |
19 | 79 | 80 | ||
20 | 80 | def __init__(self): | 81 | def __init__(self): |
21 | 81 | self.id = 0 | 82 | self.id = 0 |
23 | 82 | self.package_names = "armagetronad,calibre,cheese,homebank,stellarium,gimp,inkscape,blender,audacity,gufw,frozen-bubble,fretsonfire,moovida,liferea,arista,gtg,freeciv-client-gtk,openshot,supertuxkart,tumiki-fighters,tuxpaint,webservice-office-zoho" | 83 | self.package_names = ("armagetronad,calibre,cheese,homebank," |
24 | 84 | "stellarium,gimp,inkscape,blender,audacity,gufw,frozen-bubble," | ||
25 | 85 | "fretsonfire,moovida,liferea,arista,gtg,freeciv-client-gtk," | ||
26 | 86 | "openshot,supertuxkart,tumiki-fighters,tuxpaint," | ||
27 | 87 | "webservice-office-zoho") | ||
28 | 83 | self.title_translated = _("Our star apps") | 88 | self.title_translated = _("Our star apps") |
29 | 84 | self.published = True | 89 | self.published = True |
36 | 85 | self.banner_url = "file:%s" % (os.path.abspath(os.path.join(softwarecenter.paths.datadir, "default_banner/fallback.png"))) | 90 | self.banner_url = "file:%s" % (os.path.abspath(os.path.join( |
37 | 86 | self.html = EXHIBIT_HTML % { | 91 | softwarecenter.paths.datadir, "default_banner/fallback.png"))) |
38 | 87 | 'banner_url' : self.banner_url, | 92 | self.html = EXHIBIT_HTML % { |
39 | 88 | 'title' : _("Our star apps"), | 93 | 'banner_url': self.banner_url, |
40 | 89 | 'subtitle' : _("Come and explore our favourites"), | 94 | 'title': _("Our star apps"), |
41 | 90 | } | 95 | 'subtitle': _("Come and explore our favourites"), |
42 | 96 | } | ||
43 | 91 | # we should extract this automatically from the html | 97 | # we should extract this automatically from the html |
44 | 92 | #self.atk_name = _("Default Banner") | 98 | #self.atk_name = _("Default Banner") |
46 | 93 | #self.atk_description = _("You see this banner because you have no cached banners") | 99 | #self.atk_description = _("You see this banner because you have no " |
47 | 100 | # "cached banners") | ||
48 | 94 | 101 | ||
49 | 95 | 102 | ||
50 | 96 | class _HtmlRenderer(Gtk.OffscreenWindow): | 103 | class _HtmlRenderer(Gtk.OffscreenWindow): |
51 | 97 | 104 | ||
52 | 98 | __gsignals__ = { | 105 | __gsignals__ = { |
55 | 99 | "render-finished" : (GObject.SignalFlags.RUN_LAST, | 106 | "render-finished": (GObject.SignalFlags.RUN_LAST, |
56 | 100 | None, | 107 | None, |
57 | 101 | (), | 108 | (), |
58 | 102 | ) | 109 | ) |
59 | 103 | } | 110 | } |
60 | 104 | 111 | ||
61 | 105 | |||
62 | 106 | def __init__(self): | 112 | def __init__(self): |
63 | 107 | Gtk.OffscreenWindow.__init__(self) | 113 | Gtk.OffscreenWindow.__init__(self) |
64 | 108 | self.view = WebKit.WebView() | 114 | self.view = WebKit.WebView() |
65 | @@ -120,11 +126,10 @@ | |||
66 | 120 | self.on_download_error) | 126 | self.on_download_error) |
67 | 121 | self.exhibit = None | 127 | self.exhibit = None |
68 | 122 | self.view.connect("notify::load-status", self._on_load_status) | 128 | self.view.connect("notify::load-status", self._on_load_status) |
69 | 123 | return | ||
70 | 124 | 129 | ||
71 | 125 | def _on_load_status(self, view, prop): | 130 | def _on_load_status(self, view, prop): |
74 | 126 | if view.get_property("load-status") == WebKit.LoadStatus.FINISHED: | 131 | if view.get_property("load-status") == WebKit.LoadStatus.FINISHED: |
75 | 127 | # this needs to run with a timeout because otherwise the | 132 | # this needs to run with a timeout because otherwise the |
76 | 128 | # status is emited before the offscreen image is finihsed | 133 | # status is emited before the offscreen image is finihsed |
77 | 129 | GObject.timeout_add(100, lambda: self.emit("render-finished")) | 134 | GObject.timeout_add(100, lambda: self.emit("render-finished")) |
78 | 130 | 135 | ||
79 | @@ -137,26 +142,25 @@ | |||
80 | 137 | if hasattr(self.exhibit, "html") and self.exhibit.html: | 142 | if hasattr(self.exhibit, "html") and self.exhibit.html: |
81 | 138 | html = self.exhibit.html | 143 | html = self.exhibit.html |
82 | 139 | else: | 144 | else: |
88 | 140 | html = EXHIBIT_HTML % { 'banner_url' : self.exhibit.banner_url, | 145 | html = EXHIBIT_HTML % { |
89 | 141 | 'title' : self.exhibit.title_translated, | 146 | 'banner_url': self.exhibit.banner_url, |
90 | 142 | 'subtitle' : "", | 147 | 'title': self.exhibit.title_translated, |
91 | 143 | } | 148 | 'subtitle': "", |
92 | 144 | # replace the server side path with the local image name, this | 149 | } |
93 | 150 | # replace the server side path with the local image name, this | ||
94 | 145 | # assumes that the image always comes from the same server as | 151 | # assumes that the image always comes from the same server as |
95 | 146 | # the html | 152 | # the html |
96 | 147 | scheme, netloc, server_path, para, query, frag = urlparse( | 153 | scheme, netloc, server_path, para, query, frag = urlparse( |
97 | 148 | self.exhibit.banner_url) | 154 | self.exhibit.banner_url) |
98 | 149 | html = html.replace(server_path, image_name) | 155 | html = html.replace(server_path, image_name) |
100 | 150 | self.view.load_string(html, "text/html", "UTF-8", | 156 | self.view.load_string(html, "text/html", "UTF-8", |
101 | 151 | "file:%s/" % cache_dir) | 157 | "file:%s/" % cache_dir) |
102 | 152 | return | ||
103 | 153 | 158 | ||
104 | 154 | def set_exhibit(self, exhibit): | 159 | def set_exhibit(self, exhibit): |
105 | 155 | self.exhibit = exhibit | 160 | self.exhibit = exhibit |
107 | 156 | self.loader.download_file(exhibit.banner_url, | 161 | self.loader.download_file(exhibit.banner_url, |
108 | 157 | use_cache=True, | 162 | use_cache=True, |
109 | 158 | simple_quoting_for_webkit=True) | 163 | simple_quoting_for_webkit=True) |
110 | 159 | return | ||
111 | 160 | 164 | ||
112 | 161 | 165 | ||
113 | 162 | class ExhibitButton(Gtk.Button): | 166 | class ExhibitButton(Gtk.Button): |
114 | @@ -183,7 +187,6 @@ | |||
115 | 183 | self._dropshadow = self.DROPSHADOW.scale_simple( | 187 | self._dropshadow = self.DROPSHADOW.scale_simple( |
116 | 184 | a.width, a.width, GdkPixbuf.InterpType.BILINEAR) | 188 | a.width, a.width, GdkPixbuf.InterpType.BILINEAR) |
117 | 185 | self._margin = int(float(a.width) / self.DROPSHADOW.get_width() * 15) | 189 | self._margin = int(float(a.width) / self.DROPSHADOW.get_width() * 15) |
118 | 186 | return | ||
119 | 187 | 190 | ||
120 | 188 | def do_draw(self, cr): | 191 | def do_draw(self, cr): |
121 | 189 | a = self.get_allocation() | 192 | a = self.get_allocation() |
122 | @@ -194,9 +197,9 @@ | |||
123 | 194 | y = (a.height - ds_h) / 2 | 197 | y = (a.height - ds_h) / 2 |
124 | 195 | Gdk.cairo_set_source_pixbuf(cr, self._dropshadow, 0, y) | 198 | Gdk.cairo_set_source_pixbuf(cr, self._dropshadow, 0, y) |
125 | 196 | cr.paint() | 199 | cr.paint() |
129 | 197 | Circle.layout(cr, self._margin, (a.height-ds_h)/2 + self._margin, | 200 | Circle.layout(cr, self._margin, (a.height - ds_h) / 2 + self._margin, |
130 | 198 | a.width-2*self._margin, | 201 | a.width - 2 * self._margin, |
131 | 199 | a.width-2*self._margin) | 202 | a.width - 2 * self._margin) |
132 | 200 | if self.is_active: | 203 | if self.is_active: |
133 | 201 | color = context.get_background_color(Gtk.StateFlags.SELECTED) | 204 | color = context.get_background_color(Gtk.StateFlags.SELECTED) |
134 | 202 | else: | 205 | else: |
135 | @@ -205,9 +208,8 @@ | |||
136 | 205 | Gdk.cairo_set_source_rgba(cr, color) | 208 | Gdk.cairo_set_source_rgba(cr, color) |
137 | 206 | cr.fill() | 209 | cr.fill() |
138 | 207 | 210 | ||
140 | 208 | for child in self: | 211 | for child in self: |
141 | 209 | self.propagate_draw(child, cr) | 212 | self.propagate_draw(child, cr) |
142 | 210 | return | ||
143 | 211 | 213 | ||
144 | 212 | 214 | ||
145 | 213 | class ExhibitArrowButton(ExhibitButton): | 215 | class ExhibitArrowButton(ExhibitButton): |
146 | @@ -215,24 +217,24 @@ | |||
147 | 215 | def __init__(self, arrow_type, shadow_type=Gtk.ShadowType.IN): | 217 | def __init__(self, arrow_type, shadow_type=Gtk.ShadowType.IN): |
148 | 216 | ExhibitButton.__init__(self) | 218 | ExhibitButton.__init__(self) |
149 | 217 | a = Gtk.Alignment() | 219 | a = Gtk.Alignment() |
152 | 218 | a.set_padding(1,1,1,1) | 220 | a.set_padding(1, 1, 1, 1) |
153 | 219 | a.add(Gtk.Arrow.new(arrow_type, shadow_type)) | 221 | a.add(Gtk.Arrow.new(arrow_type, shadow_type)) |
154 | 220 | self.add(a) | 222 | self.add(a) |
155 | 221 | return | ||
156 | 222 | 223 | ||
157 | 223 | 224 | ||
158 | 224 | class ExhibitBanner(Gtk.EventBox): | 225 | class ExhibitBanner(Gtk.EventBox): |
160 | 225 | # FIXME: sometimes despite set_exhibit being called the new exhibit isn't actually displayed | 226 | # FIXME: sometimes despite set_exhibit being called the new exhibit isn't |
161 | 227 | # actually displayed | ||
162 | 226 | 228 | ||
163 | 227 | __gsignals__ = { | 229 | __gsignals__ = { |
168 | 228 | "show-exhibits-clicked" : (GObject.SignalFlags.RUN_LAST, | 230 | "show-exhibits-clicked": (GObject.SignalFlags.RUN_LAST, |
169 | 229 | None, | 231 | None, |
170 | 230 | (GObject.TYPE_PYOBJECT,), | 232 | (GObject.TYPE_PYOBJECT,), |
171 | 231 | ) | 233 | ) |
172 | 232 | } | 234 | } |
173 | 233 | 235 | ||
174 | 234 | DROPSHADOW_HEIGHT = 11 | 236 | DROPSHADOW_HEIGHT = 11 |
176 | 235 | MAX_HEIGHT = 200 # pixels | 237 | MAX_HEIGHT = 200 # pixels |
177 | 236 | TIMEOUT_SECONDS = 10 | 238 | TIMEOUT_SECONDS = 10 |
178 | 237 | 239 | ||
179 | 238 | def __init__(self): | 240 | def __init__(self): |
180 | @@ -274,8 +276,8 @@ | |||
181 | 274 | self.pressed = False | 276 | self.pressed = False |
182 | 275 | 277 | ||
183 | 276 | self.alpha = 1.0 | 278 | self.alpha = 1.0 |
186 | 277 | self.image = None | 279 | self.image = None |
187 | 278 | self.old_image = None | 280 | self.old_image = None |
188 | 279 | self.renderer = _HtmlRenderer() | 281 | self.renderer = _HtmlRenderer() |
189 | 280 | self.renderer.connect("render-finished", self.on_banner_rendered) | 282 | self.renderer.connect("render-finished", self.on_banner_rendered) |
190 | 281 | 283 | ||
191 | @@ -295,9 +297,9 @@ | |||
192 | 295 | 297 | ||
193 | 296 | def _init_event_handling(self): | 298 | def _init_event_handling(self): |
194 | 297 | self.set_can_focus(True) | 299 | self.set_can_focus(True) |
198 | 298 | self.set_events(Gdk.EventMask.BUTTON_RELEASE_MASK| | 300 | self.set_events(Gdk.EventMask.BUTTON_RELEASE_MASK | |
199 | 299 | Gdk.EventMask.BUTTON_PRESS_MASK| | 301 | Gdk.EventMask.BUTTON_PRESS_MASK | |
200 | 300 | Gdk.EventMask.ENTER_NOTIFY_MASK| | 302 | Gdk.EventMask.ENTER_NOTIFY_MASK | |
201 | 301 | Gdk.EventMask.LEAVE_NOTIFY_MASK) | 303 | Gdk.EventMask.LEAVE_NOTIFY_MASK) |
202 | 302 | self.connect("enter-notify-event", self.on_enter_notify) | 304 | self.connect("enter-notify-event", self.on_enter_notify) |
203 | 303 | self.connect("leave-notify-event", self.on_leave_notify) | 305 | self.connect("leave-notify-event", self.on_leave_notify) |
204 | @@ -316,12 +318,10 @@ | |||
205 | 316 | 318 | ||
206 | 317 | def on_enter_notify(self, *args): | 319 | def on_enter_notify(self, *args): |
207 | 318 | self._init_mouse_pointer() | 320 | self._init_mouse_pointer() |
208 | 319 | return | ||
209 | 320 | 321 | ||
210 | 321 | def on_leave_notify(self, *args): | 322 | def on_leave_notify(self, *args): |
211 | 322 | window = self.get_window() | 323 | window = self.get_window() |
212 | 323 | window.set_cursor(None) | 324 | window.set_cursor(None) |
213 | 324 | return | ||
214 | 325 | 325 | ||
215 | 326 | def on_button_release(self, widget, event): | 326 | def on_button_release(self, widget, event): |
216 | 327 | if not point_in(self.get_allocation(), | 327 | if not point_in(self.get_allocation(), |
217 | @@ -333,14 +333,11 @@ | |||
218 | 333 | if exhibit.package_names and self.pressed: | 333 | if exhibit.package_names and self.pressed: |
219 | 334 | self.emit("show-exhibits-clicked", exhibit) | 334 | self.emit("show-exhibits-clicked", exhibit) |
220 | 335 | self.pressed = False | 335 | self.pressed = False |
221 | 336 | return | ||
222 | 337 | 336 | ||
223 | 338 | def on_button_press(self, widget, event): | 337 | def on_button_press(self, widget, event): |
229 | 339 | if not point_in(self.get_allocation(), | 338 | if point_in(self.get_allocation(), |
230 | 340 | int(event.x), int(event.y)): | 339 | int(event.x), int(event.y)): |
231 | 341 | return | 340 | self.pressed = True |
227 | 342 | self.pressed = True | ||
228 | 343 | return | ||
232 | 344 | 341 | ||
233 | 345 | def on_key_press(self, widget, event): | 342 | def on_key_press(self, widget, event): |
234 | 346 | # activate | 343 | # activate |
235 | @@ -366,18 +363,15 @@ | |||
236 | 366 | def on_next_clicked(self, *args): | 363 | def on_next_clicked(self, *args): |
237 | 367 | self.next_exhibit() | 364 | self.next_exhibit() |
238 | 368 | self.queue_next() | 365 | self.queue_next() |
239 | 369 | return | ||
240 | 370 | 366 | ||
241 | 371 | def on_previous_clicked(self, *args): | 367 | def on_previous_clicked(self, *args): |
242 | 372 | self.previous() | 368 | self.previous() |
243 | 373 | self.queue_next() | 369 | self.queue_next() |
244 | 374 | return | ||
245 | 375 | 370 | ||
246 | 376 | def cleanup_timeout(self): | 371 | def cleanup_timeout(self): |
247 | 377 | if self._timeout > 0: | 372 | if self._timeout > 0: |
248 | 378 | GObject.source_remove(self._timeout) | 373 | GObject.source_remove(self._timeout) |
249 | 379 | self._timeout = 0 | 374 | self._timeout = 0 |
250 | 380 | return | ||
251 | 381 | 375 | ||
252 | 382 | def _render_exhibit_at_cursor(self): | 376 | def _render_exhibit_at_cursor(self): |
253 | 383 | # init the mouse pointer | 377 | # init the mouse pointer |
254 | @@ -402,7 +396,7 @@ | |||
255 | 402 | 396 | ||
256 | 403 | # next() is a special function in py3 so we call this next_exhibit | 397 | # next() is a special function in py3 so we call this next_exhibit |
257 | 404 | def next_exhibit(self): | 398 | def next_exhibit(self): |
259 | 405 | if len(self.exhibits)-1 == self.cursor: | 399 | if len(self.exhibits) - 1 == self.cursor: |
260 | 406 | self.cursor = 0 | 400 | self.cursor = 0 |
261 | 407 | else: | 401 | else: |
262 | 408 | self.cursor += 1 | 402 | self.cursor += 1 |
263 | @@ -411,7 +405,7 @@ | |||
264 | 411 | 405 | ||
265 | 412 | def previous(self): | 406 | def previous(self): |
266 | 413 | if self.cursor == 0: | 407 | if self.cursor == 0: |
268 | 414 | self.cursor = len(self.exhibits)-1 | 408 | self.cursor = len(self.exhibits) - 1 |
269 | 415 | else: | 409 | else: |
270 | 416 | self.cursor -= 1 | 410 | self.cursor -= 1 |
271 | 417 | self._render_exhibit_at_cursor() | 411 | self._render_exhibit_at_cursor() |
272 | @@ -433,7 +427,8 @@ | |||
273 | 433 | return | 427 | return |
274 | 434 | 428 | ||
275 | 435 | from gi.repository import Atk | 429 | from gi.repository import Atk |
277 | 436 | self.get_accessible().set_name(self.exhibits[self.cursor].title_translated) | 430 | self.get_accessible().set_name( |
278 | 431 | self.exhibits[self.cursor].title_translated) | ||
279 | 437 | self.get_accessible().set_role(Atk.Role.PUSH_BUTTON) | 432 | self.get_accessible().set_role(Atk.Role.PUSH_BUTTON) |
280 | 438 | self._fade_in() | 433 | self._fade_in() |
281 | 439 | self.queue_next() | 434 | self.queue_next() |
282 | @@ -455,12 +450,11 @@ | |||
283 | 455 | return retval | 450 | return retval |
284 | 456 | 451 | ||
285 | 457 | GObject.timeout_add(50, fade_step) | 452 | GObject.timeout_add(50, fade_step) |
286 | 458 | return | ||
287 | 459 | 453 | ||
288 | 460 | def _cache_art_assets(self): | 454 | def _cache_art_assets(self): |
289 | 461 | global _asset_cache | 455 | global _asset_cache |
290 | 462 | assets = _asset_cache | 456 | assets = _asset_cache |
292 | 463 | if assets: | 457 | if assets: |
293 | 464 | return assets | 458 | return assets |
294 | 465 | 459 | ||
295 | 466 | #~ surf = cairo.ImageSurface.create_from_png(self.NORTHERN_DROPSHADOW) | 460 | #~ surf = cairo.ImageSurface.create_from_png(self.NORTHERN_DROPSHADOW) |
296 | @@ -490,7 +484,7 @@ | |||
297 | 490 | 484 | ||
298 | 491 | a = self.get_allocation() | 485 | a = self.get_allocation() |
299 | 492 | 486 | ||
301 | 493 | cr.set_source_rgb(1,1,1) | 487 | cr.set_source_rgb(1, 1, 1) |
302 | 494 | cr.paint() | 488 | cr.paint() |
303 | 495 | 489 | ||
304 | 496 | # workaround a really odd bug in the offscreen window of the | 490 | # workaround a really odd bug in the offscreen window of the |
305 | @@ -519,7 +513,7 @@ | |||
306 | 519 | highlight = context.get_background_color(self.get_state_flags()) | 513 | highlight = context.get_background_color(self.get_state_flags()) |
307 | 520 | context.restore() | 514 | context.restore() |
308 | 521 | 515 | ||
310 | 522 | rounded_rect(cr, 1, 1, a.width-2, a.height-3, 5) | 516 | rounded_rect(cr, 1, 1, a.width - 2, a.height - 3, 5) |
311 | 523 | Gdk.cairo_set_source_rgba(cr, highlight) | 517 | Gdk.cairo_set_source_rgba(cr, highlight) |
312 | 524 | cr.set_line_width(6) | 518 | cr.set_line_width(6) |
313 | 525 | cr.stroke() | 519 | cr.stroke() |
314 | @@ -531,26 +525,25 @@ | |||
315 | 531 | #~ cr.paint() | 525 | #~ cr.paint() |
316 | 532 | #~ cr.reset_clip() | 526 | #~ cr.reset_clip() |
317 | 533 | 527 | ||
319 | 534 | cr.rectangle(0, a.height-self.DROPSHADOW_HEIGHT, | 528 | cr.rectangle(0, a.height - self.DROPSHADOW_HEIGHT, |
320 | 535 | a.width, self.DROPSHADOW_HEIGHT) | 529 | a.width, self.DROPSHADOW_HEIGHT) |
321 | 536 | cr.clip() | 530 | cr.clip() |
322 | 537 | cr.save() | 531 | cr.save() |
324 | 538 | cr.translate(0, a.height-self.DROPSHADOW_HEIGHT) | 532 | cr.translate(0, a.height - self.DROPSHADOW_HEIGHT) |
325 | 539 | cr.set_source(_asset_cache["s"]) | 533 | cr.set_source(_asset_cache["s"]) |
326 | 540 | cr.paint() | 534 | cr.paint() |
327 | 541 | cr.restore() | 535 | cr.restore() |
328 | 542 | 536 | ||
329 | 543 | cr.set_line_width(1) | 537 | cr.set_line_width(1) |
333 | 544 | cr.move_to(-0.5, a.height-0.5) | 538 | cr.move_to(-0.5, a.height - 0.5) |
334 | 545 | cr.rel_line_to(a.width+1, 0) | 539 | cr.rel_line_to(a.width + 1, 0) |
335 | 546 | cr.set_source_rgba(1,1,1,0.75) | 540 | cr.set_source_rgba(1, 1, 1, 0.75) |
336 | 547 | cr.stroke() | 541 | cr.stroke() |
337 | 548 | 542 | ||
338 | 549 | cr.restore() | 543 | cr.restore() |
339 | 550 | 544 | ||
341 | 551 | for child in self: | 545 | for child in self: |
342 | 552 | self.propagate_draw(child, cr) | 546 | self.propagate_draw(child, cr) |
343 | 553 | return | ||
344 | 554 | 547 | ||
345 | 555 | def _init_pause_handling_if_needed(self): | 548 | def _init_pause_handling_if_needed(self): |
346 | 556 | # nothing todo if we have the toplevel already | 549 | # nothing todo if we have the toplevel already |
347 | @@ -564,7 +557,7 @@ | |||
348 | 564 | if not isinstance(w, Gtk.Window): | 557 | if not isinstance(w, Gtk.Window): |
349 | 565 | return | 558 | return |
350 | 566 | # connect to property changes for the toplevel focus | 559 | # connect to property changes for the toplevel focus |
352 | 567 | w.connect("notify::has-toplevel-focus", | 560 | w.connect("notify::has-toplevel-focus", |
353 | 568 | self._on_main_window_is_active_changed) | 561 | self._on_main_window_is_active_changed) |
354 | 569 | self._toplevel_window = w | 562 | self._toplevel_window = w |
355 | 570 | 563 | ||
356 | @@ -579,8 +572,7 @@ | |||
357 | 579 | self.cleanup_timeout() | 572 | self.cleanup_timeout() |
358 | 580 | 573 | ||
359 | 581 | def set_exhibits(self, exhibits_list): | 574 | def set_exhibits(self, exhibits_list): |
362 | 582 | 575 | if not exhibits_list: | |
361 | 583 | if not exhibits_list: | ||
363 | 584 | return | 576 | return |
364 | 585 | 577 | ||
365 | 586 | self.exhibits = exhibits_list | 578 | self.exhibits = exhibits_list |
366 | @@ -600,13 +592,13 @@ | |||
367 | 600 | self._dotsigs.append( | 592 | self._dotsigs.append( |
368 | 601 | dot.connect("clicked", | 593 | dot.connect("clicked", |
369 | 602 | self.on_paging_dot_clicked, | 594 | self.on_paging_dot_clicked, |
371 | 603 | len(self.exhibits) - 1 - i) # index | 595 | len(self.exhibits) - 1 - i) # index |
372 | 604 | ) | 596 | ) |
373 | 605 | self.index_hbox.pack_end(dot, False, False, 0) | 597 | self.index_hbox.pack_end(dot, False, False, 0) |
374 | 606 | self.index_hbox.show_all() | 598 | self.index_hbox.show_all() |
375 | 607 | 599 | ||
376 | 608 | self._render_exhibit_at_cursor() | 600 | self._render_exhibit_at_cursor() |
378 | 609 | return | 601 | |
379 | 610 | 602 | ||
380 | 611 | def get_test_exhibits_window(): | 603 | def get_test_exhibits_window(): |
381 | 612 | from mock import Mock | 604 | from mock import Mock |
382 | @@ -618,19 +610,22 @@ | |||
383 | 618 | 610 | ||
384 | 619 | exhibits_list = [FeaturedExhibit()] | 611 | exhibits_list = [FeaturedExhibit()] |
385 | 620 | for (i, (title, url)) in enumerate([ | 612 | for (i, (title, url)) in enumerate([ |
399 | 621 | ("1 some title", "https://wiki.ubuntu.com/Brand?action=AttachFile&do=get&target=orangeubuntulogo.png"), | 613 | ("1 some title", "https://wiki.ubuntu.com/Brand?" |
400 | 622 | ("2 another title", "https://wiki.ubuntu.com/Brand?action=AttachFile&do=get&target=blackeubuntulogo.png"), | 614 | "action=AttachFile&do=get&target=orangeubuntulogo.png"), |
401 | 623 | ("3 yet another title", "https://wiki.ubuntu.com/Brand?action=AttachFile&do=get&target=xubuntu.png"), | 615 | ("2 another title", "https://wiki.ubuntu.com/Brand?" |
402 | 624 | ]): | 616 | "action=AttachFile&do=get&target=blackeubuntulogo.png"), |
403 | 625 | exhibit = Mock() | 617 | ("3 yet another title", "https://wiki.ubuntu.com/Brand?" |
404 | 626 | exhibit.id = i | 618 | "action=AttachFile&do=get&target=xubuntu.png"), |
405 | 627 | exhibit.package_names = "apt,2vcard" | 619 | ]): |
406 | 628 | exhibit.published = True | 620 | exhibit = Mock() |
407 | 629 | exhibit.style = "some uri to html" | 621 | exhibit.id = i |
408 | 630 | exhibit.title_translated = title | 622 | exhibit.package_names = "apt,2vcard" |
409 | 631 | exhibit.banner_url = url | 623 | exhibit.published = True |
410 | 632 | exhibit.html = None | 624 | exhibit.style = "some uri to html" |
411 | 633 | exhibits_list.append(exhibit) | 625 | exhibit.title_translated = title |
412 | 626 | exhibit.banner_url = url | ||
413 | 627 | exhibit.html = None | ||
414 | 628 | exhibits_list.append(exhibit) | ||
415 | 634 | 629 | ||
416 | 635 | exhibit_banner.set_exhibits(exhibits_list) | 630 | exhibit_banner.set_exhibits(exhibits_list) |
417 | 636 | 631 | ||
418 | 637 | 632 | ||
419 | === modified file 'softwarecenter/ui/gtk3/widgets/imagedialog.py' | |||
420 | --- softwarecenter/ui/gtk3/widgets/imagedialog.py 2011-09-06 09:06:41 +0000 | |||
421 | +++ softwarecenter/ui/gtk3/widgets/imagedialog.py 2012-03-09 13:04:23 +0000 | |||
422 | @@ -22,12 +22,15 @@ | |||
423 | 22 | 22 | ||
424 | 23 | ICON_EXCEPTIONS = ["gnome"] | 23 | ICON_EXCEPTIONS = ["gnome"] |
425 | 24 | 24 | ||
426 | 25 | |||
427 | 25 | class Url404Error(IOError): | 26 | class Url404Error(IOError): |
428 | 26 | pass | 27 | pass |
429 | 27 | 28 | ||
430 | 29 | |||
431 | 28 | class Url403Error(IOError): | 30 | class Url403Error(IOError): |
432 | 29 | pass | 31 | pass |
433 | 30 | 32 | ||
434 | 33 | |||
435 | 31 | class SimpleShowImageDialog(Gtk.Dialog): | 34 | class SimpleShowImageDialog(Gtk.Dialog): |
436 | 32 | """A dialog that shows a image """ | 35 | """A dialog that shows a image """ |
437 | 33 | 36 | ||
438 | @@ -61,7 +64,7 @@ | |||
439 | 61 | self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE) | 64 | self.add_button(Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE) |
440 | 62 | self.set_default_size(SimpleShowImageDialog.DEFAULT_WIDTH, | 65 | self.set_default_size(SimpleShowImageDialog.DEFAULT_WIDTH, |
441 | 63 | SimpleShowImageDialog.DEFAULT_HEIGHT) | 66 | SimpleShowImageDialog.DEFAULT_HEIGHT) |
443 | 64 | 67 | ||
444 | 65 | def run(self): | 68 | def run(self): |
445 | 66 | # show all and run the real thing | 69 | # show all and run the real thing |
446 | 67 | self.show_all() | 70 | self.show_all() |
447 | @@ -71,5 +74,7 @@ | |||
448 | 71 | if __name__ == "__main__": | 74 | if __name__ == "__main__": |
449 | 72 | 75 | ||
450 | 73 | # pixbuf | 76 | # pixbuf |
452 | 74 | d = SimpleShowImageDialog("Synaptic Screenshot", GdkPixbuf.Pixbuf.new_from_file("/usr/share/software-center/images/arrows.png")) | 77 | d = SimpleShowImageDialog("Synaptic Screenshot", |
453 | 78 | GdkPixbuf.Pixbuf.new_from_file( | ||
454 | 79 | "/usr/share/software-center/images/arrows.png")) | ||
455 | 75 | d.run() | 80 | d.run() |
456 | 76 | 81 | ||
457 | === modified file 'softwarecenter/ui/gtk3/widgets/labels.py' | |||
458 | --- softwarecenter/ui/gtk3/widgets/labels.py 2012-01-26 22:11:41 +0000 | |||
459 | +++ softwarecenter/ui/gtk3/widgets/labels.py 2012-03-09 13:04:23 +0000 | |||
460 | @@ -21,26 +21,27 @@ | |||
461 | 21 | 21 | ||
462 | 22 | from softwarecenter.hw import TAG_DESCRIPTION | 22 | from softwarecenter.hw import TAG_DESCRIPTION |
463 | 23 | 23 | ||
464 | 24 | |||
465 | 24 | class HardwareRequirementsLabel(Gtk.HBox): | 25 | class HardwareRequirementsLabel(Gtk.HBox): |
468 | 25 | """ contains a single HW requirement string and a image that shows if | 26 | """ contains a single HW requirement string and a image that shows if |
469 | 26 | the requirements are meet | 27 | the requirements are meet |
470 | 27 | """ | 28 | """ |
471 | 28 | 29 | ||
472 | 29 | SUPPORTED_SYM = { | 30 | SUPPORTED_SYM = { |
473 | 30 | # TRANSLATORS: symbol for "hardware-supported" | 31 | # TRANSLATORS: symbol for "hardware-supported" |
475 | 31 | 'yes' : _(u'\u2713'), | 32 | 'yes': _(u'\u2713'), |
476 | 32 | # TRANSLATORS: symbol for hardware "not-supported" | 33 | # TRANSLATORS: symbol for hardware "not-supported" |
478 | 33 | 'no' : u'<span foreground="red">%s</span>' % _(u'\u2718'), | 34 | 'no': u'<span foreground="red">%s</span>' % _(u'\u2718'), |
479 | 34 | } | 35 | } |
480 | 35 | 36 | ||
482 | 36 | # TRANSLATORS: this is a substring that used to build the | 37 | # TRANSLATORS: this is a substring that used to build the |
483 | 37 | # "hardware-supported" string, where sym is | 38 | # "hardware-supported" string, where sym is |
484 | 38 | # either a unicode checkmark or a cross | 39 | # either a unicode checkmark or a cross |
485 | 39 | # and hardware is the short hardware description | 40 | # and hardware is the short hardware description |
486 | 40 | # Note that this is the last substr, no trailing "," | 41 | # Note that this is the last substr, no trailing "," |
487 | 41 | LABEL_LAST_ITEM = _("%(sym)s%(hardware)s") | 42 | LABEL_LAST_ITEM = _("%(sym)s%(hardware)s") |
488 | 42 | 43 | ||
490 | 43 | # TRANSLATORS: this is a substring that used to build the | 44 | # TRANSLATORS: this is a substring that used to build the |
491 | 44 | # "hardware-supported" string, where sym is | 45 | # "hardware-supported" string, where sym is |
492 | 45 | # either a unicode checkmark or a cross | 46 | # either a unicode checkmark or a cross |
493 | 46 | # and hardware is the short hardware description | 47 | # and hardware is the short hardware description |
494 | @@ -53,27 +54,31 @@ | |||
495 | 53 | self.result = None | 54 | self.result = None |
496 | 54 | self.last_item = last_item | 55 | self.last_item = last_item |
497 | 55 | self._build_ui() | 56 | self._build_ui() |
498 | 57 | |||
499 | 56 | def _build_ui(self): | 58 | def _build_ui(self): |
500 | 57 | self._label = Gtk.Label() | 59 | self._label = Gtk.Label() |
501 | 58 | self._label.show() | 60 | self._label.show() |
502 | 59 | self.pack_start(self._label, True, True, 0) | 61 | self.pack_start(self._label, True, True, 0) |
503 | 62 | |||
504 | 60 | def get_label(self): | 63 | def get_label(self): |
505 | 61 | # get the right symbol | 64 | # get the right symbol |
506 | 62 | sym = self.SUPPORTED_SYM[self.result] | 65 | sym = self.SUPPORTED_SYM[self.result] |
508 | 63 | # we add a trailing | 66 | # we add a trailing |
509 | 64 | if self.last_item: | 67 | if self.last_item: |
510 | 65 | s = self.LABEL_LAST_ITEM | 68 | s = self.LABEL_LAST_ITEM |
511 | 66 | else: | 69 | else: |
513 | 67 | s= self.LABEL | 70 | s = self.LABEL |
514 | 68 | return _(s) % { | 71 | return _(s) % { |
517 | 69 | "sym" : sym, | 72 | "sym": sym, |
518 | 70 | "hardware" : _(TAG_DESCRIPTION[self.tag]), | 73 | "hardware": _(TAG_DESCRIPTION[self.tag]), |
519 | 71 | } | 74 | } |
520 | 75 | |||
521 | 72 | def set_hardware_requirement(self, tag, result): | 76 | def set_hardware_requirement(self, tag, result): |
522 | 73 | self.tag = tag | 77 | self.tag = tag |
523 | 74 | self.result = result | 78 | self.result = result |
524 | 75 | self._label.set_markup(self.get_label()) | 79 | self._label.set_markup(self.get_label()) |
525 | 76 | 80 | ||
526 | 81 | |||
527 | 77 | class HardwareRequirementsBox(Gtk.HBox): | 82 | class HardwareRequirementsBox(Gtk.HBox): |
528 | 78 | """ A collection of HW requirement labels """ | 83 | """ A collection of HW requirement labels """ |
529 | 79 | 84 | ||
530 | @@ -107,9 +112,10 @@ | |||
531 | 107 | win = Gtk.Window() | 112 | win = Gtk.Window() |
532 | 108 | win.set_size_request(300, 200) | 113 | win.set_size_request(300, 200) |
533 | 109 | 114 | ||
537 | 110 | HW_TEST_RESULT = { 'hardware::gps' : 'yes', | 115 | HW_TEST_RESULT = { |
538 | 111 | 'hardware::video:opengl' : 'no', | 116 | 'hardware::gps': 'yes', |
539 | 112 | } | 117 | 'hardware::video:opengl': 'no', |
540 | 118 | } | ||
541 | 113 | 119 | ||
542 | 114 | # add it | 120 | # add it |
543 | 115 | hwbox = HardwareRequirementsBox() | 121 | hwbox = HardwareRequirementsBox() |
544 | 116 | 122 | ||
545 | === modified file 'softwarecenter/ui/gtk3/widgets/menubutton.py' | |||
546 | --- softwarecenter/ui/gtk3/widgets/menubutton.py 2012-01-05 09:49:23 +0000 | |||
547 | +++ softwarecenter/ui/gtk3/widgets/menubutton.py 2012-03-09 13:04:23 +0000 | |||
548 | @@ -18,11 +18,12 @@ | |||
549 | 18 | 18 | ||
550 | 19 | from gi.repository import Gtk | 19 | from gi.repository import Gtk |
551 | 20 | 20 | ||
552 | 21 | |||
553 | 21 | class MenuButton(Gtk.Button): | 22 | class MenuButton(Gtk.Button): |
554 | 22 | 23 | ||
555 | 23 | def __init__(self, menu, icon=None, label=None): | 24 | def __init__(self, menu, icon=None, label=None): |
556 | 24 | super(MenuButton, self).__init__() | 25 | super(MenuButton, self).__init__() |
558 | 25 | 26 | ||
559 | 26 | box = Gtk.Box() | 27 | box = Gtk.Box() |
560 | 27 | self.add(box) | 28 | self.add(box) |
561 | 28 | 29 | ||
562 | @@ -30,12 +31,12 @@ | |||
563 | 30 | box.pack_start(icon, False, True, 1) | 31 | box.pack_start(icon, False, True, 1) |
564 | 31 | if label: | 32 | if label: |
565 | 32 | box.pack_start(Gtk.Label(label), True, True, 0) | 33 | box.pack_start(Gtk.Label(label), True, True, 0) |
567 | 33 | 34 | ||
568 | 34 | arrow = Gtk.Arrow.new(Gtk.ArrowType.DOWN, Gtk.ShadowType.OUT) | 35 | arrow = Gtk.Arrow.new(Gtk.ArrowType.DOWN, Gtk.ShadowType.OUT) |
569 | 35 | box.pack_start(arrow, False, False, 1) | 36 | box.pack_start(arrow, False, False, 1) |
570 | 36 | 37 | ||
571 | 37 | self.menu = menu | 38 | self.menu = menu |
573 | 38 | 39 | ||
574 | 39 | self.connect("button-press-event", self.on_button_pressed, menu) | 40 | self.connect("button-press-event", self.on_button_pressed, menu) |
575 | 40 | self.connect("clicked", self.on_keyboard_clicked, menu) | 41 | self.connect("clicked", self.on_keyboard_clicked, menu) |
576 | 41 | 42 | ||
577 | @@ -44,18 +45,21 @@ | |||
578 | 44 | return self.menu | 45 | return self.menu |
579 | 45 | 46 | ||
580 | 46 | def on_button_pressed(self, button, event, menu): | 47 | def on_button_pressed(self, button, event, menu): |
582 | 47 | menu.popup(None, None, self.menu_positionner, (button, event.x), event.button, event.time) | 48 | menu.popup(None, None, self.menu_positionner, (button, event.x), |
583 | 49 | event.button, event.time) | ||
584 | 48 | 50 | ||
585 | 49 | def on_keyboard_clicked(self, button, menu): | 51 | def on_keyboard_clicked(self, button, menu): |
587 | 50 | menu.popup(None, None, self.menu_positionner, (button, None), 1, Gtk.get_current_event_time()) | 52 | menu.popup(None, None, self.menu_positionner, (button, None), 1, |
588 | 53 | Gtk.get_current_event_time()) | ||
589 | 51 | 54 | ||
590 | 52 | def menu_positionner(self, menu, (button, x_cursor_pos)): | 55 | def menu_positionner(self, menu, (button, x_cursor_pos)): |
591 | 53 | (button_id, x, y) = button.get_window().get_origin() | 56 | (button_id, x, y) = button.get_window().get_origin() |
592 | 54 | 57 | ||
593 | 55 | # compute button position | 58 | # compute button position |
594 | 56 | x_position = x + button.get_allocation().x | 59 | x_position = x + button.get_allocation().x |
597 | 57 | y_position = y + button.get_allocation().y + button.get_allocated_height() | 60 | y_position = (y + button.get_allocation().y + |
598 | 58 | 61 | button.get_allocated_height()) | |
599 | 62 | |||
600 | 59 | # if pressed by the mouse, center the X position to it | 63 | # if pressed by the mouse, center the X position to it |
601 | 60 | if x_cursor_pos: | 64 | if x_cursor_pos: |
602 | 61 | x_position += x_cursor_pos | 65 | x_position += x_cursor_pos |
603 | @@ -63,19 +67,24 @@ | |||
604 | 63 | 67 | ||
605 | 64 | # computer current monitor height | 68 | # computer current monitor height |
606 | 65 | current_screen = button.get_screen() | 69 | current_screen = button.get_screen() |
608 | 66 | num_monitor = current_screen.get_monitor_at_point(x_position, y_position) | 70 | num_monitor = current_screen.get_monitor_at_point(x_position, |
609 | 71 | y_position) | ||
610 | 67 | monitor_geo = current_screen.get_monitor_geometry(num_monitor) | 72 | monitor_geo = current_screen.get_monitor_geometry(num_monitor) |
612 | 68 | 73 | ||
613 | 69 | # if the menu width is of the current monitor, shift is a little | 74 | # if the menu width is of the current monitor, shift is a little |
614 | 70 | if x_position < monitor_geo.x: | 75 | if x_position < monitor_geo.x: |
615 | 71 | x_position = monitor_geo.x | 76 | x_position = monitor_geo.x |
620 | 72 | if x_position + menu.get_allocated_width() > monitor_geo.x + monitor_geo.width: | 77 | if (x_position + menu.get_allocated_width() > monitor_geo.x + |
621 | 73 | x_position = monitor_geo.x + monitor_geo.width - menu.get_allocated_width() | 78 | monitor_geo.width): |
622 | 74 | 79 | x_position = (monitor_geo.x + monitor_geo.width - | |
623 | 75 | # if the menu height is too long for the monitor, put it above the widget | 80 | menu.get_allocated_width()) |
624 | 81 | |||
625 | 82 | # if the menu height is too long for the monitor, put it above the | ||
626 | 83 | # widget | ||
627 | 76 | if monitor_geo.height < y_position + menu.get_allocated_height(): | 84 | if monitor_geo.height < y_position + menu.get_allocated_height(): |
630 | 77 | y_position = y_position - button.get_allocated_height() - menu.get_allocated_height() | 85 | y_position = (y_position - button.get_allocated_height() - |
631 | 78 | 86 | menu.get_allocated_height()) | |
632 | 87 | |||
633 | 79 | return (x_position, y_position, True) | 88 | return (x_position, y_position, True) |
634 | 80 | 89 | ||
635 | 81 | 90 | ||
636 | @@ -93,23 +102,24 @@ | |||
637 | 93 | menuitem2.show() | 102 | menuitem2.show() |
638 | 94 | 103 | ||
639 | 95 | box1 = Gtk.Box() | 104 | box1 = Gtk.Box() |
641 | 96 | box1.pack_start(Gtk.Label("something before to show we don't cheat"), True, True, 0) | 105 | box1.pack_start(Gtk.Label("something before to show we don't cheat"), |
642 | 106 | True, True, 0) | ||
643 | 97 | win.add(box1) | 107 | win.add(box1) |
644 | 98 | 108 | ||
645 | 99 | box2 = Gtk.Box() | 109 | box2 = Gtk.Box() |
647 | 100 | box2.set_orientation(Gtk.Orientation.VERTICAL) | 110 | box2.set_orientation(Gtk.Orientation.VERTICAL) |
648 | 101 | box1.pack_start(box2, True, True, 0) | 111 | box1.pack_start(box2, True, True, 0) |
649 | 102 | box2.pack_start(Gtk.Label("first label with multiple line"), True, True, 0) | 112 | box2.pack_start(Gtk.Label("first label with multiple line"), True, True, 0) |
651 | 103 | 113 | ||
652 | 104 | image = Gtk.Image.new_from_stock(Gtk.STOCK_PROPERTIES, Gtk.IconSize.BUTTON) | 114 | image = Gtk.Image.new_from_stock(Gtk.STOCK_PROPERTIES, Gtk.IconSize.BUTTON) |
653 | 105 | label = "fooo" | 115 | label = "fooo" |
654 | 106 | button_with_menu = MenuButton(menu, image, label) | 116 | button_with_menu = MenuButton(menu, image, label) |
656 | 107 | box2.pack_start(button_with_menu, False, False, 1) | 117 | box2.pack_start(button_with_menu, False, False, 1) |
657 | 108 | 118 | ||
658 | 109 | win.connect("destroy", lambda x: Gtk.main_quit()) | 119 | win.connect("destroy", lambda x: Gtk.main_quit()) |
659 | 110 | win.show_all() | 120 | win.show_all() |
660 | 111 | 121 | ||
661 | 112 | settings = Gtk.Settings.get_default() | 122 | settings = Gtk.Settings.get_default() |
662 | 113 | settings.set_property("gtk-button-images", True) | 123 | settings.set_property("gtk-button-images", True) |
664 | 114 | 124 | ||
665 | 115 | Gtk.main() | 125 | Gtk.main() |
666 | 116 | 126 | ||
667 | === modified file 'softwarecenter/ui/gtk3/widgets/oneconfviews.py' | |||
668 | --- softwarecenter/ui/gtk3/widgets/oneconfviews.py 2012-01-05 09:49:23 +0000 | |||
669 | +++ softwarecenter/ui/gtk3/widgets/oneconfviews.py 2012-03-09 13:04:23 +0000 | |||
670 | @@ -25,26 +25,28 @@ | |||
671 | 25 | class OneConfViews(Gtk.TreeView): | 25 | class OneConfViews(Gtk.TreeView): |
672 | 26 | 26 | ||
673 | 27 | __gsignals__ = { | 27 | __gsignals__ = { |
681 | 28 | "computer-changed" : (GObject.SIGNAL_RUN_LAST, | 28 | "computer-changed": (GObject.SIGNAL_RUN_LAST, |
682 | 29 | GObject.TYPE_NONE, | 29 | GObject.TYPE_NONE, |
683 | 30 | (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT), | 30 | (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT), |
684 | 31 | ), | 31 | ), |
685 | 32 | "current-inventory-refreshed" : (GObject.SIGNAL_RUN_LAST, | 32 | "current-inventory-refreshed": (GObject.SIGNAL_RUN_LAST, |
686 | 33 | GObject.TYPE_NONE, | 33 | GObject.TYPE_NONE, |
687 | 34 | (),), | 34 | (), |
688 | 35 | ), | ||
689 | 35 | } | 36 | } |
691 | 36 | 37 | ||
692 | 37 | (COL_ICON, COL_HOSTID, COL_HOSTNAME) = range(3) | 38 | (COL_ICON, COL_HOSTID, COL_HOSTNAME) = range(3) |
693 | 38 | 39 | ||
694 | 39 | def __init__(self, icons): | 40 | def __init__(self, icons): |
695 | 40 | super(OneConfViews, self).__init__() | 41 | super(OneConfViews, self).__init__() |
697 | 41 | model = Gtk.ListStore(GdkPixbuf.Pixbuf, GObject.TYPE_STRING, GObject.TYPE_STRING) | 42 | model = Gtk.ListStore(GdkPixbuf.Pixbuf, GObject.TYPE_STRING, |
698 | 43 | GObject.TYPE_STRING) | ||
699 | 42 | model.set_sort_column_id(self.COL_HOSTNAME, Gtk.SortType.ASCENDING) | 44 | model.set_sort_column_id(self.COL_HOSTNAME, Gtk.SortType.ASCENDING) |
700 | 43 | model.set_sort_func(self.COL_HOSTNAME, self._sort_hosts) | 45 | model.set_sort_func(self.COL_HOSTNAME, self._sort_hosts) |
701 | 44 | self.set_model(model) | 46 | self.set_model(model) |
702 | 45 | self.set_headers_visible(False) | 47 | self.set_headers_visible(False) |
703 | 46 | self.col = Gtk.TreeViewColumn('hostname') | 48 | self.col = Gtk.TreeViewColumn('hostname') |
705 | 47 | 49 | ||
706 | 48 | hosticon_renderer = Gtk.CellRendererPixbuf() | 50 | hosticon_renderer = Gtk.CellRendererPixbuf() |
707 | 49 | hostname_renderer = Gtk.CellRendererText() | 51 | hostname_renderer = Gtk.CellRendererText() |
708 | 50 | self.col.pack_start(hosticon_renderer, False) | 52 | self.col.pack_start(hosticon_renderer, False) |
709 | @@ -57,9 +59,9 @@ | |||
710 | 57 | 59 | ||
711 | 58 | # TODO: load the dynamic one (if present), later | 60 | # TODO: load the dynamic one (if present), later |
712 | 59 | self.default_computer_icon = icons.load_icon("computer", 22, 0) | 61 | self.default_computer_icon = icons.load_icon("computer", 22, 0) |
714 | 60 | 62 | ||
715 | 61 | self.connect("cursor-changed", self.on_cursor_changed) | 63 | self.connect("cursor-changed", self.on_cursor_changed) |
717 | 62 | 64 | ||
718 | 63 | def register_computer(self, hostid, hostname): | 65 | def register_computer(self, hostid, hostname): |
719 | 64 | '''Add a new computer to the model''' | 66 | '''Add a new computer to the model''' |
720 | 65 | model = self.get_model() | 67 | model = self.get_model() |
721 | @@ -73,17 +75,20 @@ | |||
722 | 73 | model.append([self.default_computer_icon, hostid, hostname]) | 75 | model.append([self.default_computer_icon, hostid, hostname]) |
723 | 74 | 76 | ||
724 | 75 | def store_packagelist_changed(self, hostid): | 77 | def store_packagelist_changed(self, hostid): |
726 | 76 | '''Emit a signal for refreshing the installedpane if current view is concerned''' | 78 | '''Emit a signal for refreshing the installedpane if current view is |
727 | 79 | concerned | ||
728 | 80 | ''' | ||
729 | 77 | if hostid == self.current_hostid: | 81 | if hostid == self.current_hostid: |
730 | 78 | self.emit("current-inventory-refreshed") | 82 | self.emit("current-inventory-refreshed") |
732 | 79 | 83 | ||
733 | 80 | def remove_computer(self, hostid): | 84 | def remove_computer(self, hostid): |
734 | 81 | '''Remove a computer from the model''' | 85 | '''Remove a computer from the model''' |
735 | 82 | model = self.get_model() | 86 | model = self.get_model() |
736 | 83 | if not model: | 87 | if not model: |
737 | 84 | return | 88 | return |
738 | 85 | if hostid not in self.hostids: | 89 | if hostid not in self.hostids: |
740 | 86 | LOG.warning("ask to remove a computer that isn't registered: %s" % hostid) | 90 | LOG.warning("ask to remove a computer that isn't registered: %s" % |
741 | 91 | hostid) | ||
742 | 87 | return | 92 | return |
743 | 88 | iter_id = model.get_iter_first() | 93 | iter_id = model.get_iter_first() |
744 | 89 | while iter_id: | 94 | while iter_id: |
745 | @@ -92,8 +97,7 @@ | |||
746 | 92 | self.hostids.remove(hostid) | 97 | self.hostids.remove(hostid) |
747 | 93 | break | 98 | break |
748 | 94 | iter_id = model.iter_next(iter_id) | 99 | iter_id = model.iter_next(iter_id) |
751 | 95 | 100 | ||
750 | 96 | |||
752 | 97 | def on_cursor_changed(self, widget): | 101 | def on_cursor_changed(self, widget): |
753 | 98 | 102 | ||
754 | 99 | (path, column) = self.get_cursor() | 103 | (path, column) = self.get_cursor() |
755 | @@ -101,28 +105,30 @@ | |||
756 | 101 | return | 105 | return |
757 | 102 | model = self.get_model() | 106 | model = self.get_model() |
758 | 103 | if not model: | 107 | if not model: |
760 | 104 | return | 108 | return |
761 | 105 | hostid = model[path][self.COL_HOSTID] | 109 | hostid = model[path][self.COL_HOSTID] |
762 | 106 | hostname = model[path][self.COL_HOSTNAME] | 110 | hostname = model[path][self.COL_HOSTNAME] |
763 | 107 | if hostid != self.current_hostid: | 111 | if hostid != self.current_hostid: |
764 | 108 | self.current_hostid = hostid | 112 | self.current_hostid = hostid |
765 | 109 | self.emit("computer-changed", hostid, hostname) | 113 | self.emit("computer-changed", hostid, hostname) |
767 | 110 | 114 | ||
768 | 111 | def select_first(self): | 115 | def select_first(self): |
769 | 112 | '''Select first item''' | 116 | '''Select first item''' |
770 | 113 | self.set_cursor(Gtk.TreePath.new_first(), None, False) | 117 | self.set_cursor(Gtk.TreePath.new_first(), None, False) |
772 | 114 | 118 | ||
773 | 115 | def _sort_hosts(self, model, iter1, iter2, user_data): | 119 | def _sort_hosts(self, model, iter1, iter2, user_data): |
774 | 116 | '''Sort hosts, with "this computer" (NONE HOSTID) as first''' | 120 | '''Sort hosts, with "this computer" (NONE HOSTID) as first''' |
775 | 117 | if not self.get_model().get_value(iter1, self.COL_HOSTID): | 121 | if not self.get_model().get_value(iter1, self.COL_HOSTID): |
776 | 118 | return -1 | 122 | return -1 |
777 | 119 | if not self.get_model().get_value(iter2, self.COL_HOSTID): | 123 | if not self.get_model().get_value(iter2, self.COL_HOSTID): |
780 | 120 | return 1 | 124 | return 1 |
781 | 121 | if self.get_model().get_value(iter1, self.COL_HOSTNAME) > self.get_model().get_value(iter2, self.COL_HOSTNAME): | 125 | if (self.get_model().get_value(iter1, self.COL_HOSTNAME) > |
782 | 126 | self.get_model().get_value(iter2, self.COL_HOSTNAME)): | ||
783 | 122 | return 1 | 127 | return 1 |
784 | 123 | else: | 128 | else: |
785 | 124 | return -1 | 129 | return -1 |
787 | 125 | 130 | ||
788 | 131 | |||
789 | 126 | def get_test_window(): | 132 | def get_test_window(): |
790 | 127 | 133 | ||
791 | 128 | w = OneConfViews(Gtk.IconTheme.get_default()) | 134 | w = OneConfViews(Gtk.IconTheme.get_default()) |
792 | @@ -141,14 +147,14 @@ | |||
793 | 141 | w.register_computer("CCCCC", "NameC") | 147 | w.register_computer("CCCCC", "NameC") |
794 | 142 | w.register_computer("", "This computer should be first") | 148 | w.register_computer("", "This computer should be first") |
795 | 143 | w.select_first() | 149 | w.select_first() |
797 | 144 | 150 | ||
798 | 145 | GObject.timeout_add_seconds(5, w.register_computer, "EEEEE", "NameE") | 151 | GObject.timeout_add_seconds(5, w.register_computer, "EEEEE", "NameE") |
800 | 146 | 152 | ||
801 | 147 | def print_selected_hostid(widget, hostid, hostname): | 153 | def print_selected_hostid(widget, hostid, hostname): |
802 | 148 | print "%s selected for %s" % (hostid, hostname) | 154 | print "%s selected for %s" % (hostid, hostname) |
804 | 149 | 155 | ||
805 | 150 | w.connect("computer-changed", print_selected_hostid) | 156 | w.connect("computer-changed", print_selected_hostid) |
807 | 151 | 157 | ||
808 | 152 | w.remove_computer("DDDDD") | 158 | w.remove_computer("DDDDD") |
809 | 153 | win.show_all() | 159 | win.show_all() |
810 | 154 | return win | 160 | return win |
811 | 155 | 161 | ||
812 | === modified file 'softwarecenter/ui/gtk3/widgets/recommendations.py' | |||
813 | --- softwarecenter/ui/gtk3/widgets/recommendations.py 2012-03-01 10:43:09 +0000 | |||
814 | +++ softwarecenter/ui/gtk3/widgets/recommendations.py 2012-03-09 13:04:23 +0000 | |||
815 | @@ -32,16 +32,17 @@ | |||
816 | 32 | 32 | ||
817 | 33 | LOG = logging.getLogger(__name__) | 33 | LOG = logging.getLogger(__name__) |
818 | 34 | 34 | ||
819 | 35 | |||
820 | 35 | class RecommendationsPanel(FramedHeaderBox): | 36 | class RecommendationsPanel(FramedHeaderBox): |
821 | 36 | """ | 37 | """ |
822 | 37 | Base class for widgets that display recommendations | 38 | Base class for widgets that display recommendations |
823 | 38 | """ | 39 | """ |
824 | 39 | 40 | ||
825 | 40 | __gsignals__ = { | 41 | __gsignals__ = { |
830 | 41 | "application-activated" : (GObject.SIGNAL_RUN_LAST, | 42 | "application-activated": (GObject.SIGNAL_RUN_LAST, |
831 | 42 | GObject.TYPE_NONE, | 43 | GObject.TYPE_NONE, |
832 | 43 | (GObject.TYPE_PYOBJECT,), | 44 | (GObject.TYPE_PYOBJECT,), |
833 | 44 | ), | 45 | ), |
834 | 45 | } | 46 | } |
835 | 46 | 47 | ||
836 | 47 | def __init__(self, catview): | 48 | def __init__(self, catview): |
837 | @@ -53,31 +54,32 @@ | |||
838 | 53 | self.catview.connect( | 54 | self.catview.connect( |
839 | 54 | "application-activated", self._on_application_activated) | 55 | "application-activated", self._on_application_activated) |
840 | 55 | self.recommender_agent = RecommenderAgent() | 56 | self.recommender_agent = RecommenderAgent() |
841 | 57 | |||
842 | 56 | def _on_application_activated(self, catview, app): | 58 | def _on_application_activated(self, catview, app): |
843 | 57 | self.emit("application-activated", app) | 59 | self.emit("application-activated", app) |
844 | 58 | 60 | ||
845 | 61 | |||
846 | 59 | class RecommendationsPanelLobby(RecommendationsPanel): | 62 | class RecommendationsPanelLobby(RecommendationsPanel): |
847 | 60 | """ | 63 | """ |
851 | 61 | Panel for use in the lobby view that manages the recommendations experience, | 64 | Panel for use in the lobby view that manages the recommendations |
852 | 62 | includes the initial opt-in screen and display of recommendations once they | 65 | experience, includes the initial opt-in screen and display of |
853 | 63 | have been received from the recommender agent | 66 | recommendations once they have been received from the recommender agent |
854 | 64 | """ | 67 | """ |
855 | 65 | |||
856 | 66 | __gsignals__ = { | 68 | __gsignals__ = { |
860 | 67 | "recommendations-opt-in" : (GObject.SIGNAL_RUN_LAST, | 69 | "recommendations-opt-in": (GObject.SIGNAL_RUN_LAST, |
861 | 68 | GObject.TYPE_NONE, | 70 | GObject.TYPE_NONE, |
862 | 69 | (GObject.TYPE_STRING,), | 71 | (GObject.TYPE_STRING,), |
863 | 72 | ), | ||
864 | 73 | "recommendations-opt-out": (GObject.SIGNAL_RUN_LAST, | ||
865 | 74 | GObject.TYPE_NONE, | ||
866 | 75 | (), | ||
867 | 70 | ), | 76 | ), |
868 | 71 | "recommendations-opt-out" : (GObject.SIGNAL_RUN_LAST, | ||
869 | 72 | GObject.TYPE_NONE, | ||
870 | 73 | (), | ||
871 | 74 | ), | ||
872 | 75 | } | 77 | } |
874 | 76 | 78 | ||
875 | 77 | def __init__(self, catview): | 79 | def __init__(self, catview): |
876 | 78 | RecommendationsPanel.__init__(self, catview) | 80 | RecommendationsPanel.__init__(self, catview) |
877 | 79 | self.set_header_label(_(u"Recommended for You")) | 81 | self.set_header_label(_(u"Recommended for You")) |
879 | 80 | 82 | ||
880 | 81 | # if we already have a recommender UUID, then the user is already | 83 | # if we already have a recommender UUID, then the user is already |
881 | 82 | # opted-in to the recommender service | 84 | # opted-in to the recommender service |
882 | 83 | self.recommended_for_you_content = None | 85 | self.recommended_for_you_content = None |
883 | @@ -85,14 +87,14 @@ | |||
884 | 85 | self._update_recommended_for_you_content() | 87 | self._update_recommended_for_you_content() |
885 | 86 | else: | 88 | else: |
886 | 87 | self._show_opt_in_view() | 89 | self._show_opt_in_view() |
888 | 88 | 90 | ||
889 | 89 | def _show_opt_in_view(self): | 91 | def _show_opt_in_view(self): |
890 | 90 | # opt in box | 92 | # opt in box |
891 | 91 | vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, StockEms.MEDIUM) | 93 | vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, StockEms.MEDIUM) |
892 | 92 | vbox.set_border_width(StockEms.LARGE) | 94 | vbox.set_border_width(StockEms.LARGE) |
893 | 93 | self.opt_in_vbox = vbox # for tests | 95 | self.opt_in_vbox = vbox # for tests |
894 | 94 | self.recommended_for_you_content = vbox # hook it up to the rest | 96 | self.recommended_for_you_content = vbox # hook it up to the rest |
896 | 95 | 97 | ||
897 | 96 | self.add(self.recommended_for_you_content) | 98 | self.add(self.recommended_for_you_content) |
898 | 97 | 99 | ||
899 | 98 | # opt in button | 100 | # opt in button |
900 | @@ -111,7 +113,7 @@ | |||
901 | 111 | label.set_alignment(0, 0.5) | 113 | label.set_alignment(0, 0.5) |
902 | 112 | label.set_line_wrap(True) | 114 | label.set_line_wrap(True) |
903 | 113 | vbox.pack_start(label, False, False, 0) | 115 | vbox.pack_start(label, False, False, 0) |
905 | 114 | 116 | ||
906 | 115 | def _on_opt_in_button_clicked(self, button): | 117 | def _on_opt_in_button_clicked(self, button): |
907 | 116 | # we upload the user profile here, and only after this is finished | 118 | # we upload the user profile here, and only after this is finished |
908 | 117 | # do we fire the request for recommendations and finally display | 119 | # do we fire the request for recommendations and finally display |
909 | @@ -119,11 +121,11 @@ | |||
910 | 119 | # wants a progress bar, but we don't have access to real-time | 121 | # wants a progress bar, but we don't have access to real-time |
911 | 120 | # progress info) | 122 | # progress info) |
912 | 121 | self._upload_user_profile_and_get_recommendations() | 123 | self._upload_user_profile_and_get_recommendations() |
914 | 122 | 124 | ||
915 | 123 | def _upload_user_profile_and_get_recommendations(self): | 125 | def _upload_user_profile_and_get_recommendations(self): |
916 | 124 | # initiate upload of the user profile here | 126 | # initiate upload of the user profile here |
917 | 125 | self._upload_user_profile() | 127 | self._upload_user_profile() |
919 | 126 | 128 | ||
920 | 127 | def _upload_user_profile(self): | 129 | def _upload_user_profile(self): |
921 | 128 | self.spinner_notebook.show_spinner(_("Submitting inventory…")) | 130 | self.spinner_notebook.show_spinner(_("Submitting inventory…")) |
922 | 129 | self.recommender_agent.connect("submit-profile-finished", | 131 | self.recommender_agent.connect("submit-profile-finished", |
923 | @@ -131,7 +133,7 @@ | |||
924 | 131 | self.recommender_agent.connect("error", | 133 | self.recommender_agent.connect("error", |
925 | 132 | self._on_profile_submitted_error) | 134 | self._on_profile_submitted_error) |
926 | 133 | self.recommender_agent.post_submit_profile(self.catview.db) | 135 | self.recommender_agent.post_submit_profile(self.catview.db) |
928 | 134 | 136 | ||
929 | 135 | def _on_profile_submitted(self, agent, profile, recommender_uuid): | 137 | def _on_profile_submitted(self, agent, profile, recommender_uuid): |
930 | 136 | # after the user profile data has been uploaded, make the request | 138 | # after the user profile data has been uploaded, make the request |
931 | 137 | # and load the the recommended_for_you content | 139 | # and load the the recommended_for_you content |
932 | @@ -139,13 +141,13 @@ | |||
933 | 139 | "submitted to the recommender agent") | 141 | "submitted to the recommender agent") |
934 | 140 | self.emit("recommendations-opt-in", recommender_uuid) | 142 | self.emit("recommendations-opt-in", recommender_uuid) |
935 | 141 | self._update_recommended_for_you_content() | 143 | self._update_recommended_for_you_content() |
937 | 142 | 144 | ||
938 | 143 | def _on_profile_submitted_error(self, agent, msg): | 145 | def _on_profile_submitted_error(self, agent, msg): |
939 | 144 | LOG.warn("Error while submitting the recommendations profile to the " | 146 | LOG.warn("Error while submitting the recommendations profile to the " |
940 | 145 | "recommender agent: %s" % msg) | 147 | "recommender agent: %s" % msg) |
941 | 146 | # TODO: handle this! display an error message in the panel | 148 | # TODO: handle this! display an error message in the panel |
942 | 147 | self._hide_recommended_for_you_panel() | 149 | self._hide_recommended_for_you_panel() |
944 | 148 | 150 | ||
945 | 149 | def _update_recommended_for_you_content(self): | 151 | def _update_recommended_for_you_content(self): |
946 | 150 | # destroy the old content to ensure we don't see it twice | 152 | # destroy the old content to ensure we don't see it twice |
947 | 151 | # (also removes the opt-in panel if it was there) | 153 | # (also removes the opt-in panel if it was there) |
948 | @@ -163,7 +165,7 @@ | |||
949 | 163 | self._on_recommended_for_you_agent_refresh) | 165 | self._on_recommended_for_you_agent_refresh) |
950 | 164 | self.recommended_for_you_cat.connect('recommender-agent-error', | 166 | self.recommended_for_you_cat.connect('recommender-agent-error', |
951 | 165 | self._on_recommender_agent_error) | 167 | self._on_recommender_agent_error) |
953 | 166 | 168 | ||
954 | 167 | def _on_recommended_for_you_agent_refresh(self, cat): | 169 | def _on_recommended_for_you_agent_refresh(self, cat): |
955 | 168 | docs = cat.get_documents(self.catview.db) | 170 | docs = cat.get_documents(self.catview.db) |
956 | 169 | # display the recommendedations | 171 | # display the recommendedations |
957 | @@ -179,8 +181,7 @@ | |||
958 | 179 | # TODO: this test for zero docs is temporary and will not be | 181 | # TODO: this test for zero docs is temporary and will not be |
959 | 180 | # needed once the recommendation agent is up and running | 182 | # needed once the recommendation agent is up and running |
960 | 181 | self._hide_recommended_for_you_panel() | 183 | self._hide_recommended_for_you_panel() |
963 | 182 | return | 184 | |
962 | 183 | |||
964 | 184 | def _on_recommender_agent_error(self, agent, msg): | 185 | def _on_recommender_agent_error(self, agent, msg): |
965 | 185 | LOG.warn("Error while accessing the recommender agent for the " | 186 | LOG.warn("Error while accessing the recommender agent for the " |
966 | 186 | "lobby recommendations: %s" % msg) | 187 | "lobby recommendations: %s" % msg) |
967 | @@ -190,8 +191,8 @@ | |||
968 | 190 | def _hide_recommended_for_you_panel(self): | 191 | def _hide_recommended_for_you_panel(self): |
969 | 191 | # and hide the pane | 192 | # and hide the pane |
970 | 192 | self.hide() | 193 | self.hide() |
973 | 193 | 194 | ||
974 | 194 | 195 | ||
975 | 195 | class RecommendationsPanelDetails(RecommendationsPanel): | 196 | class RecommendationsPanelDetails(RecommendationsPanel): |
976 | 196 | """ | 197 | """ |
977 | 197 | Panel for use in the details view to display recommendations for a given | 198 | Panel for use in the details view to display recommendations for a given |
978 | @@ -202,7 +203,7 @@ | |||
979 | 202 | self.set_header_label(_(u"People Also Installed")) | 203 | self.set_header_label(_(u"People Also Installed")) |
980 | 203 | self.app_recommendations_content = FlowableGrid() | 204 | self.app_recommendations_content = FlowableGrid() |
981 | 204 | self.add(self.app_recommendations_content) | 205 | self.add(self.app_recommendations_content) |
983 | 205 | 206 | ||
984 | 206 | def set_pkgname(self, pkgname): | 207 | def set_pkgname(self, pkgname): |
985 | 207 | self.pkgname = pkgname | 208 | self.pkgname = pkgname |
986 | 208 | self._update_app_recommendations_content() | 209 | self._update_app_recommendations_content() |
987 | @@ -217,7 +218,7 @@ | |||
988 | 217 | self._on_app_recommendations_agent_refresh) | 218 | self._on_app_recommendations_agent_refresh) |
989 | 218 | self.app_recommendations_cat.connect('recommender-agent-error', | 219 | self.app_recommendations_cat.connect('recommender-agent-error', |
990 | 219 | self._on_recommender_agent_error) | 220 | self._on_recommender_agent_error) |
992 | 220 | 221 | ||
993 | 221 | def _on_app_recommendations_agent_refresh(self, cat): | 222 | def _on_app_recommendations_agent_refresh(self, cat): |
994 | 222 | docs = cat.get_documents(self.catview.db) | 223 | docs = cat.get_documents(self.catview.db) |
995 | 223 | # display the recommendations | 224 | # display the recommendations |
996 | @@ -228,8 +229,7 @@ | |||
997 | 228 | self.spinner_notebook.hide_spinner() | 229 | self.spinner_notebook.hide_spinner() |
998 | 229 | else: | 230 | else: |
999 | 230 | self._hide_app_recommendations_panel() | 231 | self._hide_app_recommendations_panel() |
1002 | 231 | return | 232 | |
1001 | 232 | |||
1003 | 233 | def _on_recommender_agent_error(self, agent, msg): | 233 | def _on_recommender_agent_error(self, agent, msg): |
1004 | 234 | LOG.warn("Error while accessing the recommender agent for the " | 234 | LOG.warn("Error while accessing the recommender agent for the " |
1005 | 235 | "details view recommendations: %s" % msg) | 235 | "details view recommendations: %s" % msg) |
1006 | @@ -239,7 +239,7 @@ | |||
1007 | 239 | def _hide_app_recommendations_panel(self): | 239 | def _hide_app_recommendations_panel(self): |
1008 | 240 | # and hide the pane | 240 | # and hide the pane |
1009 | 241 | self.hide() | 241 | self.hide() |
1011 | 242 | 242 | ||
1012 | 243 | 243 | ||
1013 | 244 | # test helpers | 244 | # test helpers |
1014 | 245 | def get_test_window(): | 245 | def get_test_window(): |
1015 | @@ -247,7 +247,6 @@ | |||
1016 | 247 | softwarecenter.log.root.setLevel(level=logging.DEBUG) | 247 | softwarecenter.log.root.setLevel(level=logging.DEBUG) |
1017 | 248 | fmt = logging.Formatter("%(name)s - %(message)s", None) | 248 | fmt = logging.Formatter("%(name)s - %(message)s", None) |
1018 | 249 | softwarecenter.log.handler.setFormatter(fmt) | 249 | softwarecenter.log.handler.setFormatter(fmt) |
1019 | 250 | |||
1020 | 251 | 250 | ||
1021 | 252 | # this is *way* to complicated we should *not* need a CatView | 251 | # this is *way* to complicated we should *not* need a CatView |
1022 | 253 | # here! see FIXME in RecommendationsPanel.__init__() | 252 | # here! see FIXME in RecommendationsPanel.__init__() |
1023 | @@ -259,7 +258,7 @@ | |||
1024 | 259 | icons = get_test_gtk3_icon_cache() | 258 | icons = get_test_gtk3_icon_cache() |
1025 | 260 | catview = CategoriesViewGtk(softwarecenter.paths.datadir, | 259 | catview = CategoriesViewGtk(softwarecenter.paths.datadir, |
1026 | 261 | softwarecenter.paths.APP_INSTALL_PATH, | 260 | softwarecenter.paths.APP_INSTALL_PATH, |
1028 | 262 | cache, | 261 | cache, |
1029 | 263 | db, | 262 | db, |
1030 | 264 | icons) | 263 | icons) |
1031 | 265 | 264 | ||
1032 | @@ -271,9 +270,9 @@ | |||
1033 | 271 | win.set_data("rec_panel", view) | 270 | win.set_data("rec_panel", view) |
1034 | 272 | win.set_size_request(600, 200) | 271 | win.set_size_request(600, 200) |
1035 | 273 | win.show_all() | 272 | win.show_all() |
1037 | 274 | 273 | ||
1038 | 275 | return win | 274 | return win |
1040 | 276 | 275 | ||
1041 | 277 | 276 | ||
1042 | 278 | if __name__ == "__main__": | 277 | if __name__ == "__main__": |
1043 | 279 | win = get_test_window() | 278 | win = get_test_window() |
1044 | 280 | 279 | ||
1045 | === modified file 'test/test_pep8.py' | |||
1046 | --- test/test_pep8.py 2012-03-08 22:33:18 +0000 | |||
1047 | +++ test/test_pep8.py 2012-03-09 13:04:23 +0000 | |||
1048 | @@ -16,8 +16,7 @@ | |||
1049 | 16 | packages = [softwarecenter.ui.qml, | 16 | packages = [softwarecenter.ui.qml, |
1050 | 17 | softwarecenter.ui.gtk3.widgets, | 17 | softwarecenter.ui.gtk3.widgets, |
1051 | 18 | softwarecenter.db.pkginfo_impl] | 18 | softwarecenter.db.pkginfo_impl] |
1054 | 19 | exclude = ['recommendations.py', 'oneconfviews.py', 'menubutton.py', | 19 | exclude = ['description.py', |
1053 | 20 | 'labels.py', 'imagedialog.py', 'exhibits.py', 'description.py', | ||
1055 | 21 | 'containers.py', 'cellrenderers.py', 'buttons.py', 'backforward.py', | 20 | 'containers.py', 'cellrenderers.py', 'buttons.py', 'backforward.py', |
1056 | 22 | 'apptreeview.py', 'animatedimage.py', 'actionbar.py'] | 21 | 'apptreeview.py', 'animatedimage.py', 'actionbar.py'] |
1057 | 23 | 22 |
Thank you, Anthony!!