Beispiel #1
0
 def setupButtons(self):
     bb = self.form.buttonBox
     ar = QDialogButtonBox.ActionRole
     # add
     self.addButton = bb.addButton(_("Add"), ar)
     self.addButton.clicked.connect(self.addCards)
     self.addButton.setShortcut(QKeySequence("Ctrl+Return"))
     self.addButton.setToolTip(shortcut(_("Add (shortcut: ctrl+enter)")))
     # close
     self.closeButton = QPushButton(_("Close"))
     self.closeButton.setAutoDefault(False)
     bb.addButton(self.closeButton, QDialogButtonBox.RejectRole)
     # help
     self.helpButton = QPushButton(_("Help"), clicked=self.helpRequested)
     self.helpButton.setAutoDefault(False)
     bb.addButton(self.helpButton, QDialogButtonBox.HelpRole)
     # history
     b = bb.addButton(_("History") + " " + downArrow(), ar)
     if isMac:
         sc = "Ctrl+Shift+H"
     else:
         sc = "Ctrl+H"
     b.setShortcut(QKeySequence(sc))
     b.setToolTip(_("Shortcut: %s") % shortcut(sc))
     b.clicked.connect(self.onHistory)
     b.setEnabled(False)
     self.historyButton = b
Beispiel #2
0
    def _create_gui(self):
        self.setWindowTitle(tr(TR.ACTIONS_PREVIEW))

        qconnect(self.finished, self._on_finished)
        self.silentlyClose = True
        self.vbox = QVBoxLayout()
        self.vbox.setContentsMargins(0, 0, 0, 0)
        self._web = AnkiWebView(title="previewer")
        self.vbox.addWidget(self._web)
        self.bbox = QDialogButtonBox()

        self._replay = self.bbox.addButton(tr(TR.ACTIONS_REPLAY_AUDIO),
                                           QDialogButtonBox.ActionRole)
        self._replay.setAutoDefault(False)
        self._replay.setShortcut(QKeySequence("R"))
        self._replay.setToolTip(tr(TR.ACTIONS_SHORTCUT_KEY, val="R"))
        qconnect(self._replay.clicked, self._on_replay_audio)

        both_sides_button = QCheckBox(tr(TR.QT_MISC_BACK_SIDE_ONLY))
        both_sides_button.setShortcut(QKeySequence("B"))
        both_sides_button.setToolTip(tr(TR.ACTIONS_SHORTCUT_KEY, val="B"))
        self.bbox.addButton(both_sides_button, QDialogButtonBox.ActionRole)
        self._show_both_sides = self.mw.col.conf.get("previewBothSides", False)
        both_sides_button.setChecked(self._show_both_sides)
        qconnect(both_sides_button.toggled, self._on_show_both_sides)

        self.vbox.addWidget(self.bbox)
        self.setLayout(self.vbox)
        restoreGeom(self, "preview")
Beispiel #3
0
def onSetupMenus(self):
    # self is browser
    m = getMenu(self, "&View")
    if not hasattr(self, "menuView"):
        self.menuView = m
    #a.setCheckable(True)/a.toggled.connect(self.toggleTableAndSidebar) and maybe a.setChecked(True)
    #doesn't offer benefits here: you don't need visual feedbar in the menu
    #to see if the table view is hidden ...
    a = m.addAction('editor only')
    a.triggered.connect(lambda _, browser=self: editor_only(browser))
    a.setShortcut(QKeySequence(gc("hotkey_editor_only", "")))

    a = m.addAction('table only')
    a.triggered.connect(lambda _, browser=self: table_only(browser))
    a.setShortcut(QKeySequence(gc("hotkey_table_only", "")))

    a = m.addAction('toggle between "only table/sidebar" and "only editor"')
    a.triggered.connect(lambda _, browser=self: toggle_extremes(browser))
    a.setShortcut(QKeySequence(gc("hotkey_toggle", "")))

    a = m.addAction('toggle sidebar')
    a.triggered.connect(lambda _, browser=self: my_toggle_sidebar(browser))
    a.setShortcut(QKeySequence(gc("hotkey_toggle_sidebar", "")))

    a = m.addAction('reset to default')
    a.triggered.connect(lambda _, browser=self: back_to_default(browser))
    a.setShortcut(QKeySequence(gc("hotkey_back_to_default", "")))
