-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implements lovac42's toolbar package
- Loading branch information
Showing
5 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Anki Zoom | ||
# v1.1.2 3/8/2020 | ||
# v1.1.3 3/28/2020 | ||
# Copyright (c) 2020 Quip13 ([email protected]) | ||
# Based in part on code by Damien Elmes <[email protected]>, Roland Sieker <[email protected]> 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Binary file not shown.