Skip to content

Commit

Permalink
remove ProgressBar while playing voice messages
Browse files Browse the repository at this point in the history
closes #1
  • Loading branch information
beqabeqa473 committed May 13, 2020
1 parent 0a7e6a0 commit 7c7153c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions addon/appModules/unigram.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit 7c7153c

Please sign in to comment.