From 4a984f3c43141ffd1168d8f0fdd5a392f30fa590 Mon Sep 17 00:00:00 2001 From: James Teh Date: Mon, 13 Feb 2012 09:43:32 +1000 Subject: [PATCH] Dialog behavior: Cache isPresentableFocusAncestor permanently once it has been fetched, as it is very slow due to getDialogText and the answer shouldn't change anyway. Improves performance when switching between browse and focus modes with braille enabled. --- source/NVDAObjects/behaviors.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/NVDAObjects/behaviors.py b/source/NVDAObjects/behaviors.py index 643547643..8d71ab559 100755 --- a/source/NVDAObjects/behaviors.py +++ b/source/NVDAObjects/behaviors.py @@ -129,6 +129,12 @@ class Dialog(NVDAObject): value = None + def _get_isPresentableFocusAncestor(self): + # Only fetch this the first time it is requested, + # as it is very slow due to getDialogText and the answer shouldn't change anyway. + self.isPresentableFocusAncestor = res = super(Dialog, self).isPresentableFocusAncestor + return res + class EditableText(editableText.EditableText, NVDAObject): """Provides scripts to report appropriately when moving the caret in editable text fields. This does not handle selection changes. -- 2.11.0