orca r4240 - in branches/phase2: . src/orca



Author: wwalker
Date: Thu Sep 18 13:38:15 2008
New Revision: 4240
URL: http://svn.gnome.org/viewvc/orca?rev=4240&view=rev

Log:
Fixup logging a little bit.  Also fix up how plugins find their settings.


Modified:
   branches/phase2/logging.conf
   branches/phase2/src/orca/braille.py
   branches/phase2/src/orca/orca.py
   branches/phase2/src/orca/plugin.py
   branches/phase2/src/orca/script.py
   branches/phase2/src/orca/script_manager.py
   branches/phase2/src/orca/utils.py

Modified: branches/phase2/logging.conf
==============================================================================
--- branches/phase2/logging.conf	(original)
+++ branches/phase2/logging.conf	Thu Sep 18 13:38:15 2008
@@ -7,27 +7,53 @@
 ########################################################################
 
 [loggers]
-keys: root,orca
-#keys: root,orca,script_manager,braille
+keys: root,utils,orca,script_manager,script,plugin,braille
 
 [logger_root]
-level: DEBUG
+level: NOTSET
+handlers: file
+
+[logger_utils]
+level: INFO
 handlers: file
+qualname: orca.utils
+propagate: 0
+parent: root
 
 [logger_orca]
-level: DEBUG
+level: INFO
 handlers: file
 qualname: orca.orca
+propagate: 0
+parent: root
 
 [logger_script_manager]
-level: DEBUG
+level: INFO
 handlers: file
 qualname: orca.script_manager
+propagate: 0
+parent: root
+
+[logger_script]
+level: INFO
+handlers: file
+qualname: orca.script
+propagate: 0
+parent: root
+
+[logger_plugin]
+level: INFO
+handlers: file
+qualname: orca.plugin
+propagate: 0
+parent: root
 
 [logger_braille]
 level: DEBUG
 handlers: file
 qualname: orca.braille
+propagate: 0
+parent: root
 
 ########################################################################
 #                                                                      #

Modified: branches/phase2/src/orca/braille.py
==============================================================================
--- branches/phase2/src/orca/braille.py	(original)
+++ branches/phase2/src/orca/braille.py	Thu Sep 18 13:38:15 2008
@@ -169,7 +169,7 @@
     Arguments:
     - event: the BrlAPI input event (expanded keycode)
     """
-    log.debug("input event: %s" % event)
+    log.info("input event: %s" % event)
     consumed = False
     if _callback:
         try:
@@ -257,6 +257,9 @@
         _brlAPISourceId = gobject.io_add_watch(_brlAPI.fileDescriptor,
                                                gobject.IO_IN,
                                                _brlAPIKeyReader)
+    except brlapi.ConnectionError, detail:
+        log.info("could not connect to brltty -- %s" % detail)
+        return False
     except:
         log.exception("handled exception while initializing brltty:")
         return False

Modified: branches/phase2/src/orca/orca.py
==============================================================================
--- branches/phase2/src/orca/orca.py	(original)
+++ branches/phase2/src/orca/orca.py	Thu Sep 18 13:38:15 2008
@@ -198,18 +198,17 @@
         try:
             reload(_userSettings)
         except:
-            log.exception("exception handled while importing user settings:")
+            log.exception("exception handled while reloading user_settings:")
     else:
         try:
             _userSettings = __import__("user_settings")
+            return _userSettings.getSettings(defaultSettings)
+        except ImportError:
+            log.debug("user_settings not found (this is OK).")
         except:
-            log.exception("exception handled while importing user settings:")
+            log.exception("exception handled while importing user_settings:")
 
-    try:
-        return _userSettings.getSettings(defaultSettings)
-    except:
-        log.exception("exception handled while getting user settings:")
-        return settings.Settings(defaultSettings)
+    return settings.Settings(defaultSettings)
 
 def _start(commandLineSettings):
     """Starts Orca.

Modified: branches/phase2/src/orca/plugin.py
==============================================================================
--- branches/phase2/src/orca/plugin.py	(original)
+++ branches/phase2/src/orca/plugin.py	Thu Sep 18 13:38:15 2008
@@ -46,9 +46,10 @@
         """Get the name of the module that would hold the user
 	settings for this plugin.
         """
-        name = self._script.getSettingsModuleName().strip(".settings.py")
+        name = self._script.getSettingsModuleName()
+        name = name[0:name.rfind(".settings")]
         if name and len(name):
-            name += __name__.strip("orca") + ".settings.py"
+            name = name + __name__.strip("orca") + ".settings"
         return name
 
     def _completeInit(self):

Modified: branches/phase2/src/orca/script.py
==============================================================================
--- branches/phase2/src/orca/script.py	(original)
+++ branches/phase2/src/orca/script.py	Thu Sep 18 13:38:15 2008
@@ -117,7 +117,7 @@
         name = script_manager.ScriptManager.getScriptModuleName(
             self.application)
         if name and len(name):