Beispiel #4
0
    def _create_gui(self) -> None:
        self.setWindowTitle(tr.actions_preview())

        self.close_shortcut = QShortcut(QKeySequence("Ctrl+Shift+P"), self)
        qconnect(self.close_shortcut.activated, self.close)

        qconnect(self.finished, self._on_finished)
        self.silentlyClose = True
        self.vbox = QVBoxLayout()
        self.vbox.setContentsMargins(0, 0, 0, 0)
        self._web = AnkiWebView(title="previewer")
        self.vbox.addWidget(self._web)
        self.bbox = QDialogButtonBox()

        self._replay = self.bbox.addButton(
            tr.actions_replay_audio(), QDialogButtonBox.ButtonRole.ActionRole)
        self._replay.setAutoDefault(False)
        self._replay.setShortcut(QKeySequence("R"))
        self._replay.setToolTip(tr.actions_shortcut_key(val="R"))
        qconnect(self._replay.clicked, self._on_replay_audio)

        both_sides_button = QCheckBox(tr.qt_misc_back_side_only())
        both_sides_button.setShortcut(QKeySequence("B"))
        both_sides_button.setToolTip(tr.actions_shortcut_key(val="B"))
        self.bbox.addButton(both_sides_button,
                            QDialogButtonBox.ButtonRole.ActionRole)
        self._show_both_sides = self.mw.col.get_config_bool(
            Config.Bool.PREVIEW_BOTH_SIDES)
        both_sides_button.setChecked(self._show_both_sides)
        qconnect(both_sides_button.toggled, self._on_show_both_sides)

        self.vbox.addWidget(self.bbox)
        self.setLayout(self.vbox)
        restoreGeom(self, "preview")
Beispiel #5
0
    def __init__(self, parent=None):
        QWebEngineView.__init__(self, parent=parent)
        self.title = "default"
        self._page = AnkiWebPage(self._onBridgeCmd)
        self._page.setBackgroundColor(self._getWindowColor())  # reduce flicker

        self._domDone = True
        self._pendingActions = []
        self.requiresCol = True
        self.setPage(self._page)

        self._page.profile().setHttpCacheType(QWebEngineProfile.NoCache)
        self.resetHandlers()
        self.allowDrops = False
        self._filterSet = False
        QShortcut(QKeySequence("Esc"), self,
                  context=Qt.WidgetWithChildrenShortcut, activated=self.onEsc)
        if isMac:
            for key, fn in [
                (QKeySequence.Copy, self.onCopy),
                (QKeySequence.Paste, self.onPaste),
                (QKeySequence.Cut, self.onCut),
                (QKeySequence.SelectAll, self.onSelectAll),
            ]:
                QShortcut(key, self,
                          context=Qt.WidgetWithChildrenShortcut,
                          activated=fn)
            QShortcut(QKeySequence("ctrl+shift+v"), self,
                      context=Qt.WidgetWithChildrenShortcut, activated=self.onPaste)
