From 560b3d0611ff8b9d34f57623a87ec1677bcdb39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Golonka?= Date: Tue, 17 Sep 2019 11:53:57 +0200 Subject: [PATCH 1/3] port of pr 10153 into beta. --- source/appModules/explorer.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/source/appModules/explorer.py b/source/appModules/explorer.py index aeed7c4ead6..2e6ded95c75 100644 --- a/source/appModules/explorer.py +++ b/source/appModules/explorer.py @@ -14,6 +14,7 @@ import appModuleHandler import controlTypes import winUser +import winVersion import api import speech import eventHandler @@ -21,6 +22,7 @@ from NVDAObjects.window import Window from NVDAObjects.IAccessible import sysListView32, IAccessible, List from NVDAObjects.UIA import UIA +from NVDAObjects.window.edit import RichEdit50, EditTextInfo # Suppress incorrect Win 10 Task switching window focus class MultitaskingViewFrameWindow(UIA): @@ -189,6 +191,19 @@ def _get_windowText(self): return windowText.replace(CHAR_LTR_MARK,'').replace(CHAR_RTL_MARK,'') return windowText + +class MetadataEditField(RichEdit50): + """ Used for metadata edit fields in Windows Explorer in Windows 7. + By default these fields would use ITextDocumentTextInfo , + but to avoid Windows Explorer crashes we need to use EditTextInfo here. """ + @classmethod + def _get_TextInfo(cls): + if ((winVersion.winVersion.major, winVersion.winVersion.minor) == (6, 1)): + cls.TextInfo = EditTextInfo + else: + cls.TextInfo = super().TextInfo + return cls.TextInfo + class AppModule(appModuleHandler.AppModule): def chooseNVDAObjectOverlayClasses(self, obj, clsList): @@ -235,6 +250,10 @@ def chooseNVDAObjectOverlayClasses(self, obj, clsList): clsList.insert(0, StartButton) return # Optimization: return early to avoid comparing class names and roles that will never match. + if windowClass == 'RICHEDIT50W' and obj.windowControlID == 256: + clsList.insert(0, MetadataEditField) + return # Optimization: return early to avoid comparing class names and roles that will never match. + if isinstance(obj, UIA): uiaClassName = obj.UIAElement.cachedClassName if uiaClassName == "GridTileElement": From 1067ba8856351b576090e17e24a57dbeac90ebf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Golonka?= Date: Tue, 17 Sep 2019 13:39:26 +0200 Subject: [PATCH 2/3] Update source/appModules/explorer.py Co-Authored-By: Leonard de Ruijter --- source/appModules/explorer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/appModules/explorer.py b/source/appModules/explorer.py index 2e6ded95c75..915bb8e0716 100644 --- a/source/appModules/explorer.py +++ b/source/appModules/explorer.py @@ -201,7 +201,7 @@ def _get_TextInfo(cls): if ((winVersion.winVersion.major, winVersion.winVersion.minor) == (6, 1)): cls.TextInfo = EditTextInfo else: - cls.TextInfo = super().TextInfo + cls.TextInfo = super(MetadataEditField, self).TextInfo return cls.TextInfo class AppModule(appModuleHandler.AppModule): From af4631f5ad8e6c8cd585f86e10bc741dcebc22c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Golonka?= Date: Tue, 17 Sep 2019 14:23:28 +0200 Subject: [PATCH 3/3] Update source/appModules/explorer.py Co-Authored-By: Leonard de Ruijter --- source/appModules/explorer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/appModules/explorer.py b/source/appModules/explorer.py index 915bb8e0716..07dd8216c6a 100644 --- a/source/appModules/explorer.py +++ b/source/appModules/explorer.py @@ -201,7 +201,7 @@ def _get_TextInfo(cls): if ((winVersion.winVersion.major, winVersion.winVersion.minor) == (6, 1)): cls.TextInfo = EditTextInfo else: - cls.TextInfo = super(MetadataEditField, self).TextInfo + cls.TextInfo = super(MetadataEditField, cls).TextInfo return cls.TextInfo class AppModule(appModuleHandler.AppModule):