diff --git a/__init__.py b/__init__.py index 6f60f41..ab0e56a 100644 --- a/__init__.py +++ b/__init__.py @@ -1,5 +1,5 @@ # Anki Zoom -# v1.1.2 3/8/2020 +# v1.1.3 3/28/2020 # Copyright (c) 2020 Quip13 (random.emailforcrap@gmail.com) # Based in part on code by Damien Elmes , Roland Sieker and github.com/krassowski # Big thanks to u/Glutanimate and u/yumenogotoshi for code suggestions @@ -12,6 +12,7 @@ from anki.hooks import addHook, runHook, wrap from anki.hooks import * from anki.lang import _ +from .toolbar import * def configUpdated(*args): global scrl_threshold @@ -110,7 +111,7 @@ def setup_menu(): try: mw.addon_view_menu except AttributeError: - mw.addon_view_menu = QMenu(_('&View'), mw) + mw.addon_view_menu = getMenu(mw, "&View") mw.form.menubar.insertMenu( mw.form.menuTools.menuAction(), mw.addon_view_menu diff --git a/config.md b/config.md index a588c41..a979760 100644 --- a/config.md +++ b/config.md @@ -1,4 +1,4 @@ -### Anki Zoom v1.1.2 Config: +### Anki Zoom v1.1.3 Config: All config is effective immediately. If having issues, please click "Restore Defaults". - `deckBrowser_zoom_default`: Zoom level that the reset button applies for the deck browser. Must be >`0.2` and <`5` diff --git a/manifest.json b/manifest.json index 00f478f..77ae654 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "package": "538879081", "ankiweb_id": "538879081", "author": "Quip13", - "human_version": "v1.1", + "human_version": "v1.1.3", "homepage": "https://ankiweb.net/shared/info/538879081", "conflicts": [ "1846592880" ] } \ No newline at end of file diff --git a/toolbar.py b/toolbar.py new file mode 100644 index 0000000..27708a9 --- /dev/null +++ b/toolbar.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2020 Lovac42 +# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + + +from aqt import QMenu + +def getMenu(parent, menuName): + menu = None + for a in parent.form.menubar.actions(): + if menuName == a.text(): + menu = a.menu() + break + if not menu: + menu = parent.form.menubar.addMenu(menuName) + return menu + + +def getSubMenu(menu, subMenuName): + subMenu = None + for a in menu.actions(): + if subMenuName == a.text(): + subMenu = a.menu() + break + if not subMenu: + subMenu = QMenu(subMenuName, menu) + menu.addMenu(subMenu) + return subMenu \ No newline at end of file diff --git a/zoom.ankiaddon b/zoom.ankiaddon index 7a1df3a..305891c 100644 Binary files a/zoom.ankiaddon and b/zoom.ankiaddon differ