Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

通过修改context.py文件,使得插件在2.1.50+【含2.1.50】版本Anki上正常工作的方法【非原创】-解决Qt6不兼容问题 #258

Open
AnkiStudio opened this issue Dec 18, 2022 · 17 comments

Comments

@AnkiStudio
Copy link

打开插件-插件文件,定位到插件所在的目录路径,找到context.py文件
打开该文件【随你用文本编辑器还是VScode还是Pycharm】
滚动到该文件底部

config = Config(mw)
替换为
wp = mw.pm.profileFolder()
mediaPath = os.path.join(wp, "collection.media")
os.chdir(mediaPath)
config = Config(mw)

保存并退出路径,退出Anki。
然后再进入Anki即可。

该方法适用于解决自2.1.50版本起,本插件无法正常工作的问题。
测试于MacBook Pro M1 2.1.55以及Win 11 2.1.55 的Anki

本方法非原创,是某次查看本issues的回答中所看到的。

@AnkiStudio
Copy link
Author

#241

本方法来源自上述链接的评论分享

@AnkiStudio
Copy link
Author

#241 (comment)

@AnkiStudio AnkiStudio changed the title 通过修改context.py文件,使得插件在2.1.50+【含2.1.50】版本Anki上正常工作的方法【非原创】 通过修改context.py文件,使得插件在2.1.50+【含2.1.50】版本Anki上正常工作的方法【非原创】-解决Qt6不兼容问题 Dec 18, 2022
@SOREMUZ
Copy link

SOREMUZ commented Jan 10, 2023

我出现了新的bug😭

错误
发生了一个错误。请在启动Anki时按住「Shift」键临时禁用插件加载。 如仅在插件启用时出错,请使用「工具」>「插件」功能禁用部分插件后重启Anki, 请重复上述步骤直至找到引起错误的插件。 找到引起错误的插件后,请反馈给插件作者。 调试信息:
Anki 2.1.56 (07fd88dd) Python 3.9.15 Qt 6.3.2 PyQt 6.3.1
Platform: macOS-13.0.1-arm64-arm-64bit
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-01-10 12:09:02
相关插件:⁨Fast Word Query Multi-threaded queries for words from local or web dictionaries⁩

Caught exception:
Traceback (most recent call last):
File "/Users/chikane/Library/Application Support/Anki2/addons21/1807206748/common.py", line 159, in onQuery
menu.addAction(
TypeError: arguments did not match any overloaded call:
addAction(self, QIcon, str): argument 1 has unexpected type 'str'
addAction(self, QIcon, str, PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 1 has unexpected type 'str'
addAction(self, QIcon, str, Union[QKeySequence, QKeySequence.StandardKey, str, int]): argument 1 has unexpected type 'str'
addAction(self, QIcon, str, Union[QKeySequence, QKeySequence.StandardKey, str, int], PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 1 has unexpected type 'str'
addAction(self, str): too many arguments
addAction(self, str, Union[QKeySequence, QKeySequence.StandardKey, str, int]): argument 2 has unexpected type 'function'
addAction(self, str, PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 3 has unexpected type 'QtClassProxy'
addAction(self, str, Union[QKeySequence, QKeySequence.StandardKey, str, int], PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 2 has unexpected type 'function'
addAction(self, QAction): argument 1 has unexpected type 'str'

@boson33
Copy link

boson33 commented Jan 20, 2023

一直还在用老版本没更新,搞定的大佬提交个 pr 联系作者合并下?或者联系不上新开个项目?

@sirius-fan
Copy link
Contributor

https://github.com/sirius-fan/FastWordQuery
我fork了一个尽量改下bug,目前应该是可用的,有问题可以再报给我,有时间改下

@bieitest
Copy link

bieitest commented Feb 5, 2023

@sirius-fan 可以麻烦请教下,如何才能正确使用FWQ吗?在Win10上尝试了2.1.26和.54和.57的Qt5及Qt6的Anki版本,都没有成功。尝试了本地字典LDOCE6,但是都无法显示期望的字段,只有Default字段。也尝试了你fork的版本覆盖过去,还是不成功。可以麻烦指点下迷津吗?感谢!

@sirius-fan
Copy link
Contributor

@bieitest
我用的少,看了看源码
应该是不支持,本地词典格式互不相同,没有通用的提取方法,
有几个本地词典的service都是是限定的特定词典文件,否则就是只有default,也就是整个字段,

DICT_PATH = u"/Users/brian/Documents/mdx/lgmcw_Sound++/SoundMobile.mdx" # u'E:\\BaiduYunDownload\\mdx\\L6mp3.mdx'

比如上面这种,甚至指定了文件地址
所以也没有什么办法,如果不想整个导进去,只能单独为mdx写service
还有,我fork那边开了issus,有问题那边提吧

@SOREMUZ
Copy link

SOREMUZ commented Feb 5, 2023

本地字典LDOCE6的意思是得自己下一个ldoce6的词典才能正常显示
image

@bieitest
Copy link

bieitest commented Feb 5, 2023

@sirius-fan 非常感谢这么快就回复了!我下了两个不同版本的LDOCE6,都不能正常把字段显示出来。再有问题,我到那边的issue里去提,感谢!

@bieitest
Copy link

bieitest commented Feb 5, 2023

@SOREMUZ 感谢回复!嗯,明白。我下过两个LDOCE6的字典,但都不能用。请问能麻烦分享你的词典吗?万分感谢!

@bieitest
Copy link

bieitest commented Feb 5, 2023

@SOREMUZ 另外,分享下关于“发生了一个错误。请在启动Anki时按住「Shift」键临时禁用插件加载。”,我也遇到了,这个我是通过用管理员身份启动Anki程序后,问题就消失了。

@SOREMUZ
Copy link

SOREMUZ commented Feb 5, 2023

@bieitest 链接: https://pan.baidu.com/s/1tftkumvXvuFbeoddhaSrJQ?pwd=nipq 提取码: nipq 复制这段内容后打开百度网盘手机App,操作更方便哦
--来自百度网盘超级会员v4的分享

@bieitest
Copy link

bieitest commented Feb 5, 2023

@SOREMUZ 膜拜~~~~

@YELLOWHOMEIN
Copy link

@bieitest 链接: https://pan.baidu.com/s/1tftkumvXvuFbeoddhaSrJQ?pwd=nipq 提取码: nipq 复制这段内容后打开百度网盘手机App,操作更方便哦
--来自百度网盘超级会员v4的分享

过期了,可以再分享一下吗

@SOREMUZ
Copy link

SOREMUZ commented Feb 24, 2023

链接: https://pan.baidu.com/s/1-PWEWO-LEMRt02uliE-Y0A 提取码: esu8
@YELLOWHOMEIN

@YELLOWHOMEIN
Copy link

谢谢!文件好大,我试一下

@Zarves76
Copy link

Zarves76 commented Mar 9, 2023

非常感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants