~ubuntu-branches/ubuntu/raring/software-center/raring-proposed

« back to all changes in this revision

Viewing changes to softwarecenter/ui/gtk3/views/catview.py

  • Committer: Package Import Robot
  • Author(s): Michael Vogt
  • Date: 2012-12-06 17:30:50 UTC
  • Revision ID: package-import@ubuntu.com-20121206173050-n7mxi5fzlsvtdh9l
Tags: 5.5.2
* lp:~mvo/software-center/fix-pygobject-deprecation-warnings:
  - fix deprecation warninings with the latest python-gi
* lp:~mvo/software-center/minor-logging-fixes:
  - drop some LOG.info() messages to LOG.debug() to spam the user
    less
* lp:~mvo/software-center/trivial-close-ui-tweak:
  - hide the main window immediately when closing down
* lp:~mvo/software-center/5.4-fix-save-person-to-config:
  - This branch ensures that the "username" is saved everytime
    that the ubuntu sso whoami call is done
* lp:~mvo/software-center/use-dpkg-builddeps:
  - use dpkg-checkbuilddeps to find test-dependencies
* lp:~mvo/software-center/update-sc-cmdline-flexibility:
  - update-software-center-agent: 
    + add --target-db-path commandline
  - update-software-center: 
    + add --app-install-desktop-dir and --target-db-path commandline
* lp:~mvo/software-center/raring-pep8:
  - fixes for new pep8

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import cairo
21
21
import gettext
22
 
from gi.repository import Gtk, GObject
 
22
from gi.repository import Gtk, GObject, GLib
23
23
import logging
24
24
import os
25
25
import xapian
36
36
from softwarecenter.ui.gtk3.models.appstore2 import AppPropertiesHelper
37
37
from softwarecenter.ui.gtk3.widgets.viewport import Viewport
38
38
from softwarecenter.ui.gtk3.widgets.containers import (
39
 
                                        FramedHeaderBox,
40
 
                                        FramedBox,
41
 
                                        TileGrid)
 
39
    FramedHeaderBox,
 
40
    FramedBox,
 
41
    TileGrid)
42
42
from softwarecenter.ui.gtk3.widgets.recommendations import (
43
 
                                        RecommendationsPanelCategory)
 
43
    RecommendationsPanelCategory)
44
44
from softwarecenter.ui.gtk3.widgets.buttons import CategoryTile
45
45
from softwarecenter.ui.gtk3.em import StockEms
46
46
from softwarecenter.db.appfilter import AppFilter, get_global_filter
47
47
from softwarecenter.db.enquire import AppEnquire
48
 
from softwarecenter.db.categories import (Category,
49
 
                                          categories_sorted_by_name)
 
48
from softwarecenter.db.categories import (
 
49
    Category,
 
50
    categories_sorted_by_name)
50
51
from softwarecenter.distro import get_distro
51
52
 
52
53
LOG = logging.getLogger(__name__)
61
62
        "category-selected": (GObject.SignalFlags.RUN_LAST,
62
63
                              None,
63
64
                              (GObject.TYPE_PYOBJECT, ),
64
 
                             ),
 
65
                              ),
65
66
 
66
67
        "application-activated": (GObject.SignalFlags.RUN_LAST,
67
68
                                  None,
68
69
                                  (GObject.TYPE_PYOBJECT, ),
69
 
                                 ),
 
70
                                  ),
70
71
 
71
72
        "show-category-applist": (GObject.SignalFlags.RUN_LAST,
72
73
                                  None,
73
74
                                  (),)
74
 
        }
 
75
    }
75
76
 
76
77
    SPACING = PADDING = 3
77
78
 
161
162
            self.emit("application-activated", app)
162
163
            return False
163
164
 
164
 
        GObject.timeout_add(50, timeout_emit)
 
165
        GLib.timeout_add(50, timeout_emit)
165
166
 
166
167
    def on_category_clicked(self, btn, cat):
167
168
        """emit the category-selected signal when a category was clicked"""
169
170
            self.emit("category-selected", cat)
170
171
            return False
171
172
 
172
 
        GObject.timeout_add(50, timeout_emit)
 
173
        GLib.timeout_add(50, timeout_emit)
173
174
 
174
175
    def do_draw(self, cr):
175
176
        cr.save()
230
231
        # TRANSLATORS: %s is a category name, like Internet or Development
231
232
        # Tools
232
233
        m = _('Top Rated %(category)s') % {
233
 
            'category': GObject.markup_escape_text(self.header)}
 
234
            'category': GLib.markup_escape_text(self.header)}
234
235
        self.top_rated_frame.set_header_label(m)
235
236
        docs = self._get_sub_top_rated_content(category)
236
237
        self.top_rated.add_tiles(self.properties_helper,
277
278
 
278
279
        # set the subcat header
279
280
        m = "<b><big>%s</big></b>"
280
 
        self.subcat_label.set_markup(m % GObject.markup_escape_text(
 
281
        self.subcat_label.set_markup(m % GLib.markup_escape_text(
281
282
            self.header))
282
283
 
283
284
        # sort Category.name's alphabetically
311
312
        # append an additional button to show all of the items in the category
312
313
        all_cat = Category("All", _("All"), "category-show-all",
313
314
            category.query)
314
 
        name = GObject.markup_escape_text('%s %s' % (_("All"), num_items))
 
315
        name = GLib.markup_escape_text('%s %s' % (_("All"), num_items))
315
316
        tile = CategoryTile(name, "category-show-all")
316
317
        tile.connect('clicked', self.on_category_clicked, all_cat)
317
318
        self.departments.add_child(tile)
385
386
            self._build_subcat_view()
386
387
        self._update_subcat_view(root_category, num_items)
387
388
 
388
 
        GObject.idle_add(self.queue_draw)
 
389
        GLib.idle_add(self.queue_draw)
389
390
        return
390
391
 
391
392
    def refresh_apps(self):
398
399
        if not self._built:
399
400
            self._build_subcat_view()
400
401
        self._update_subcat_view(self.current_category)
401
 
        GObject.idle_add(self.queue_draw)
 
402
        GLib.idle_add(self.queue_draw)
402
403
        return