Hi, For those having issues with GoldWave app module, please try today's 3.0 snapshot to see if the markers are announced. Cheers, Joseph -----Original Message----- From: nvda-addons-commits-bounce@xxxxxxxxxxxxx [mailto:nvda-addons-commits-bounce@xxxxxxxxxxxxx] On Behalf Of commits-noreply@xxxxxxxxxxxxx Sent: Wednesday, December 31, 2014 10:40 AM To: nvda-addons-commits@xxxxxxxxxxxxx Subject: commit/goldwave: josephsl: Status bar cache (3.0-dev): let the app module cache the status bar objects themselves for faster lookup. 1 new commit in goldwave: https://bitbucket.org/nvdaaddonteam/goldwave/commits/0aba478824c2/ Changeset: 0aba478824c2 Branch: statusBarCache User: josephsl Date: 2014-12-31 18:39:23+00:00 Summary: Status bar cache (3.0-dev): let the app module cache the status bar objects themselves for faster lookup. This may fix issues when trying to locate start and finish markers, as well as allowing other commands to be added including remaining track. Affected #: 2 files diff --git a/addon/appModules/goldwave.py b/addon/appModules/goldwave.py index 86c52b1..929432f 100755 --- a/addon/appModules/goldwave.py +++ b/addon/appModules/goldwave.py @@ -8,7 +8,7 @@ import addonHandler import api import speech import braille -from controlTypes import ROLE_BUTTON, ROLE_DIALOG, ROLE_PANE, ROLE_GROUPING +from controlTypes import ROLE_BUTTON, ROLE_DIALOG, ROLE_PANE, +ROLE_GROUPING, ROLE_STATUSBAR addonHandler.initTranslation() from NVDAObjects.IAccessible import IAccessible import scriptHandler @@ -33,9 +33,8 @@ class SoundWindow(IAccessible): # Get audio positions. def getAudioPos(self): - # Above the status bar is the audio position and selection info bar. Fetch info from there via object navigation. - fg = api.getForegroundObject() - fgChild = fg.children[-3] + # Above the status bar is the audio position and selection info bar. See if this control can be fetched. + fgChild = self.appModule._get_statusBars(0) # Current cursor position. if not fgChild.displayText: fgChild.redraw() audioPos = fgChild.children[3].displayText.replace('\t', '') @@ -44,8 +43,7 @@ class SoundWindow(IAccessible): def getAudioSelection(self): # A method to get audio selection. Unlike audio position getter, this one requires display text, as info is not obj.name. - fg = api.getForegroundObject() - fgChild = fg.children[-3] + fgChild = self.appModule._get_statusBars(0) # Audio selection information. # What if fgChild returns empty string? (core ticket 3623/2892) If so, redraw (expensive; don't use this a lot). if not fgChild.displayText: fgChild.redraw() @@ -89,22 +87,19 @@ class SoundWindow(IAccessible): def getAudioChannels(self): # Based on the constants above and the return value below, get channel information. - fg = api.getForegroundObject() - fgChild = fg.children[-3] + fgChild = self.appModule._get_statusBars(0) if not fgChild.displayText: fgChild.redraw() audioChannels = fgChild.children[0].displayText return audioChannels def getTrackLength(self): - fg = api.getForegroundObject() - fgChild = fg.children[-3] + fgChild = self.appModule._get_statusBars(0) if not fgChild.displayText: fgChild.redraw() trackLength = fgChild.children[1].displayText return trackLength def getZoomLevel(self): - fg = api.getForegroundObject() - fgChild = fg.children[-2] + fgChild = self.appModule._get_statusBars(1) if not fgChild.displayText: fgChild.redraw() zoomLevel = fgChild.children[1].displayText return zoomLevel @@ -360,20 +355,27 @@ class AppModule(appModuleHandler.AppModule): if fieldNameObj.role == ROLE_PANE and fieldNameObj.name: obj.name = fieldNameObj.name if not obj.name else fieldNameObj.name + " " + obj.name - - def chooseNVDAObjectOverlayClasses(self, obj, clsList): - # Custom nvda overlay objects for sound window and edit fields: - if obj.windowClassName in ["TWaveView", "TSoundForm"]: + # Custom NVDA overlay objects for sound window and edit fields: + if obj.windowClassName in ("TWaveView", "TSoundForm"): # TWaveView = 5.x, TSoundForm = 6.x. clsList.insert(0, SoundWindow) - elif obj.windowClassName in ["TNumEdit", "TTimeEdit"]: + elif obj.windowClassName in ("TNumEdit", "TTimeEdit"): try: clsList.remove(DisplayModelEditableText) clsList.insert(0, edit.Edit) except ValueError: pass + # Cache the needed status bar objects. + statusBarCache = [] + + def _get_statusBars(self, statBarIndex): + if not len(self.statusBarCache): + for child in api.getForegroundObject().children: + if child.role == ROLE_STATUSBAR: self.statusBarCache.append(child) + return self.statusBarCache[statBarIndex] + __gestures={ "kb:nvda+shift+c":"toggleCommandAnnouncement", } diff --git a/buildVars.py b/buildVars.py index 4106e64..b58757a 100755 --- a/buildVars.py +++ b/buildVars.py @@ -19,7 +19,7 @@ addon_info = { # Translators: Long description to be shown for this add-on on add-on information from add-ons manager "addon_description" : _("An add-on for enhancing access and usage of the Goldwave audio editor."), # version - "addon_version" : "2.2-dev", + "addon_version" : "3.0-dev", # Author(s) "addon_author" : u"Joseph Lee <joseph.lee22590@xxxxxxxxx>, David Parduhn <xkill85@xxxxxxx>, Mesar Hameed <mhameed@xxxxxxxxxxxxx>", # URL for the add-on documentation support Repository URL: https://bitbucket.org/nvdaaddonteam/goldwave/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. ---------------------------------------------------------------- NVDA add-ons: A list to discuss add-on code enhancements and for reporting bugs. Community addons are available from: http://addons.nvda-project.org To send a message to the list: nvda-addons@xxxxxxxxxxxxx To change your list settings/unsubscribe: //www.freelists.org/list/nvda-addons To contact list moderators: nvda-addons-moderators@xxxxxxxxxxxxx