19
19
from gettext import gettext as _
21
# private extension over the debtagshw stuff
22
OPENGL_DRIVER_BLACKLIST_TAG = "x-hardware::opengl-driver-blacklist:"
21
25
TAG_DESCRIPTION = {
22
'hardware::webcam' : _('webcam'),
23
'hardware::digicam' : _('digicam'),
24
'hardware::input:mouse' : _('mouse'),
25
'hardware::input:joystick' : _('joystick'),
26
'hardware::input:touchscreen' : _('touchscreen'),
27
'hardware::gps' : _('GPS'),
28
'hardware::laptop' : _('notebook computer'),
26
'hardware::webcam': _('webcam'),
27
'hardware::digicam': _('digicam'),
28
'hardware::input:mouse': _('mouse'),
29
'hardware::input:joystick': _('joystick'),
30
'hardware::input:touchscreen': _('touchscreen'),
31
'hardware::gps': _('GPS'),
32
'hardware::laptop': _('notebook computer'),
29
33
'hardware::printer': _('printer'),
30
'hardware::scanner' : _('scanner'),
31
'hardware::storage:cd' : _('CD drive'),
32
'hardware::storage:cd-writer' : _('CD burner'),
33
'hardware::storage:dvd' : _('DVD drive'),
34
'hardware::storage:dvd-writer' : _('DVD burner'),
35
'hardware::storage:floppy' : _('floppy disk drive'),
36
'hardware::video:opengl' : _('OpenGL hardware acceleration'),
34
'hardware::scanner': _('scanner'),
35
'hardware::storage:cd': _('CD drive'),
36
'hardware::storage:cd-writer': _('CD burner'),
37
'hardware::storage:dvd': _('DVD drive'),
38
'hardware::storage:dvd-writer': _('DVD burner'),
39
'hardware::storage:floppy': _('floppy disk drive'),
40
'hardware::video:opengl': _('OpenGL hardware acceleration'),
40
44
TAG_MISSING_DESCRIPTION = {
41
'hardware::digicam' : _('This software requires a digital camera, but none '
42
'are currently connected'),
43
'hardware::webcam' : _('This software requires a video camera, but none '
44
'are currently connected'),
45
'hardware::input:mouse' : _('This software requires a mouse, '
45
'hardware::digicam': _('This software requires a digital camera, but none '
46
'are currently connected'),
47
'hardware::webcam': _('This software requires a video camera, but none '
48
'are currently connected'),
49
'hardware::input:mouse': _('This software requires a mouse, '
46
50
'but none is currently setup.'),
47
'hardware::input:joystick' : _('This software requires a joystick, '
51
'hardware::input:joystick': _('This software requires a joystick, '
48
52
'but none are currently connected.'),
49
'hardware::input:touchscreen' : _('This software requires a touchscreen, '
53
'hardware::input:touchscreen': _('This software requires a touchscreen, '
50
54
'but the computer does not have one.'),
51
'hardware::gps' : _('This software requires a GPS, '
55
'hardware::gps': _('This software requires a GPS, '
52
56
'but the computer does not have one.'),
53
'hardware::laptop' : _('This software is for notebook computers.'),
57
'hardware::laptop': _('This software is for notebook computers.'),
54
58
'hardware::printer': _('This software requires a printer, but none '
55
59
'are currently set up.'),
56
'hardware::scanner' : _('This software requires a scanner, but none are '
60
'hardware::scanner': _('This software requires a scanner, but none are '
57
61
'currently set up.'),
58
'hardware::stoarge:cd' : _('This software requires a CD drive, but none '
62
'hardware::stoarge:cd': _('This software requires a CD drive, but none '
59
63
'are currently connected.'),
60
'hardware::storage:cd-writer' : _('This software requires a CD burner, '
64
'hardware::storage:cd-writer': _('This software requires a CD burner, '
61
65
'but none are currently connected.'),
62
'hardware::storage:dvd' : _('This software requires a DVD drive, but none '
66
'hardware::storage:dvd': _('This software requires a DVD drive, but none '
63
67
'are currently connected.'),
64
'hardware::storage:dvd-writer' : _('This software requires a DVD burner, '
68
'hardware::storage:dvd-writer': _('This software requires a DVD burner, '
65
69
'but none are currently connected.'),
66
'hardware::storage:floppy' : _('This software requires a floppy disk '
70
'hardware::storage:floppy': _('This software requires a floppy disk '
67
71
'drive, but none are currently connected.'),
68
'hardware::video:opengl' : _('This computer does not have graphics fast '
72
'hardware::video:opengl': _('This computer does not have graphics fast '
69
73
'enough for this software.'),
75
OPENGL_DRIVER_BLACKLIST_TAG: _('This computer uses a "%s" video driver, '
76
'but the application is not compatible '
80
def get_hw_short_description(tag):
81
s = TAG_DESCRIPTION.get(tag)
72
84
def get_hw_missing_long_description(tags):
75
87
for tag, supported in tags.iteritems():
76
88
if supported == "no":
77
s += "%s\n" % TAG_MISSING_DESCRIPTION.get(tag)
89
descr = TAG_MISSING_DESCRIPTION.get(tag)
93
# deal with generic tags
94
prefix, sep, postfix = tag.rpartition(":")
95
descr = TAG_MISSING_DESCRIPTION.get(prefix+sep)
96
descr = descr % postfix
78
99
# ensure that the last \n is gone
105
def get_private_extensions_hardware_support_for_tags(tags):
109
if tag.startswith(OPENGL_DRIVER_BLACKLIST_TAG):
110
prefix, sep, driver = tag.rpartition(":")
111
if driver == debtagshw.opengl.get_driver():
112
res[tag] = debtagshw.enums.HardwareSupported.NO
114
res[tag] = debtagshw.enums.HardwareSupported.YES
117
def get_hardware_support_for_tags(tags):
118
""" wrapper around the DebtagsAvailalbeHW to support adding our own
119
private tag extension (like opengl-driver)
121
from debtagshw.debtagshw import DebtagsAvailableHW
122
hw = DebtagsAvailableHW()
123
support = hw.get_hardware_support_for_tags(tags)
124
private_extensions = get_private_extensions_hardware_support_for_tags(
126
support.update(private_extensions)