[orca] Orca is now a single process rather than two. And there was much rejoicing. Yay.



commit bd83848a2df63126147ec39db65cc68e0cb8991b
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri May 11 13:20:46 2012 -0400

    Orca is now a single process rather than two. And there was much rejoicing. Yay.
    
    (Still cleaning up orca.py, however.)

 src/orca/orca.in |   63 +++++++++++++++++++++++++++++++++++------------------
 src/orca/orca.py |   37 ++-----------------------------
 2 files changed, 44 insertions(+), 56 deletions(-)
---
diff --git a/src/orca/orca.in b/src/orca/orca.in
index 97cb6db..a93cc53 100644
--- a/src/orca/orca.in
+++ b/src/orca/orca.in
@@ -1,8 +1,9 @@
-#!/bin/sh
+#! PYTHON@
 #
 # Orca
 #
-# Copyright 2006-2008 Sun Microsystems Inc.
+# Copyright 2010-2012 The Orca Team
+# Copyright 2012 Igalia, S.L.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -19,27 +20,45 @@
 # Free Software Foundation, Inc., Franklin Street, Fifth Floor,
 # Boston MA  02110-1301 USA.
 
-# __id__        = "$Id: orca.in,v 1.22 2006/12/08 16:21:25 wwalker Exp $"
-# __version__   = "$Revision: 1.22 $"
-# __date__      = "$Date: 2006/12/08 16:21:25 $"
-# __copyright__ = "Copyright (c) 2006-2008 Sun Microsystems Inc."
-# __license__   = "LGPL"
+__id__        = "$Id$"
+__version__   = "$Revision$"
+__date__      = "$Date$"
+__copyright__ = "Copyright (c) 2010-2012 The Orca Team" \
+                "Copyright (c) 2012 Igalia, S.L."
+__license__   = "LGPL"
 
-# Set the user's $PATH for this script.
-#
-PATH="${PATH} PLATFORM_PATH@"
-export PATH
+import sys
 
-# Save the arguments away.
-#
-ARGS="$*"
+def setProcessName():
+    """Attempts to set the process name to 'orca'."""
+
+    sys.argv[0] = 'orca'
+
+    # Disabling the import error of setproctitle.
+    # pylint: disable-msg=F0401
+    try:
+        from setproctitle import setproctitle
+    except ImportError:
+        pass
+    else:
+        setproctitle('orca')
+        return True
+
+    try:
+        from ctypes import cdll
+        libc = cdll.LoadLibrary('libc.so.6')
+        libc.prctl(15, 'orca', 0, 0, 0)
+        return True
+    except:
+        pass
+
+    return False   
+
+def main():
+    setProcessName()
 
-runOrca()
-{
-    exec_prefix= prefix@
-    PYTHONPATH=${PYTHONPATH}:@pyexecdir@
-    export PYTHONPATH
-    @PYTHON@ -c "import orca.orca; orca.orca.main()" "$ARGS"
-}
+    from orca import orca
+    return orca.main()
 
-runOrca
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 0c22e8a..3cb4776 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -45,13 +45,6 @@ try:
 except:
     a11yAppSettings = None
 
-# We're going to force the name of the app to "orca" so we
-# will end up showing us as "orca" to the AT-SPI.  If we don't
-# do this, the name can end up being "-c".  See bug 364452 at
-# http://bugzilla.gnome.org/show_bug.cgi?id=364452 for more
-# information.
-#
-sys.argv[0] = "orca"
 import pyatspi
 try:
     # This can fail due to gtk not being available.  We want to
@@ -383,7 +376,9 @@ parser.add_argument(
     #
     help = _("Replace a currently running Orca"))
 
-options, invalidOpts = parser.parse_known_args(sys.argv[1].split(),
+# temporary hack
+args = ''.join(sys.argv[1:])
+options, invalidOpts = parser.parse_known_args(args.split(),
                                                namespace = Options())
 options.validate()
 
@@ -1136,34 +1131,10 @@ def showSplashGUI(script=None, inputEvent=None):
 
     return True
 
-
 # If True, this module has been initialized.
 #
 _initialized = False
 
-def setProcessName():
-    """Attempts to set the process name to 'orca'."""
-
-    # Disabling the import error of setproctitle.
-    # pylint: disable-msg=F0401
-    try:
-        from setproctitle import setproctitle
-    except ImportError:
-        pass
-    else:
-        setproctitle('orca')
-        return True
-
-    try:
-        from ctypes import cdll
-        libc = cdll.LoadLibrary('libc.so.6')
-        libc.prctl(15, 'orca', 0, 0, 0)
-        return True
-    except:
-        pass
-
-    return False
-
 def init(registry):
     """Initialize the orca module, which initializes the speech and braille
     modules.  Also builds up the application list, registers for AT-SPI events,
@@ -1212,8 +1183,6 @@ def start(registry):
     if not _initialized:
         init(registry)
 
-    setProcessName()
-
     # Do not hang on startup if we can help it.
     #
     if settings.timeoutCallback and (settings.timeoutTime > 0):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]