Beispiel #6
0
    def _create_gui(self):
        self.setWindowTitle(_("Preview"))

        qconnect(self.finished, self._on_finished)
        self.silentlyClose = True
        self.vbox = QVBoxLayout()
        self.vbox.setContentsMargins(0, 0, 0, 0)
        self._web = AnkiWebView(title="previewer")
        self.vbox.addWidget(self._web)
        self.bbox = QDialogButtonBox()

        self._replay = self.bbox.addButton(_("Replay Audio"),
                                           QDialogButtonBox.ActionRole)
        self._replay.setAutoDefault(False)
        self._replay.setShortcut(QKeySequence("R"))
        self._replay.setToolTip(_("Shortcut key: %s" % "R"))
        qconnect(self._replay.clicked, self._on_replay_audio)

        both_sides_button = QCheckBox(_("Show Both Sides"))
        both_sides_button.setShortcut(QKeySequence("B"))
        both_sides_button.setToolTip(_("Shortcut key: %s" % "B"))
        self.bbox.addButton(both_sides_button, QDialogButtonBox.ActionRole)
        self._show_both_sides = self.mw.col.conf.get("previewBothSides", False)
        both_sides_button.setChecked(self._show_both_sides)
        qconnect(both_sides_button.toggled, self._on_show_both_sides)

        self.vbox.addWidget(self.bbox)
        self.setLayout(self.vbox)
        restoreGeom(self, "preview")
def addContextMenu(ev: QCloseEvent, name: str, dc_instance) -> None:
    ev.accept()
    frm = mw.debug_diag_form
    menu = frm.log.createStandardContextMenu(QCursor.pos())
    menu.addSeparator()
    if name == "log":
        a = menu.addAction("Clear Log")
        a.setShortcuts(QKeySequence("ctrl+l"))
        qconnect(a.triggered, frm.log.clear)
    elif name == "text":
        a = menu.addAction("Clear Code")
        a.setShortcuts(QKeySequence("ctrl+shift+l"))
        qconnect(a.triggered, frm.text.clear)

        ## ADDITION
        hist_window = menu.addAction("Open History Window")
        cut = gc("debug console: shortcut open history window", "ctrl+i")
        if cut:
            hist_window.setShortcuts(QKeySequence(cut))  # doesn't work
        qconnect(hist_window.triggered,
                 lambda _, d=dc_instance: history_helper(d))

        save = menu.addAction("Save Current")
        cut = gc("debug console: shortcut save", "ctrl+s")
        if cut:
            save.setShortcuts(QKeySequence(cut))  # doesn't work
        qconnect(save.triggered, lambda _, d=dc_instance: save_current(d))
    menu.exec(QCursor.pos())
Beispiel #8
0
 def _create_gui(self):
     super()._create_gui()
     self._other_side = self.bbox.addButton("Other side",
                                            QDialogButtonBox.ActionRole)
     self._other_side.setAutoDefault(False)
     self._other_side.setShortcut(QKeySequence("Right"))
     self._other_side.setShortcut(QKeySequence("Left"))
     self._other_side.setToolTip(_("Shortcut key: Left or Right arrow"))
     qconnect(self._other_side.clicked, self._on_other_side)
