~ubuntu-branches/ubuntu/quantal/xdiagnose/quantal-proposed

« back to all changes in this revision

Viewing changes to xdiagnose/diagnostics.py

  • Committer: Package Import Robot
  • Author(s): Bryce Harrington, Oliver Grawert, Bryce Harrington
  • Date: 2012-06-14 11:00:23 UTC
  • Revision ID: package-import@ubuntu.com-20120614110023-bfhyrabe6p62p63w
Tags: 2.7
[ Oliver Grawert ]
* port all program code to new python3 conventions
* adjust shebang lines for all python scripts to use python3
* update debian/rules and control for python3 support
* remove unused debian/pycompat file
* switch test suite to python3
* make test suite skip testing of directories
* add dependency on python3-apport
* make launchpadlib usage optional until it is ported to python3
* adjust apport-gpu-error-intel.py for new apport API
* xdiagnose/applet.py fix string handling of subprocess.Popen
* fixes (LP: #1013171)

[ Bryce Harrington ]
* Add a couple preliminary edid tools
* Fix apt_install to not use chroots
* Install general.lib
* Don't show xdiagnose in the menu (LP: #994048)
* Build depend on both py2 and py3 versions of distutils-extra, required by dh_auto_clean 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
 
1
#!/usr/bin/python3
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# Copyright (C) 2010 Bryce Harrington <bryce@ubuntu.com>
22
22
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
23
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
 
25
from __future__ import absolute_import, print_function, unicode_literals
25
26
 
26
27
class Diagnostic:
27
28
    def __init__(self):
36
37
    def backup_xorg_conf(self):
37
38
        # xorg_conf_backup="/etc/X11/xorg.conf-backup-${timestamp}"
38
39
        # cp /etc/X11/xorg.conf ${xorg_conf_backup}
39
 
        print "Your config could not be backed up."
 
40
        print("Your config could not be backed up.")
40
41
        return False
41
42
 
42
43
    def default_config(self):
46
47
        # rm /etc/X11/xorg.conf
47
48
        #print "Failure restoring configuration to default."
48
49
        #print "Your config has not been changed."
49
 
        print "Your configuration has been restored to default and"
50
 
        print "your old configuration backed up.  Please restart."
 
50
        print("Your configuration has been restored to default and")
 
51
        print("your old configuration backed up.  Please restart.")
51
52
        return True
52
53
 
53
54
    def run_xorgconf(self):
55
56
            return False
56
57
 
57
58
        # Xorg :99 -configure
58
 
        print "Could not generate a new configuration"
 
59
        print("Could not generate a new configuration")
59
60
        return False
60
61
 
61
62
    def view_xorg_log(self):
68
69
 
69
70
    def verify_xorgconf(self):
70
71
        # Run Alberto's xorg.conf checker (once it's available in main)
71
 
        print "Sorry, this option is not implemented yet"
 
72
        print("Sorry, this option is not implemented yet")
72
73
        return False
73
74
 
74
75
    def edit_config(self):
117
118
 
118
119
    def menu(self, level):
119
120
        if level == "0":
120
 
            print "Choice:"
121
 
            print "1. Run in low-graphics mode for just one session"
122
 
            print "2. Reconfigure graphics"
123
 
            print "3. Troubleshoot the error"
124
 
            print "4. Exit to console login"
 
121
            print("Choice:")
 
122
            print("1. Run in low-graphics mode for just one session")
 
123
            print("2. Reconfigure graphics")
 
124
            print("3. Troubleshoot the error")
 
125
            print("4. Exit to console login")
125
126
 
126
127
        elif level == "1":
127
128
            pass
128
129
 
129
130
        elif level == "2":
130
 
            print "Reconfiguration:"
131
 
            print "How would you like to reconfigure your display?"
132
 
            print "2a. Use default (generic) configuration"
133
 
            print "2b. Create new configuration for this hardware"
134
 
            print "2c. Use your backed-up configuration"
 
131
            print("Reconfiguration:")
 
132
            print("How would you like to reconfigure your display?")
 
133
            print("2a. Use default (generic) configuration")
 
134
            print("2b. Create new configuration for this hardware")
 
135
            print("2c. Use your backed-up configuration")
135
136
 
136
137
        elif level == "3":
137
 
            print "Troubleshooting:"
138
 
            print "What information would you like to review?"
139
 
            print "3a. Review the xserver log file"
140
 
            print "3b. Review the startup errors"
141
 
            print "3c. Edit configuration file"
142
 
            print "3d. Archive configuration and logs"
 
138
            print("Troubleshooting:")
 
139
            print("What information would you like to review?")
 
140
            print("3a. Review the xserver log file")
 
141
            print("3b. Review the startup errors")
 
142
            print("3c. Edit configuration file")
 
143
            print("3d. Archive configuration and logs")
143
144
 
144
145
        else:
145
 
            print "xdiagnose walks you through troubleshooting a few common X errors."
146
 
            print
147
 
            print " * Screen blanks when lid is closed, and never comes back"
148
 
            print " * 3D performance is horrible"
149
 
            print " * Maximum resolution is lower than what screen can actually perform"
 
146
            print("xdiagnose walks you through troubleshooting a few common X errors.")
 
147
            print()
 
148
            print(" * Screen blanks when lid is closed, and never comes back")
 
149
            print(" * 3D performance is horrible")
 
150
            print(" * Maximum resolution is lower than what screen can actually perform")
150
151
 
151
152
    def lid_close_blank(self):
152
153
        # Examine kernel logs to see if there was any evidence of it