From 7c7153cd2e3b6f75d204875fbd5d5c44f32d7f41 Mon Sep 17 00:00:00 2001 From: gozaltech Date: Wed, 13 May 2020 05:39:22 +0400 Subject: [PATCH] remove ProgressBar while playing voice messages closes #1 --- addon/appModules/unigram.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addon/appModules/unigram.py b/addon/appModules/unigram.py index 9df5f6e..8ea707c 100644 --- a/addon/appModules/unigram.py +++ b/addon/appModules/unigram.py @@ -8,14 +8,22 @@ import appModuleHandler import controlTypes from NVDAObjects.UIA import UIA +from NVDAObjects.behaviors import ProgressBar import re import tones import ui addonHandler.initTranslation() +duration = re.compile("^(?:(?:(\d+):)?(\d+):)?(\d+)$") + class AppModule(appModuleHandler.AppModule): + def chooseNVDAObjectOverlayClasses(self, obj, clsList): + if not isinstance(obj, UIA): return + if obj.UIAElement.CachedClassName == 'ProgressBar': #and duration.search(obj.next.name): + clsList.remove(ProgressBar) + def event_NVDAObject_init(self, obj): if not isinstance(obj, UIA): return try: @@ -25,12 +33,11 @@ def event_NVDAObject_init(self, obj): return if obj.role == controlTypes.ROLE_LISTITEM: if obj.parent.UIAElement.CurrentAutomationId == "Messages": - duration = re.compile("^(?:(?:(\d+):)?(\d+):)?(\d+)$") for child in obj.children: if child.UIAElement.CurrentAutomationId == "Subtitle" and duration.search(child.name): obj.name = f"{child.name} - {obj.name}" return - elif obj.parent.UIAElement.CurrentAutomationId == "ScrollingFiles" or obj.parent.UIAElement.CurrentAutomationId == "ScrollingLinks" or obj.parent.UIAElement.CurrentAutomationId == "ScrollingHost" or obj.parent.UIAElement.CurrentAutomationId == "ScrollingMedia" or obj.parent.UIAElement.CurrentAutomationId == "ScrollingMusic" or obj.parent.UIAElement.CurrentAutomationId == "ScrollingVoice" or obj.parent.UIAElement.CurrentAutomationId == "DialogsSearchListView" or obj.lastChild.UIAElement.CurrentAutomationId == "Label": + elif obj.parent.UIAElement.CurrentAutomationId == "ScrollingFiles" or obj.parent.UIAElement.CurrentAutomationId == "ScrollingLinks" or obj.parent.UIAElement.CurrentAutomationId == "ScrollingHost" or obj.parent.UIAElement.CurrentAutomationId == "ScrollingMedia" or obj.parent.UIAElement.CurrentAutomationId == "ScrollingMusic" or obj.parent.UIAElement.CurrentAutomationId == "ScrollingVoice" or obj.parent.UIAElement.CurrentAutomationId == "DialogsSearchListView" or obj.lastChild.UIAElement.CurrentAutomationId == "Label" or obj.parent.name == "System.Collections.Generic.List`1[Telegram.Td.Api.LanguagePackInfo]": name = [] for i in obj.children: name.append(i.name)