Beispiel #9
0
    def __init__(self, parent, tags, alltags):
        QDialog.__init__(self, parent, Qt.WindowType.Window)  # super().__init__(parent)
        self.parent = parent
        self.all_tags = alltags
        self.setWindowTitle("Anki - Edit Tags")

        self.form = dialog_qlistwidget.Ui_Dialog()
        self.form.setupUi(self)
        
        sheet_to_use = stylesheet_dark if theme_manager.night_mode else stylesheet_light
        self.form.listWidget.setStyleSheet(sheet_to_use)
        # self.form.listWidget.currentRowChanged.connect(self.on_row_changed)

        self.form.buttonBox.accepted.connect(self.accept)
        self.form.buttonBox.rejected.connect(self.reject)
        self.form.pb_search.clicked.connect(lambda: self.do_browser_search(extra_search=""))
        self.form.pb_edit_tag.clicked.connect(self.tagselector)
        self.form.pb_add_empty.clicked.connect(lambda: self.maybe_add_line(force=True))

        self.shortcut = QShortcut(QKeySequence("Ctrl+Return"), self)
        self.shortcut.activated.connect(self.accept)

        originalheight = self.height()
        restoreGeom(self, "TagDialogExtended")
        self.resize(self.width(), originalheight)
        
        if not tags:
            tags = ["",]
        else:
            tags.append("")
        
        for t in tags:
            self.maybe_add_line(t)

        self.cut = gc("in tag lines dialog: open filterdialog for single tag")
        if self.cut:
            self.form.pb_edit_tag.setToolTip('shortcut: {}'.format(self.cut))
            self.selkey = QShortcut(QKeySequence(self.cut), self)
            self.selkey.activated.connect(self.tagselector)
        
        self.browser_scut = gc("in tag lines dialog: search browser for tag")
        if self.browser_scut:
            self.form.pb_search.setToolTip('shortcut: {}'.format(self.browser_scut))
            self.browser_scut_key = QShortcut(QKeySequence(self.browser_scut), self)
            self.browser_scut_key.activated.connect(lambda: self.do_browser_search(extra_search=""))
        
        # don't also set Ctrl+t,a/gc("editor: show filterdialog to add single tag") for 
        # self.tagselector: What if the user has already set them to the same etc. I'd have
        # to do a lot of checking
        self.addnl = gc("in tag lines dialog: insert additional line")
        if self.addnl:
            self.form.pb_add_empty.setToolTip('shortcut: {}'.format(self.addnl))
            self.addnlscut = QShortcut(QKeySequence(self.addnl), self)
            self.addnlscut.activated.connect(lambda: self.maybe_add_line(force=True))       
Beispiel #10
0
    def _create_gui(self):
        super()._create_gui()
        self._prev = self.bbox.addButton("<", QDialogButtonBox.ActionRole)
        self._prev.setAutoDefault(False)
        self._prev.setShortcut(QKeySequence("Left"))
        self._prev.setToolTip(_("Shortcut key: Left arrow"))

        self._next = self.bbox.addButton(">", QDialogButtonBox.ActionRole)
        self._next.setAutoDefault(True)
        self._next.setShortcut(QKeySequence("Right"))
        self._next.setToolTip(_("Shortcut key: Right arrow or Enter"))

        qconnect(self._prev.clicked, self._on_prev)
        qconnect(self._next.clicked, self._on_next)
Beispiel #11
0
    def _create_gui(self):
        super()._create_gui()
        self._prev = self.bbox.addButton("<", QDialogButtonBox.ActionRole)
        self._prev.setAutoDefault(False)
        self._prev.setShortcut(QKeySequence("Left"))
        self._prev.setToolTip(tr(TR.QT_MISC_SHORTCUT_KEY_LEFT_ARROW))

        self._next = self.bbox.addButton(">", QDialogButtonBox.ActionRole)
        self._next.setAutoDefault(True)
        self._next.setShortcut(QKeySequence("Right"))
        self._next.setToolTip(tr(TR.QT_MISC_SHORTCUT_KEY_RIGHT_ARROW_OR_ENTER))

        qconnect(self._prev.clicked, self._on_prev)
        qconnect(self._next.clicked, self._on_next)
Beispiel #12
0
    def _create_gui(self) -> None:
        super()._create_gui()
        self._prev = self.bbox.addButton("<", QDialogButtonBox.ActionRole)
        self._prev.setAutoDefault(False)
        self._prev.setShortcut(QKeySequence("Left"))
        self._prev.setToolTip(tr.qt_misc_shortcut_key_left_arrow())

        self._next = self.bbox.addButton(">", QDialogButtonBox.ActionRole)
        self._next.setAutoDefault(True)
        self._next.setShortcut(QKeySequence("Right"))
        self._next.setToolTip(tr.qt_misc_shortcut_key_right_arrow_or_enter())

        qconnect(self._prev.clicked, self._on_prev)
        qconnect(self._next.clicked, self._on_next)
Beispiel #13
0
 def applyShortcuts(self, shortcuts):
     qshortcuts = []
     for key, fn in shortcuts:
         scut = QShortcut(QKeySequence(key), self, activated=fn)
         scut.setAutoRepeat(False)
         qshortcuts.append(scut)
     return qshortcuts
Beispiel #14
0
 def setupDecks(self):
     if self.label:
         self.deckLabel = QLabel(_("Deck"))
         self.addWidget(self.deckLabel)
     # decks box
     self.deck = QPushButton(clicked=self.onDeckChange)
     self.deck.setToolTip(shortcut(_("Target Deck (Ctrl+D)")))
     s = QShortcut(QKeySequence(_("Ctrl+D")), self.widget, activated=self.onDeckChange)
     self.addWidget(self.deck)
     # starting label
     if self.mw.col.conf.get("addToCur", True):
         col = self.mw.col
         did = col.conf['curDeck']
         if col.decks.isDyn(did):
             # if they're reviewing, try default to current card
             c = self.mw.reviewer.card
             if self.mw.state == "review" and c:
                 if not c.odid:
                     did = c.did
                 else:
                     did = c.odid
             else:
                 did = 1
         self.setDeckName(self.mw.col.decks.nameOrNone(
             did) or _("Default"))
     else:
         self.setDeckName(self.mw.col.decks.nameOrNone(
             self.mw.col.models.current()['did']) or _("Default"))
     # layout
     sizePolicy = QSizePolicy(
         QSizePolicy.Policy(7),
         QSizePolicy.Policy(0))
     self.deck.setSizePolicy(sizePolicy)
Beispiel #15
0
def browserSetupMenus(self):
    menu = getMenu(self, MENU_NAME)
    a = menu.addAction('toggle night_only (this mostly affects the editor/reviewer')
    a.triggered.connect(lambda _, b=self: toggle_nm_from_browser(b))
    cut = gc("shortcut toggle", "")
    if cut:
        a.setShortcut(QKeySequence(cut))
Beispiel #16
0
def mainSetupMenus():
    menu = getMenu(mw, MENU_NAME)
    a = menu.addAction('toggle night_only (this mostly affects the editor/reviewer')
    a.triggered.connect(toggle_nm_from_main)
    cut = gc("shortcut toggle", "")
    if cut:
        a.setShortcut(QKeySequence(cut))
Beispiel #17
0
def setupMenu(ed):
    a = QAction('Regenerating pitch accent svgs', ed)
    if HOT_KEY:
        a.setShortcut(QKeySequence(HOT_KEY))
    a.triggered.connect(lambda: onRegenGlosses(ed))
    ed.form.menuEdit.addSeparator()
    ed.form.menuEdit.addAction(a)
def insert_reviewer_more_action(self, m):
    #self is Reviewer
    a = m.addAction('Browse Creation of This Card')
    a.setShortcut(QKeySequence("c"))
    a.connect(a, SIGNAL("triggered()"), lambda s=self: browse_this_card(s))
    a = m.addAction('Browse Creation of Last Card')
    a.connect(a, SIGNAL("triggered()"), lambda s=self: browse_last_card(s))
def showContextMenu(self):
    opts = [
        [_("Mark Note"), "*", self.onMark],
        [_("Bury Note"), "-", self.onBuryNote],
        [_("Suspend Card"), "@", self.onSuspendCard],
        [_("Suspend Note"), "!", self.onSuspend],
        [_("Delete Note"), "Delete", self.onDelete],
        [_("Options"), "O", self.onOptions],
        None,
        [_("Replay Audio"), "R", self.replayAudio],
        [_("Record Own Voice"), "Shift+V", self.onRecordVoice],
        [_("Replay Own Voice"), "V", self.onReplayRecorded],
    ]
    m = QMenu(self.mw)
    for row in opts:
        if not row:
            m.addSeparator()
            continue
        label, scut, func = row
        a = m.addAction(label)
        a.setShortcut(QKeySequence(scut))
        a.connect(a, SIGNAL("triggered()"), func)
        #Only change is the following statement
    runHook("Reviewer.contextMenuEvent", self, m)
    m.exec_(QCursor.pos())
