Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion source/NVDAObjects/UIA/VisualStudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
available in Visual Studio and SQL Server Management Studio.
"""

from . import UIA
from . import UIA, ToolTip
import speech
import braille
import api
import time


class IntelliSenseItem(UIA):
Expand Down Expand Up @@ -53,6 +54,22 @@ class IntelliSenseLiveRegion(UIA):
}


class CompletionToolTip(ToolTip):
""" A tool tip for which duplicate open events can be fired.
"""

_lastToolTipOpenedInfo = (None, None) #: Keeps track of the last ToolTipOpened event (text, time)

def event_UIA_toolTipOpened(self):
oldText, oldTime = self._lastToolTipOpenedInfo
newText = self.name
newTime = time.time()
self.__class__._lastToolTipOpenedInfo = (newText, newTime)
if newText == oldText and oldTime is not None and (newTime - oldTime) < 0.2:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this really needs a comment to explain why this is done.

For instance, it is probably worth pointing out that a user may intentionally be trying to hear the same tooltip twice, hence the 0.2 seconds. I think the value could be larger (eg 1 second). Given that the text must be equal consecutively, we should look to approach the limit of how rapidly a user could ever intentionally try to trigger the same tooltip twice in a row.

return
super().event_UIA_toolTipOpened()
Comment thread
LeonarddeR marked this conversation as resolved.
Resolved


def findExtraOverlayClasses(obj, clsList):
if obj.UIAAutomationId in _INTELLISENSE_LIST_AUTOMATION_IDS:
clsList.insert(0, IntelliSenseList)
Expand All @@ -64,3 +81,5 @@ def findExtraOverlayClasses(obj, clsList):
and isinstance(obj.previous.previous, IntelliSenseList)
):
clsList.insert(0, IntelliSenseLiveRegion)
elif obj.UIAAutomationId == "completion tooltip":
clsList.insert(0, CompletionToolTip)