7
7
u"""App module for µTorrent
10
import appModuleHandler
12
12
import controlTypes
14
from logHandler import log
13
15
from NVDAObjects.IAccessible import IAccessible
16
from NVDAObjects.window import Window
15
18
class DuplicateFocusListView(IAccessible):
16
19
"""A list view which annoyingly fires focus events every second, even when a menu is open.
29
32
return super(DuplicateFocusListView, self).shouldAllowIAccessibleFocusEvent
31
class AppModule(_default.AppModule):
34
class TorrentContentsListItem(IAccessible):
35
"""Items of the Torrent Contents list in the Add Torrent dialog.
36
The file names aren't exposed to MSAA, though the other column (size) is.
40
superName = super(TorrentContentsListItem, self).name
44
# We need to use the display model to retrieve the Name column.
46
# We don't want to just use displayText because it also contains the size, which is exposed correctly in the value property.
47
# Therefore, use the left and right of the Name column as obtained from the column header.
48
nameHdrLoc = Window._get_firstChild(self).firstChild.firstChild.location
50
right = left + nameHdrLoc[2]
51
# Use the top and bottom of the list item.
52
selfLoc = self.location
54
bottom = top + selfLoc[3]
55
return displayModel.getWindowTextInRect(self.appModule.helperLocalBindingHandle, self.windowHandle,
56
left, top, right, bottom,
57
displayModel.DisplayModelTextInfo.minHorizontalWhitespace, displayModel.DisplayModelTextInfo.minVerticalWhitespace)[0]
59
log.debugWarning("Error retrieving name using display model", exc_info=True)
62
class AppModule(appModuleHandler.AppModule):
33
64
def chooseNVDAObjectOverlayClasses(self, obj, clsList):
66
if role == controlTypes.ROLE_WINDOW:
34
69
if obj.windowClassName == "SysListView32":
35
clsList.insert(0, DuplicateFocusListView)
70
if obj.windowControlID == 1206 and role == controlTypes.ROLE_LISTITEM:
71
clsList.insert(0, TorrentContentsListItem)
73
clsList.insert(0, DuplicateFocusListView)