-            name = "script_settings." + name + ".settings.py"
+            name = "script_settings." + name + ".settings"
         return name
 
     def _loadSettings(self, userSettings):
@@ -161,7 +161,7 @@
     def _completeInit(self):
         """Completes the __init__ step.
         """
-        log.debug("NEW SCRIPT: %s" % self)
+        log.info("NEW SCRIPT: %s" % self)
 
     def __str__(self):
         """Returns a human readable representation of the script.
@@ -356,7 +356,7 @@
         # Check to see if we really want to process this event.
         #
         if not (self._isActive or self.presentIfInactive):
-            log.debug("not processing event because script is not active")
+            log.info("not processing event because %s is not active" % self)
             return
 
         # This calls the first listener it finds whose key *begins with* or is

Modified: branches/phase2/src/orca/script_manager.py
==============================================================================
--- branches/phase2/src/orca/script_manager.py	(original)
+++ branches/phase2/src/orca/script_manager.py	Thu Sep 18 13:38:15 2008
@@ -177,8 +177,8 @@
             regExpression = mapping[0]
             moduleName = mapping[1]
             if regExpression.match(application.name):
-                log.debug("script mapping for %s is %s"
-                          % (application.name, moduleName))
+                log.info("script mapping for %s is %s"
+                         % (application.name, moduleName))
                 name = moduleName
                 break
 
@@ -319,6 +319,11 @@
         Arguments:
         - newScript: the new script to be made active.
         """
+        if newScript == self._activeScript:
+            log.info("ACTIVE SCRIPT: %s (reason=%s)"
+                     % (self._activeScript, reason))
+            return
+
         if self._activeScript:
             self._activeScript.deactivate()
 
@@ -327,8 +332,8 @@
         if self._activeScript:
             self._activeScript.activate()
 
-        log.debug("ACTIVE SCRIPT: %s (reason=%s)"
-                  % (self._activeScript, reason))
+        log.info("ACTIVE SCRIPT: %s (reason=%s)"
+                 % (self._activeScript, reason))
 
     ########################################################################
     #                                                                      #
@@ -518,7 +523,7 @@
         #
         try:
             if event.source.getState().contains(pyatspi.STATE_DEFUNCT):
-                log.debug("IGNORING DEFUNCT OBJECT")
+                log.info("IGNORING DEFUNCT OBJECT")
                 return
         except:
             log.exception("handled exception while checking for defunct:")
@@ -667,7 +672,7 @@
             #            
             event = e
             if not event.source:
-                log.debug("---------> IGNORING INVALID EVENT %s" % e.type)
+                log.warning("IGNORING INVALID EVENT %s" % e.type)
 
             # Some toolkits (e.g., Java - see bug #531869) need to
             # have their events processed immediately.
@@ -696,14 +701,14 @@
         try:
             event = self._eventQueue.get_nowait()
             log.debug("DEQUEUED %s\n" % str(event).replace("\n"," "))
-            log.debug("vvvvv PROCESS %s vvvvv" % str(event).replace("\n"," "))
+            log.info("vvvvv PROCESS %s vvvvv" % str(event).replace("\n"," "))
             if isinstance(event, input_event.KeyboardEvent):
                 self._dispatchKeyboardEvent(event)
             elif isinstance(event, input_event.BrailleEvent):
                 self._dispatchBrailleEvent(event)
             else:
                 self._processObjectEvent(event)
-            log.debug("^^^^^ PROCESS %s ^^^^^\n" % str(event).replace("\n"," "))
+            log.info("^^^^^ PROCESS %s ^^^^^\n" % str(event).replace("\n"," "))
         except Queue.Empty:
             rerun = False
         except:

Modified: branches/phase2/src/orca/utils.py
==============================================================================
--- branches/phase2/src/orca/utils.py	(original)
+++ branches/phase2/src/orca/utils.py	Thu Sep 18 13:38:15 2008
@@ -159,14 +159,14 @@
     #
     # pylint: disable-msg=W0212
     #
-    log.debug("aborting with exit code %d" % exitCode)
+    log.critical("aborting with exit code %d" % exitCode)
     os._exit(exitCode)
 
 shutdown = None
 def shutdownOnSignal(signum, frame):
     """Shuts down (gracefully if possible) when we get a given signal.
     """
-    log.debug("shutting down and exiting due to signal = %d" % signum)
+    log.info("shutting down and exiting due to signal = %d" % signum)
 
     # We know shutdown may not be callable (i.e., it might be None),
     # so we trap for it in a try/except clause.
@@ -181,7 +181,7 @@
 def abortOnSignal(signum, frame):
     """Aborts quickly when we get a given signal.
     """
-    log.debug("aborting due to signal = %d" % signum)
+    log.critical("aborting due to signal = %d" % signum)
     abort(signum)
 
 def timeout(signum=None, frame=None):



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