Beispiel #20
0
def on_browser_menus_did_init(self: Browser) -> None:
    action = self.form.menu_Cards.addAction("Learn now")
    qconnect(action.triggered, self.onBrowserPutToLearn)

    if shortcut := config.get('shortcut'):
        action.setShortcut(QKeySequence(shortcut))
        action.setText(f"Learn now ({shortcut})")
Beispiel #21
0
 def setupShortcuts(self):
     # if a third element is provided, enable shortcut even when no field selected
     cuts = [
         ("Ctrl+L", self.onCardLayout, True),
         ("Ctrl+B", self.toggleBold),
         ("Ctrl+I", self.toggleItalic),
         ("Ctrl+U", self.toggleUnderline),
         ("Ctrl++", self.toggleSuper),
         ("Ctrl+=", self.toggleSub),
         ("Ctrl+R", self.removeFormat),
         ("F7", self.onForeground),
         ("F8", self.onChangeCol),
         ("Ctrl+Shift+C", self.onCloze),
         ("Ctrl+Shift+Alt+C", self.onCloze),
         ("F3", self.onAddMedia),
         ("F5", self.onRecSound),
         ("Ctrl+T, T", self.insertLatex),
         ("Ctrl+T, E", self.insertLatexEqn),
         ("Ctrl+T, M", self.insertLatexMathEnv),
         ("Ctrl+M, M", self.insertMathjaxInline),
         ("Ctrl+M, E", self.insertMathjaxBlock),
         ("Ctrl+M, C", self.insertMathjaxChemistry),
         ("Ctrl+Shift+X", self.onHtmlEdit),
         ("Ctrl+Shift+T", self.onFocusTags, True)
     ]
     runHook("setupEditorShortcuts", cuts, self)
     for row in cuts:
         if len(row) == 2:
             keys, fn = row
             fn = self._addFocusCheck(fn)
         else:
             keys, fn, _ = row
         QShortcut(QKeySequence(keys), self.widget, activated=fn)
Beispiel #22
0
def setup_menu(browser):
    menu = browser.form.menu_Notes
    before = browser.form.actionClear_Unused_Tags
    browser.form.actionFind_replace_tags = action = QAction(
        'Find and Replace Tags (RegEx)')
    menu.insertAction(before, action)
    action.setShortcut(QKeySequence("Ctrl+Alt+Shift+R"))
    action.triggered.connect(lambda: Replacer(browser))
def extend_debug_console(dc_instance):

    # OVERWRITE built-in context menu
    frm = mw.debug_diag_form
    frm.log.contextMenuEvent = lambda ev: addContextMenu(
        ev, "log", dc_instance)
    frm.text.contextMenuEvent = lambda ev: addContextMenu(
        ev, "text", dc_instance)

    cut = gc("debug console: shortcut open history window", "ctrl+i")
    if cut:
        hist_window = QShortcut(QKeySequence(cut), dc_instance)
        hist_window.activated.connect(lambda d=dc_instance: history_helper(d))
    cut = gc("debug console: shortcut save", "ctrl+s")
    if cut:
        save = QShortcut(QKeySequence(cut), dc_instance)
        save.activated.connect(lambda d=dc_instance: save_current(d))
Beispiel #24
0
def add_menu(browser):
    menu = browser.form.menuEdit
    menu.addSeparator()
    a = menu.addAction("Batch clean HTML...")
    cut = getUserOption("shortcut_browser_batch_clean")
    if cut:
        a.setShortcut(QKeySequence(cut))
    a.triggered.connect(lambda _, b=browser: onBatchClean(b))
