~ubuntuone-control-tower/software-center/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright (C) 2012 Canonical
#
# Authors:
#  Michael Vogt
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; version 3.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

from gettext import gettext as _

TAG_DESCRIPTION = {
    'hardware::camera' : _('camera'),
    'hardware::input:mouse' : _('mouse'),
    'hardware::input:joystick' : _('joystick'),
    'hardware::input:touchscreen' : _('touchscreen'),
    'hardware::gps' : _('GPS'),
    'hardware::laptop' : _('notebook computer'),
    'hardware::printer': _('printer'),
    'hardware::scanner' : _('scanner'),
    'hardware::storage:cd' : _('CD drive'),
    'hardware::storage:cd-writer' : _('CD burner'),
    'hardware::storage:dvd' : _('DVD drive'),
    'hardware::storage:dvd-writer' : _('DVD burner'),
    'hardware::storage:floppy' : _('floppy disk drive'),
    'hardware::video:opengl' : _('OpenGL hardware acceleration'),

}

TAG_MISSING_DESCRIPTION = {
    'hardware::camera' : _('This software requires a camera, but none '
                           'are currently connected'),
    'hardware::input:mouse' : _('This software requires a mouse, '
                                'but none is currently setup.'),
    'hardware::input:joystick' : _('This software requires a joystick, '
                                   'but none are currently connected.'),
    'hardware::input:touchscreen' : _('This software requires a touchscreen, '
                                      'but the computer does not have one.'),
    'hardware::gps' : _('This software requires a GPS, '
                        'but the computer does not have one.'),
    'hardware::laptop' : _('This software is for notebook computers.'),
    'hardware::printer': _('This software requires a printer, but none '
                           'are currently set up.'),
    'hardware::scanner' : _('This software requires a scanner, but none are '
                            'currently set up.'),
    'hardware::stoarge:cd' : _('This software requires a CD drive, but none '
                               'are currently connected.'),
    'hardware::storage:cd-writer' : _('This software requires a CD burner, '
                                      'but none are currently connected.'),
    'hardware::storage:dvd' : _('This software requires a DVD drive, but none '
                                'are currently connected.'),
    'hardware::storage:dvd-writer' : _('This software requires a DVD burner, '
                                       'but none are currently connected.'),
    'hardware::storage:floppy' : _('This software requires a floppy disk '
                                   'drive, but none are currently connected.'),
    'hardware::video:opengl' : _('This computer does not have graphics fast '
                                 'enough for this software.'),
}

def get_hw_missing_long_description(tags):
    s = ""
    # build string
    for tag, supported in tags.iteritems():
        if supported == "no":
            s += "%s\n" % TAG_MISSING_DESCRIPTION.get(tag)
    # ensure that the last \n is gone
    if s:
        s = s[:-1]
    return s