~ctf/checkbox/bug811177

« back to all changes in this revision

Viewing changes to scripts/resolution_question

  • Committer: Marc Tardif
  • Date: 2007-10-04 23:12:10 UTC
  • Revision ID: marc.tardif@canonical.com-20071004231210-unxckndkgndxfdp6
Refactored questions to use templates and scripts which fixes bug #149195.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
import os
 
4
 
 
5
 
 
6
ati_brain_damage = []
 
7
command = 'xrandr -q'
 
8
for item in os.popen('lsmod | grep fglrx'):
 
9
    ati_brain_damage.append(item)
 
10
 
 
11
if len(ati_brain_damage):
 
12
    resolution = "impossible with fglrx"
 
13
else:
 
14
    resolution = None
 
15
    res, freq = None, None
 
16
    contents = os.popen(command).read()
 
17
    for line in contents.splitlines():
 
18
        line = line.strip()
 
19
        if line.endswith("*"):
 
20
            # gutsy
 
21
            fields = line.replace("*", "").split()
 
22
            if len(fields) == 2:
 
23
                res, freq = fields
 
24
            else:
 
25
                res, freq = fields[0], "N/A"
 
26
            break
 
27
        elif line.startswith("*"):
 
28
            # dapper
 
29
            fields = line.replace("*", "").split('  ')
 
30
            res = fields[1].replace(" ", "")
 
31
            if len(fields) < 4:
 
32
                freq = "N/A"
 
33
            else:
 
34
                freq = fields[4]
 
35
            break
 
36
 
 
37
    if res:
 
38
        resolution = "%s @ %d Hz" % (res, float(freq))
 
39
 
 
40
print resolution