Skip to content

Commit

Permalink
Merge pull request #1 from hwf1324/Support-mouse-tracking
Browse files Browse the repository at this point in the history
Support mouse tracking
  • Loading branch information
cary-rowen authored Sep 11, 2024
2 parents 4909a59 + 7deee24 commit 864f2ff
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
22 changes: 21 additions & 1 deletion addon/appModules/wechat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,32 @@
import config
import controlTypes
import eventHandler
import IAccessibleHandler
import mouseHandler
import speech
import ui
import winUser
import wx
from NVDAObjects import NVDAObjectTextInfo
from NVDAObjects import NVDAObject, NVDAObjectTextInfo, IAccessible
from nvwave import playWaveFile
from scriptHandler import script
from versionInfo import version_year

role = controlTypes.Role if version_year >= 2022 else controlTypes.role.Role


class RedirectWeChat(IAccessible.IAccessible):

def objectFromPointRedirect(self, x: int, y: int):
redirectObj: IAccessible.IAccessible = self.firstChild
redirect = redirectObj.IAccessibleObject.accHitTest(x, y)
if not redirect:
return None
redirect = IAccessibleHandler.normalizeIAccessible(redirect)
obj = IAccessible.IAccessible(IAccessibleObject=redirect, IAccessibleChildID=winUser.CHILDID_SELF)
return obj


class AppModule(appModuleHandler.AppModule):
ReportOCRResultTimer = None
OCRResult = None
Expand All @@ -35,6 +48,13 @@ def event_NVDAObject_init(self, obj):
obj.displayText = obj.name
obj.TextInfo = NVDAObjectTextInfo

def chooseNVDAObjectOverlayClasses(self, obj: NVDAObject, clsList: list[NVDAObject]):
if (
obj.role == controlTypes.Role.PANE
and obj.states == set()
):
clsList.insert(0, RedirectWeChat)

def event_nameChange(self, obj, nextHandler):
try:
if obj.role == role.LISTITEM and obj.parent.name == "消息" and obj.simpleFirstChild:
Expand Down
8 changes: 5 additions & 3 deletions addon/doc/zh_CN/readme.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# PC微信无障碍增强

* 作者: 沉浮 & Eureka
* 作者: 沉浮 & Eureka & hwf1324
* NVDA 兼容版本: NVDA2021.2 及以上
* 兼容微信版本: 微信 3.9.8+

**注: 使微信支持 NVDA 对象文本查看的思路来源于“NV宝盒”。**

## 增强特性

1. 公众号文章留言的朗读支持(需按 NVDA+大键盘8 “打开焦点自动跳转到可聚焦元素”)。
2. F3键: 开启/关闭自动朗读新消息(默认关闭)。
2. F3键:开启/关闭自动朗读新消息(默认关闭)。
3. 消息列表内浏览非普通文本消息时增加音效提示。
4. 支持使用 NVDA 的对象文本查看浏览微信的控件信息。
5. 针对群成员昵称朗读的改进: 开启了“显示群成员昵称”则只读群成员昵称,关闭该选项则只读微信昵称。
5. 针对群成员昵称朗读的改进:开启了“显示群成员昵称”则只读群成员昵称,关闭该选项则只读微信昵称。
6. 当在微信中打开包含文字的图片时会自动提取文字并读出结果。
7. 尝试为会话列表中直接回车打开的“订阅号”窗口设置焦点。
8. 改进了转发消息窗口的消息朗读顺序(昵称 → 内容 → 时间)。
9. 增加了 F6 定位网页文档控件。
10. 在 NVDA 2024.4 及以上版本中,微信支持鼠标导航。
2 changes: 1 addition & 1 deletion buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _(arg):
# version
"addon_version": "1.8.2",
# Author(s)
"addon_author": "沉浮, Cary-Rowen <[email protected]>",
"addon_author": "沉浮, Cary-Rowen <[email protected]>, hwf1324 <[email protected]>",
# URL for the add-on documentation support
"addon_url": "https://www.nvdacn.com/",
# URL for the add-on repository where the source code can be found
Expand Down

0 comments on commit 864f2ff

Please sign in to comment.