OSDN Git Service

Dialog behavior: Cache isPresentableFocusAncestor permanently once it has been fetche...
authorJames Teh <jamie@jantrid.net>
Sun, 12 Feb 2012 23:43:32 +0000 (09:43 +1000)
committerJames Teh <jamie@jantrid.net>
Sun, 12 Feb 2012 23:43:32 +0000 (09:43 +1000)
Improves performance when switching between browse and focus modes with braille enabled.

source/NVDAObjects/behaviors.py

index 6435476..8d71ab5 100755 (executable)
@@ -129,6 +129,12 @@ class Dialog(NVDAObject):
 \r
        value = None\r
 \r
+       def _get_isPresentableFocusAncestor(self):\r
+               # Only fetch this the first time it is requested,\r
+               # as it is very slow due to getDialogText and the answer shouldn't change anyway.\r
+               self.isPresentableFocusAncestor = res = super(Dialog, self).isPresentableFocusAncestor\r
+               return res\r
+\r
 class EditableText(editableText.EditableText, NVDAObject):\r
        """Provides scripts to report appropriately when moving the caret in editable text fields.\r
        This does not handle selection changes.\r