[orca] Fix for bgo#591282 - add a switch to activate debug when executing orca
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [orca] Fix for bgo#591282 - add a switch to activate debug when executing orca
- Date: Tue, 18 Aug 2009 18:02:43 +0000 (UTC)
commit cfb7835f4cf29c6daede0002e4b0eee98d70c387
Author: Willie Walker <william walker sun com>
Date: Mon Aug 17 17:46:47 2009 -0400
Fix for bgo#591282 - add a switch to activate debug when executing orca
docs/man/orca.1 | 13 +++++++++++++
src/orca/orca.py | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 0 deletions(-)
---
diff --git a/docs/man/orca.1 b/docs/man/orca.1
index 1977270..42254d8 100644
--- a/docs/man/orca.1
+++ b/docs/man/orca.1
@@ -104,6 +104,19 @@ listed twice: once for the existing
.B orca
and once for this instance.
.TP
+.B \--debug
+Enables debug output for
+.B orca
+and sends all debug output to a file with a name of the
+form 'debug-YYYY-MM-DD-HH:MM:SS.out' in the current directory.
+The YYYY-MM-DD-HH:MM:SS portion will be replaced with the current
+date and time.
+.TP
+.B \--debug-file=filename
+Enables debug output for
+.B orca
+and sends all debug output to the given filename.
+.TP
.B \-v, --version
Return the
.B orca
diff --git a/src/orca/orca.py b/src/orca/orca.py
index ac300e4..b185c17 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -99,6 +99,15 @@ _userSettings = None
#
_commandLineSettings = {}
+# True if --debug is used on the command line.
+#
+_debugSwitch = False
+
+# Filename of the debug file to use if --debug or --debug-file is
+# used on the command line.
+#
+_debugFile = None
+
########################################################################
# #
# METHODS FOR HANDLING PRESENTATION MANAGERS #
@@ -991,6 +1000,10 @@ def loadUserSettings(script=None, inputEvent=None):
else:
try:
_userSettings = __import__("user-settings")
+ if _debugSwitch:
+ debug.debugLevel = debug.LEVEL_ALL
+ debug.eventDebugLevel = debug.LEVEL_OFF
+ debug.debugFile = open(_debugFile, 'w', 0)
except ImportError:
debug.printException(debug.LEVEL_FINEST)
except:
@@ -1436,6 +1449,24 @@ def usage():
print "-l, --list-apps " + \
_("Print the known running applications")
+ # Translators: this enables debug output for Orca. The
+ # YYYY-MM-DD-HH:MM:SS portion is a shorthand way of saying that
+ # the file name will be formed from the current date and time with
+ # 'debug' in front and '.out' at the end. The 'debug' and '.out'
+ # portions of this string should not be translated (i.e., it will
+ # always start with 'debug' and end with '.out', regardless of the
+ # locale.).
+ #
+ print "--debug " + \
+ _("Send debug output to debug-YYYY-MM-DD-HH:MM:SS.out")
+
+ # Translators: this enables debug output for Orca and overrides
+ # the name of the debug file Orca will use for debug output if the
+ # --debug option is used.
+ #
+ print "--debug-file=filename " + \
+ _("Send debug output to the specified file")
+
# Translators: this is the description of the command line option
# '-s, --setup, --gui-setup' that will initially display a GUI dialog
# that would allow the user to set their Orca preferences.
@@ -1528,6 +1559,9 @@ def main():
an exit code of 0 means normal completion and an exit code of 50
means Orca exited because of a hang."""
+ global _debugSwitch
+ global _debugFile
+
# Method to call when we think something might be hung.
#
settings.timeoutCallback = timeout
@@ -1593,6 +1627,8 @@ def main():
"text-setup",
"no-setup",
"list-apps",
+ "debug",
+ "debug-file=",
"version"])
for opt, val in opts:
if opt in ("-u", "--user-prefs-dir"):
@@ -1650,6 +1686,13 @@ def main():
if opt in ("-v", "--version"):
print "Orca %s" % platform.version
die(0)
+ if opt == "--debug":
+ _debugSwitch = True
+ if not _debugFile:
+ _debugFile = time.strftime('debug-%Y-%m-%d-%H:%M:%S.out')
+ if opt == "--debug-file":
+ _debugSwitch = True
+ _debugFile = val.strip()
if opt in ("-l", "--list-apps"):
apps = filter(lambda x: x is not None,
pyatspi.Registry.getDesktop(0))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]