Skip to content

点击query报错 #255

Open
Open

Description

@zero617

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. 添加新单词
  2. 点击query报错
  3. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
20220927_070954_904

Desktop (please complete the following information):

  • OS: win11
  • Version anki版本⁨2.1.54 (b6a7760c)⁩

Additional context
错误
发生了一个错误。请在启动Anki时按住「Shift」键临时禁用插件加载。 如仅在插件启用时出错,请使用「工具」>「插件」功能禁用部分插件后重启Anki, 请重复上述步骤直至找到引起错误的插件。 找到引起错误的插件后,请反馈给插件作者。 调试信息:
Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 6.3.1 PyQt 6.3.1
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-09-27 11:57:47

Caught exception:
Traceback (most recent call last):
File "C:\Users\zero617\AppData\Roaming\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'

Activity

  1. Buliet commented on Oct 12, 2022

    @Buliet

    临时解决:先添加完单词,再选中后通过标题栏,进行query
    如果 只是反馈错误,请无视临时解决

  2. SOREMUZ commented on Nov 5, 2022

    @SOREMUZ

    我也有同样的错误 请问你解决了吗?

  3. oolongcha024 commented on Sep 6, 2023

    @oolongcha024

    我也遇到了类似的问题,具体表现为 common.py 文件报错。经过尝试我发现了解决方法,具体操作如下:

    解决方案

    1. 在 Anki 主界面点击「工具」→「插件」→「插件文件」,进入 FastWordQuery 插件目录(1807206748),使用文本编辑器打开 「common.py」文件。
    2. 跳转至 159-162 行,此处代码原本为:
                          menu.addAction(
                              _("ALL_FIELDS"),
                              lambda: query_from_editor_fields(self.editor),
                              QKeySequence(my_shortcut))
      将第二个参数和第三个参数位置对调即可,即修改为:
                          menu.addAction(
                              _("ALL_FIELDS"),
                              QKeySequence(my_shortcut),
                              lambda: query_from_editor_fields(self.editor))
    3. 跳转至 240-242 行,此处代码原本为:
              submenu.addAction(
                  _('ALL_FIELDS'), lambda: query_from_editor_fields(web_view.editor),
                  QKeySequence(my_shortcut))
      同样将第二个参数和第三个参数位置对调即可,即修改为:
              submenu.addAction(
                  _('ALL_FIELDS'), QKeySequence(my_shortcut),
                  lambda: query_from_editor_fields(web_view.editor))

    运行环境

    • OS: Windows 11
    • Anki: 2.1.65 (aa9a734f)⁩
    • Python 3.9.15 Qt 6.4.3 PyQt 6.4.0

    I also have a same problem that file "common.py" has some mistakes. Finally, I have found the solution.

    Solution

    1. Click on "Tools" -> "Plugins" -> "Plugin Files" in Anki to enter the FastWordQuery directory (1807206748). Use a text editor to open the "common.py"
    2. Jump to lines 159-162. Modify
                          menu.addAction(
                              _("ALL_FIELDS"),
                              lambda: query_from_editor_fields(self.editor),
                              QKeySequence(my_shortcut))
      to
                          menu.addAction(
                              _("ALL_FIELDS"),
                              QKeySequence(my_shortcut),
                              lambda: query_from_editor_fields(self.editor))
    3. Jump to lines 240-242. Modify
              submenu.addAction(
                  _('ALL_FIELDS'), lambda: query_from_editor_fields(web_view.editor),
                  QKeySequence(my_shortcut))
      to
              submenu.addAction(
                  _('ALL_FIELDS'), QKeySequence(my_shortcut),
                  lambda: query_from_editor_fields(web_view.editor))

    Environment

    • OS: Windows 11
    • Anki: 2.1.65 (aa9a734f)⁩
    • Python 3.9.15 Qt 6.4.3 PyQt 6.4.0
  4. SOREMUZ commented on Sep 6, 2023

    @SOREMUZ

    我也遇到了类似的问题,具体表现为 common.py 文件报错。经过尝试我发现了解决方法,具体操作如下:

    解决方案

    1. 在 Anki 主界面点击「工具」→「插件」→「插件文件」,进入 FastWordQuery 插件目录(1807206748),使用文本编辑器打开 「common.py」文件。

    2. 跳转至 159-162 行,此处代码原本为:

                          menu.addAction(
                              _("ALL_FIELDS"),
                              lambda: query_from_editor_fields(self.editor),
                              QKeySequence(my_shortcut))

      将第二个参数和第三个参数位置对调即可,即修改为:

                          menu.addAction(
                              _("ALL_FIELDS"),
                              QKeySequence(my_shortcut),
                              lambda: query_from_editor_fields(self.editor))
    3. 跳转至 240-242 行,此处代码原本为:

              submenu.addAction(
                  _('ALL_FIELDS'), lambda: query_from_editor_fields(web_view.editor),
                  QKeySequence(my_shortcut))

      同样将第二个参数和第三个参数位置对调即可,即修改为:

              submenu.addAction(
                  _('ALL_FIELDS'), QKeySequence(my_shortcut),
                  lambda: query_from_editor_fields(web_view.editor))

    运行环境

    • OS: Windows 11
    • Anki: 2.1.65 (aa9a734f)⁩
    • Python 3.9.15 Qt 6.4.3 PyQt 6.4.0

    I also have a same problem that file "common.py" has some mistakes. Finally, I have found the solution.

    Solution

    1. Click on "Tools" -> "Plugins" -> "Plugin Files" in Anki to enter the FastWordQuery directory (1807206748). Use a text editor to open the "common.py"

    2. Jump to lines 159-162. Modify

                          menu.addAction(
                              _("ALL_FIELDS"),
                              lambda: query_from_editor_fields(self.editor),
                              QKeySequence(my_shortcut))

      to

                          menu.addAction(
                              _("ALL_FIELDS"),
                              QKeySequence(my_shortcut),
                              lambda: query_from_editor_fields(self.editor))
    3. Jump to lines 240-242. Modify

              submenu.addAction(
                  _('ALL_FIELDS'), lambda: query_from_editor_fields(web_view.editor),
                  QKeySequence(my_shortcut))

      to

              submenu.addAction(
                  _('ALL_FIELDS'), QKeySequence(my_shortcut),
                  lambda: query_from_editor_fields(web_view.editor))

    Environment

    • OS: Windows 11
    • Anki: 2.1.65 (aa9a734f)⁩
    • Python 3.9.15 Qt 6.4.3 PyQt 6.4.0

    你好,已经有好心人修复这个插件了,请在这里安装https://ankiweb.net/shared/info/103636257

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions