orca r3844 - in trunk: . src/orca



Author: eitani
Date: Thu Apr 24 18:51:06 2008
New Revision: 3844
URL: http://svn.gnome.org/viewvc/orca?rev=3844&view=rev

Log:
* src/orca/mouse_review.py:
* src/orca/orca.py:
  Raise RuntimeError when no display is available in mouse_review,
  catch it in orca.py at import time.


Modified:
   trunk/ChangeLog
   trunk/src/orca/mouse_review.py
   trunk/src/orca/orca.py

Modified: trunk/src/orca/mouse_review.py
==============================================================================
--- trunk/src/orca/mouse_review.py	(original)
+++ trunk/src/orca/mouse_review.py	Thu Apr 24 18:51:06 2008
@@ -32,7 +32,6 @@
 import braille
 import gobject
 import settings
-import orca
 
 class BoundingBox:
     """A bounding box, currently it is used to test if a given point is
@@ -310,7 +309,10 @@
         return top_window[0]
 
 # Initialize a singleton reviewer.
-mouse_reviewer = MouseReviewer()
+if gtk.gdk.display_get_default():
+    mouse_reviewer = MouseReviewer()
+else:
+    raise RuntimeError('Cannot initialize mouse review, no display')
 
 def toggle(script=None, event=None):
     """

Modified: trunk/src/orca/orca.py
==============================================================================
--- trunk/src/orca/orca.py	(original)
+++ trunk/src/orca/orca.py	Thu Apr 24 18:51:06 2008
@@ -41,10 +41,15 @@
     # the desktop is not running.
     #
     import gtk
-    import mouse_review
 except:
     pass
 
+try:
+    # If we don't have an active desktop, we will get a RuntimeError.
+    import mouse_review
+except RuntimeError:
+    pass
+
 import getopt
 import gnome
 import os



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