Beispiel #25
0
    def onAdvanced(self):
        m = QMenu(self.mw)
        a = m.addAction(_("MathJax inline"))
        a.triggered.connect(self.insertMathjaxInline)
        a.setShortcut(QKeySequence("Ctrl+M, M"))
        a = m.addAction(_("MathJax block"))
        a.triggered.connect(self.insertMathjaxBlock)
        a.setShortcut(QKeySequence("Ctrl+M, E"))
        a = m.addAction(_("MathJax chemistry"))
        a.triggered.connect(self.insertMathjaxChemistry)
        a.setShortcut(QKeySequence("Ctrl+M, C"))
        a = m.addAction(_("LaTeX"))
        a.triggered.connect(self.insertLatex)
        a.setShortcut(QKeySequence("Ctrl+T, T"))
        a = m.addAction(_("LaTeX equation"))
        a.triggered.connect(self.insertLatexEqn)
        a.setShortcut(QKeySequence("Ctrl+T, E"))
        a = m.addAction(_("LaTeX math env."))
        a.triggered.connect(self.insertLatexMathEnv)
        a.setShortcut(QKeySequence("Ctrl+T, M"))
        a = m.addAction(_("Edit HTML"))
        a.triggered.connect(self.onHtmlEdit)
        a.setShortcut(QKeySequence("Ctrl+Shift+X"))

        qtMenuShortcutWorkaround(m)

        m.exec_(QCursor.pos())
Beispiel #26
0
def setup_clear_button(self):
    # size=False tells Anki not to use a small button
    clear_button = self._addButton("clear_button",
                                   lambda s=self: clear_button_pressed(self),
                                   text="Clear",
                                   size=False)
    clear_shortcut = "Ctrl+k"
    clear_button.setShortcut(QKeySequence(clear_shortcut))
    clear_button.setToolTip("Clear all fields: " + clear_shortcut)
Beispiel #27
0
def setup_to_button(self):
    to_button = self._addButton("to_button",
                                lambda s=self: to_button_pressed(self),
                                text="to <VERB>",
                                size=False)
    to_shortcut = "Ctrl+o"
    to_button.setShortcut(QKeySequence(to_shortcut))
    to_button.setToolTip("Add \"to \" in front of english word (for verbs): " +
                         to_shortcut)
Beispiel #28
0
def setup_fill_button(self):
    # size=False tells Anki not to use a small button
    fill_button = self._addButton("fill_button",
                                  lambda s=self: fill_button_pressed(self),
                                  text="Fill",
                                  size=False)
    fill_shortcut = "Ctrl+j"
    fill_button.setShortcut(QKeySequence(fill_shortcut))
    fill_button.setToolTip("Fill all fields: " + fill_shortcut)
Beispiel #29
0
 def __init__(self, mw, parent):
     QDialog.__init__(self, parent, Qt.Window)
     self.mw = mw
     self.parent = parent
     self.deck = self.parent.deck
     self.dialog = aqt.forms.taglimit.Ui_Dialog()
     self.dialog.setupUi(self)
     s = QShortcut(QKeySequence("ctrl+d"),
                   self.dialog.activeList,
                   context=Qt.WidgetShortcut)
     s.activated.connect(self.dialog.activeList.clearSelection)
     s = QShortcut(QKeySequence("ctrl+d"),
                   self.dialog.inactiveList,
                   context=Qt.WidgetShortcut)
     s.activated.connect(self.dialog.inactiveList.clearSelection)
     self.rebuildTagList()
     restoreGeom(self, "tagLimit")
     self.exec_()
def setupEditorButtonsFilter(buttons, editor):
    shortcut = getUserOption("Shortcut", "Ctrl+Shift+L")
    in_tip = QKeySequence(shortcut).toString(QKeySequence.NativeText)
    buttons.append(
        editor.addButton(os.path.join(addon_path, "icons", "link.svg"),
                         "card_button",
                         create_link,
                         tip=f"Link to card ({in_tip})",
                         keys=shortcut))
    return buttons