def anki_import_init(): import_action = QAction("CrowdAnki: Import from disk", mw) import_action.triggered.connect(on_import_action) github_import_action = QAction("CrowdAnki: Import from Github", mw) github_import_action.triggered.connect(lambda : GithubImporter.on_github_import_action(mw.col)) # -2 supposed to give the separator after import/export section, so button should be at the end of this section mw.form.menuCol.insertActions(mw.form.menuCol.actions()[-2], [import_action, github_import_action])
def anki_import_init(): import_action = QAction("Import CrowdAnki Json", mw) import_action.triggered.connect(on_import_action) # -2 supposed to give the separator after import/export section, so button should be at the end of this section mw.form.menuCol.insertActions(mw.form.menuCol.actions()[-2], [import_action])
def init_menu(self): # init actions if not self.main_menu: self.main_menu = QMenu( _trans("AnKindle") + u" +" if self.ext_unlocked else _trans("AnKindle"), mw.form.menuTools, ) mw.form.menuTools.addMenu(self.main_menu) self.action_show_vocab_dialog = QAction( _trans("SHOW VOCAB IMPORT"), self.main_menu) self.action_show_vocab_dialog.triggered.connect( self.on_show_vocab_dialog) self.action_show_vocab_dialog.setShortcut("CTRL+K") self.main_menu.addAction(self.action_show_vocab_dialog) if self.ext_available: self.action_show_clipping_dialog = QAction( _trans("SHOW CLIPPING IMPORT"), self.main_menu) self.action_show_clipping_dialog.triggered.connect( self.on_show_clipping_dialog) self.action_show_clipping_dialog.setShortcut("CTRL+L") self.main_menu.addAction(self.action_show_clipping_dialog) self.main_menu.addSeparator() if self.ext_available: if not self.ext_unlocked: action_upgrade = QAction(_trans("UPGRADE TO PLUS"), self.main_menu) action_upgrade.triggered.connect( partial(AnKindlePlus.call_purchase_dialog, mw)) self.main_menu.addAction(action_upgrade) if self.sn_register_dlg: action_upgrade = QAction(_trans("REGISTER PLUS"), self.main_menu) AnKindlePlus._bind_qt_slots(action_upgrade.triggered, self.on_show_enter_sn_dialog) self.main_menu.addAction(action_upgrade)
def setup_menu_option(): action = QAction('Text Wrapper Settings...', mw) action.triggered.connect(invoke_options) mw.form.menuTools.addAction(action)
from aqt import mw, QAction, QKeySequence from .mainwindow import MainWindow from . import startmodule def start(): startmodule.start() def debugStart(): from . import debugreload debugreload.reloadAll(__name__) startmodule.start() startAction = QAction("English word manager: start", mw) startAction.setShortcut(QKeySequence('Ctrl+M')) startAction.triggered.connect(debugStart) mw.form.menuTools.addSeparator() mw.form.menuTools.addAction(startAction)