Example #1
0
    def _setup_ui(self) -> None:
        self.setWindowTitle(tr.scheduling_description())
        self.setWindowModality(Qt.WindowModality.ApplicationModal)
        self.mw.garbage_collect_on_dialog_finish(self)
        self.setMinimumWidth(400)
        disable_help_button(self)
        restoreGeom(self, self.TITLE)
        addCloseShortcut(self)

        box = QVBoxLayout()

        self.enable_markdown = QCheckBox(
            tr.deck_config_description_new_handling())
        self.enable_markdown.setToolTip(
            tr.deck_config_description_new_handling_hint())
        self.enable_markdown.setChecked(self.deck.get("md", False))
        box.addWidget(self.enable_markdown)

        self.description = QPlainTextEdit()
        self.description.setPlainText(self.deck.get("desc", ""))
        box.addWidget(self.description)

        button_box = QDialogButtonBox()
        ok = button_box.addButton(QDialogButtonBox.StandardButton.Ok)
        qconnect(ok.clicked, self.save_and_accept)
        box.addWidget(button_box)

        self.setLayout(box)
        self.show()
Example #2
0
def _renderBottom(self):
    """Override Overview._renderBottom in order to add Reset Limits button.

    TODO: there seems to be no clean way to add a button. I've resorted to
    copying the body of Overview._renderBottom and adding the link here.
    Hopefully we can find a better way to do this in the future.
    """
    links = [
        ["O", "opts", _options()],
    ]
    if self.mw.col.decks.current()['dyn']:
        links.append(["R", "refresh", _rebuild()])
        links.append(["E", "empty", _empty()])
    else:
        links.append(["C", "studymore", _custom_study()])
        #links.append(["F", "cram", _("Filter/Cram")])
    if self.mw.col.sched.haveBuried():
        links.append(["U", "unbury", _unbury()])
    # Import https://github.com/ankitects/anki/commit/f6a59ebdfa242daeda67e955d764ba98b553b6fa
    if _version_ge_2_1_45():
        links.append(["", "description", tr.scheduling_description()])
    links.append(["L", "resetLimits", "Reset Limit Increases"])
    buf = ""
    for b in links:
        if b[0]:
            b[0] = _("Shortcut key: %s") % shortcut(b[0])
        buf += """
<button title="%s" onclick='pycmd("%s")'>%s</button>""" % tuple(b)
    self.bottom.draw(buf)
    self.bottom.web.onBridgeCmd = self._linkHandler
Example #3
0
    def _setup_ui(self) -> None:
        self.setWindowTitle(tr.scheduling_description())
        self.setWindowModality(Qt.ApplicationModal)
        self.mw.garbage_collect_on_dialog_finish(self)
        self.setMinimumWidth(400)
        disable_help_button(self)
        restoreGeom(self, self.TITLE)
        addCloseShortcut(self)

        box = QVBoxLayout()

        label = QLabel(tr.scheduling_description_to_show_on_overview_screen())
        box.addWidget(label)

        self.enable_markdown = QCheckBox(tr.deck_config_description_markdown())
        self.enable_markdown.setToolTip(tr.deck_config_description_markdown_hint())
        self.enable_markdown.setChecked(self.deck.normal.markdown_description)
        box.addWidget(self.enable_markdown)

        self.description = QPlainTextEdit()
        self.description.setPlainText(self.deck.normal.description)
        box.addWidget(self.description)

        button_box = QDialogButtonBox()
        ok = button_box.addButton(QDialogButtonBox.Ok)
        qconnect(ok.clicked, self.save_and_accept)
        box.addWidget(button_box)

        self.setLayout(box)
        self.show()
Example #4
0
    def _renderBottom(self) -> None:
        links = [
            ["O", "opts", tr.actions_options()],
        ]
        if self.mw.col.decks.current()["dyn"]:
            links.append(["R", "refresh", tr.actions_rebuild()])
            links.append(["E", "empty", tr.studying_empty()])
        else:
            links.append(["C", "studymore", tr.actions_custom_study()])
            # links.append(["F", "cram", _("Filter/Cram")])
        if self.mw.col.sched.haveBuried():
            links.append(["U", "unbury", tr.studying_unbury()])
        links.append(["", "description", tr.scheduling_description()])
        buf = ""
        for b in links:
            if b[0]:
                b[0] = tr.actions_shortcut_key(val=shortcut(b[0]))
            buf += """
<button title="%s" onclick='pycmd("%s")'>%s</button>""" % tuple(b)
        self.bottom.draw(buf=buf,
                         link_handler=self._linkHandler,
                         web_context=OverviewBottomBar(self))