~gary-lasker/software-center/pyflakes-fixes

« back to all changes in this revision

Viewing changes to softwarecenter/ui/gtk3/models/appstore2.py

  • Committer: Michael Vogt
  • Date: 2011-08-25 18:51:39 UTC
  • mfrom: (2210.1.4 tweaks)
  • Revision ID: michael.vogt@ubuntu.com-20110825185139-9xak91a5jwl2h0mp
merged from lp:~kiwinote/software-center/tweaks  plus a small pyflake fix

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
1
2
# Copyright (C) 2009,2010 Canonical
2
3
#
3
4
# Authors:
186
187
        return -1
187
188
 
188
189
    def get_categories(self, doc):
189
 
        categories = doc.get_value(XapianValues.CATEGORIES)
190
 
        # FIXME: transform this into something useful that can also be
191
 
        #        translated, currently it will be something like 
192
 
        #        "System;Settings"
193
 
        return categories
194
 
 
 
190
        categories = doc.get_value(XapianValues.CATEGORIES).split(';') or []
 
191
        if categories and categories[0] == 'SC_CATEGORY':
 
192
            return _(categories[-1])
 
193
        from softwarecenter.db.categories import category_subcat, category_cat
 
194
        for key in category_subcat:
 
195
            if key in categories:
 
196
                return _(category_subcat[key].split(';')[1])
 
197
        for key in category_cat:
 
198
            if key in categories:
 
199
                return _(category_cat[key])
 
200
        if categories:
 
201
            return _('System')
 
202
        else:
 
203
            return ''
195
204
 
196
205
class AppPropertiesHelper(_AppPropertiesHelper):
197
206