[Nvda-dev] commit r2499 - in trunk: . source/appModules

NVDA Subversion svn at nvda-project.org
Thu Nov 13 11:13:00 UTC 2008


Author: bzr
Date: Thu Nov 13 11:12:59 2008
New Revision: 2499

Log:
Default appModule: fix a few exceptions in scripts that use the caret, such as moveToCaret, sayAll, reportFormatting.

Modified:
   trunk/   (props changed)
   trunk/source/appModules/_default.py

Modified: trunk/source/appModules/_default.py
==============================================================================
--- trunk/source/appModules/_default.py	(original)
+++ trunk/source/appModules/_default.py	Thu Nov 13 11:12:59 2008
@@ -67,7 +67,7 @@
 			obj=virtualBuffer
 		try:
 			info=obj.makeTextInfo(textHandler.POSITION_CARET)
-		except:
+		except NotImplementedError:
 			info=obj.makeTextInfo(textHandler.POSITION_FIRST)
 		info.expand(textHandler.UNIT_LINE)
 		if scriptHandler.getLastScriptRepeatCount()==0:
@@ -515,7 +515,11 @@
 	script_review_endOfLine.__doc__=_("Moves the review cursor to the last character of the line where it is situated in the current navigator object and speaks it")
 
 	def script_review_moveToCaret(self,keyPress):
-		info=api.getReviewPosition().obj.makeTextInfo(textHandler.POSITION_CARET)
+		try:
+			info=api.getReviewPosition().obj.makeTextInfo(textHandler.POSITION_CARET)
+		except NotImplementedError:
+				ui.message(_("No caret"))
+				return
 		api.setReviewPosition(info.copy())
 		info.expand(textHandler.UNIT_LINE)
 		speech.speakTextInfo(info)
@@ -577,7 +581,10 @@
 		else:
 			if hasattr(v,'TextInfo') and not v.passThrough:
 				o=v
-			info=o.makeTextInfo(textHandler.POSITION_CARET)
+			try:
+				info=o.makeTextInfo(textHandler.POSITION_CARET)
+			except NotImplementedError:
+				info=o.makeTextInfo(textHandler.POSITION_FIRST)
 			sayAllHandler.readText(info,sayAllHandler.CURSOR_CARET)
 	script_sayAll.__doc__ = _("reads from the system caret up to the end of the text, moving the caret as it goes")
 
@@ -590,7 +597,10 @@
 			"reportBlockQuotes":False,
 		}
 		o=api.getFocusObject()
-		info=o.makeTextInfo(textHandler.POSITION_CARET)
+		try:
+			info=o.makeTextInfo(textHandler.POSITION_CARET)
+		except NotImplementedError:
+			return
 		info.expand(textHandler.UNIT_CHARACTER)
 		formatField=textHandler.FormatField()
 		for field in info.getInitialFields(formatConfig):



More information about the Nvda-dev mailing list