Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setup_menu():
u"""Set up the zoom menu."""
try:
mw.addon_view_menu
except AttributeError:
mw.addon_view_menu = QMenu(_(u"&View"), mw)
mw.form.menubar.insertMenu(
mw.form.menuTools.menuAction(), mw.addon_view_menu)
mw.zoom_submenu = QMenu(_(u"&Zoom"), mw)
mw.addon_view_menu.addMenu(mw.zoom_submenu)
zoom_in_action = QAction(_('Zoom &In'), mw)
zoom_in_action.setShortcut(QKeySequence("Ctrl++"))
mw.zoom_submenu.addAction(zoom_in_action)
mw.connect(zoom_in_action, SIGNAL("triggered()"), zoom_in)
zoom_out_action = QAction(_('Zoom &Out'), mw)
zoom_out_action.setShortcut(QKeySequence("Ctrl+-"))
mw.zoom_submenu.addAction(zoom_out_action)
mw.connect(zoom_out_action, SIGNAL("triggered()"), zoom_out)
mw.zoom_submenu.addSeparator()
reset_zoom_action = QAction(_('&Reset'), mw)
reset_zoom_action.setShortcut(QKeySequence("Ctrl+0"))
mw.zoom_submenu.addAction(reset_zoom_action)
mw.connect(reset_zoom_action, SIGNAL("triggered()"), reset_zoom)
from .importer import AnkidownImporter
DialogManager._dialogs["Ankidown-Importer"] = [AnkidownImporter, None]
def open_importer():
aqt.dialogs.open("Ankidown-Importer", mw)
ankidown_menu = QMenu("Ankidown", mw)
a = ankidown_menu.addAction("Import")
a.triggered.connect(open_importer)
mw.form.menuTools.addMenu(ankidown_menu)
def create_menu():
u"""Set up the menu."""
mn = QMenu()
mn.setTitle("Nachschlagen")
mw.form.menuTools.addAction(mn.menuAction())
#
mw.form.menu_nachschlagen = mn
# add actions
if show_japanese:
# Maybe not show the Japanese actions.
wae = QAction(mw)
wae.setText("Japanisch bei Wadoku")
# wae.setShortcut("Ctrl+4")
mn.addAction(wae)
mw.connect(wae, SIGNAL("triggered()"), on_lookup_wadoku_expression)
wam = QAction(mw)
wam.setText("Deutsch bei Wadoku")
# wam.setShortcut("Ctrl+2")
mn.addAction(wam)
mw.connect(wam, SIGNAL("triggered()"), on_lookup_wadoku_meaning)
was = QAction(mw)
except StopIteration:
return
try:
for m in progress(media_in_col, _(u"Unicode unnormalizing files."),
_(u"Stop that!")):
m_n = unicodedata.normalize('NFD', m)
if m == m_n:
continue
if m_n in problem_files:
shutil.move(os.path.join(mdir, m_n), os.path.join(mdir, m))
except StopIteration:
return
if not isMac:
nom_a = QAction(mw)
mw.form.menuTools.addAction(nom_a)
nom_a.setText(_(u"Unnormalize media files"))
mw.connect(nom_a, SIGNAL("triggered()"), unnormalize_files)
def addMenuItem():
a = QAction(mw)
a.setText('Cross Profile Search and Import')
mw.form.menuTools.addAction(a)
a.triggered.connect(MainDialog)
Go through the collection and detect files that alook like MD5
hashes used by Anki <1.2, look at the note for a better name and
rename the files, changing the notes as well.
"""
import dehashilator
from aqt import mw
from aqt.qt import *
from dehashilator import __version__
dhma = QAction(mw)
dhma.setText("Dehashilate media")
mw.form.menuTools.addAction(dhma)
mw.connect(dhma, SIGNAL("triggered()"), dehashilator.test_and_dehashilate)
def setup_options_menu():
# add options submenu to Tools menu
action = QAction(app_icon, "WordQuery...", mw)
action.triggered.connect(show_options)
mw.form.menuTools.addAction(action)
global have_setup
have_setup = True
if d.exec_():
wkconf['key'] = form.key.text()
wkconf['deck_separation'] = form.deckSeparation.checkedButton().objectName()
wkconf['card_direction'] = form.cardDirection.checkedButton().objectName()
wkconf['include_tangorin_link'] = form.includeTangorinLink.isChecked()
writeConf();
mw.app.processEvents()
mw.reset()
mw.deckBrowser.show()
readConf()
confaction = QAction("WaniKani 2 Anki", mw)
mw.connect(confaction, SIGNAL("triggered()"), showConfDialog)
mw.form.menuTools.addAction(confaction)
<a href="http://youtube.com/watch?v=F1j1Zx0mXME">modifying the appearance of cards.</a>
<p></p>""" % newCount)
def showFailureDialog():
QMessageBox.about(mw, "Media Import Failure",
"""
<p>
Failed to generate cards and no media files were imported. Please ensure the
note type you selected is able to generate cards by using a valid
<a href="http://ankisrs.net/docs/manual.html#cards-and-templates">card template</a>.
</p>
""")
action = QAction("Media Import...", mw)
mw.connect(action, SIGNAL("triggered()"), doMediaImport)
mw.form.menuTools.addAction(action)
def get_or_create_menu(attribute_name, label):
if not hasattr(mw, attribute_name):
menu = QMenu(_(label), mw)
setattr(mw, attribute_name, menu)
mw.form.menubar.insertMenu(
mw.form.menuTools.menuAction(),
menu
)
return getattr(mw, attribute_name)