コード例 #1
0
ファイル: overview.py プロジェクト: DrModesto/ankiqt
 def _linkHandler(self, url):
     if url == "study":
         self.mw.col.startTimebox()
         self.mw.moveToState("review")
     elif url == "anki":
         print "anki menu"
     elif url == "opts":
         self.mw.onDeckConf()
     elif url == "cram":
         deck = self.mw.col.decks.current()
         self.mw.onCram("'deck:%s'" % deck['name'])
     elif url == "refresh":
         self.mw.col.sched.rebuildDyn()
         self.mw.reset()
     elif url == "empty":
         self.mw.col.sched.emptyDyn(self.mw.col.decks.selected())
         self.mw.reset()
     elif url == "decks":
         self.mw.moveToState("deckBrowser")
     elif url == "review":
         openLink(aqt.appShared+"info/%s?v=%s"%(self.sid, self.sidVer))
     elif url == "limits":
         self.onLimits()
     else:
         openLink(url)
コード例 #2
0
ファイル: __main__.py プロジェクト: brumar/anknotes
 def __init__(self):
     if not mw.col.conf.get(SETTING_TOKEN, False):
         # First run of the Plugin we did not save the access key yet
         client = EvernoteClient(
             consumer_key='scriptkiddi-2682',
             consumer_secret='965f1873e4df583c',
             sandbox=False
         )
         request_token = client.get_request_token('http://brunomart.in/anknotes/index.html')
         url = client.get_authorize_url(request_token)
         showInfo("We will open a Evernote Tab in your browser so you can allow access to your account")
         openLink(url)
         oauth_verifier = getText(prompt="Please copy the code that showed up, after allowing access, in here")[0]
         secret_key = getText(prompt="protect your value with a password, it will be asked each time you import your notes")[0]
         auth_token = client.get_access_token(
             request_token.get('oauth_token'),
             request_token.get('oauth_token_secret'),
             oauth_verifier)
         mw.col.conf[SETTING_TOKEN] = encode(secret_key, auth_token)
     else:
         secret_key = getText(prompt="password")[0]
         auth_token_encoded = mw.col.conf.get(SETTING_TOKEN, False)
         auth_token = decode(secret_key, auth_token_encoded)
     self.token = auth_token
     self.client = EvernoteClient(token=auth_token, sandbox=False)
     self.noteStore = self.client.get_note_store()
コード例 #3
0
    def __init__(self):

        if USE_APPLESCRIPT is False:

            if not mw.col.conf.get(SETTING_TOKEN, False):
                # First run of the Plugin we did not save the access key yet
                client = EvernoteClient(
                    consumer_key='scriptkiddi-2682',
                    consumer_secret='965f1873e4df583c',
                    sandbox=False
                )
                request_token = client.get_request_token('https://fap-studios.de/anknotes/index.html')
                url = client.get_authorize_url(request_token)
                showInfo("We will open a Evernote Tab in your browser so you can allow access to your account")
                openLink(url)
                oauth_verifier = getText(prompt="Please copy the code that showed up, after allowing access, in here")[0]
                auth_token = client.get_access_token(
                    request_token.get('oauth_token'),
                    request_token.get('oauth_token_secret'),
                    oauth_verifier)
                mw.col.conf[SETTING_TOKEN] = auth_token
            else:
                auth_token = mw.col.conf.get(SETTING_TOKEN, False)

            self.token = auth_token
            self.client = EvernoteClient(token=auth_token, sandbox=False)
            self.noteStore = self.client.get_note_store()
コード例 #4
0
ファイル: overview.py プロジェクト: MichaelBlume/anki
 def _linkHandler(self, url):
     if url == "study":
         self.mw.col.startTimebox()
         self.mw.moveToState("review")
         if self.mw.state == "overview":
             tooltip(_("No cards are due yet."))
     elif url == "anki":
         print "anki menu"
     elif url == "opts":
         self.mw.onDeckConf()
     elif url == "cram":
         deck = self.mw.col.decks.current()
         self.mw.onCram("'deck:%s'" % deck['name'])
     elif url == "refresh":
         self.mw.col.sched.rebuildDyn()
         self.mw.reset()
     elif url == "empty":
         self.mw.col.sched.emptyDyn(self.mw.col.decks.selected())
         self.mw.reset()
     elif url == "decks":
         self.mw.moveToState("deckBrowser")
     elif url == "review":
         openLink(aqt.appShared+"info/%s?v=%s"%(self.sid, self.sidVer))
     elif url == "studymore":
         self.onStudyMore()
     elif url.lower().startswith("http"):
         openLink(url)
コード例 #5
0
ファイル: ankEvernote.py プロジェクト: holycrepe/anknotes
 def setup_client(self):
     auth_token = SETTINGS.EVERNOTE.AUTH_TOKEN.fetch()
     if not auth_token:
         # First run of the Plugin we did not save the access key yet
         secrets = {'holycrepe': '36f46ea5dec83d4a', 'scriptkiddi-2682': '965f1873e4df583c'}
         client = EvernoteClient(
             consumer_key=EVERNOTE.API.CONSUMER_KEY,
             consumer_secret=secrets[EVERNOTE.API.CONSUMER_KEY],
             sandbox=EVERNOTE.API.IS_SANDBOXED
         )
         request_token = client.get_request_token('https://fap-studios.de/anknotes/index.html')
         url = client.get_authorize_url(request_token)
         showInfo("We will open a Evernote Tab in your browser so you can allow access to your account")
         openLink(url)
         oauth_verifier = getText(prompt="Please copy the code that showed up, after allowing access, in here")[0]
         auth_token = client.get_access_token(
             request_token.get('oauth_token'),
             request_token.get('oauth_token_secret'),
             oauth_verifier)
         SETTINGS.EVERNOTE.AUTH_TOKEN.save(auth_token)
     else:
         client = EvernoteClient(token=auth_token, sandbox=EVERNOTE.API.IS_SANDBOXED)
     self.token = auth_token
     self.client = client
     log("Set up Evernote Client", 'client')
コード例 #6
0
ファイル: addons.py プロジェクト: Glutanimate/anki
 def onViewPage(self):
     addon = self.onlyOneSelected()
     if not addon:
         return
     if re.match(r"^\d+$", addon):
         openLink(aqt.appShared + "info/{}".format(addon))
     else:
         showWarning(_("Add-on was not downloaded from AnkiWeb."))
コード例 #7
0
ファイル: ui.py プロジェクト: hoeken/chinese-support-addon
def display_next_tip():
    (tip, link) = chinese_support_config.get_next_tip()
    if tip:
        if link:
            if askUser(tip):
                openLink(link)
        else:
            showInfo(tip)
コード例 #8
0
ファイル: webview.py プロジェクト: bbugyi200/anki
    def _onHeight(self, qvar):
        if qvar is None:
            from aqt import mw
            openLink("https://anki.tenderapp.com/kb/problems/anki-must-be-able-to-connect-to-a-local-port")
            mw.app.closeAllWindows()
            return

        height = math.ceil(qvar*self.zoomFactor())
        self.setFixedHeight(height)
コード例 #9
0
ファイル: webview.py プロジェクト: jdennis/anki
 def acceptNavigationRequest(self, url, navType, isMainFrame):
     if not isMainFrame:
         return True
     from aqt import mw
     # ignore href=#
     if url.toString().startswith(mw.serverURL()):
         return False
     # load all other links in browser
     openLink(url)
     return False
コード例 #10
0
ファイル: reviewer.py プロジェクト: cdepillabout/ankiqt
 def _linkHandler(self, url):
     if url == "ans":
         self._showAnswer()
     elif url.startswith("ease"):
         self._answerCard(int(url[4:]))
     elif url == "edit":
         self.mw.onEditCurrent()
     elif url == "more":
         self.showContextMenu()
     elif url.startswith("typeans:"):
         (cmd, arg) = url.split(":", 1)
         self.typedAnswer = arg
     else:
         openLink(url)
コード例 #11
0
ファイル: webview.py プロジェクト: Glutanimate/anki
 def acceptNavigationRequest(self, url, navType, isMainFrame):
     if not isMainFrame:
         return True
     # data: links generated by setHtml()
     if url.scheme() == "data":
         return True
     # catch buggy <a href='#' onclick='func()'> links
     from aqt import mw
     if url.matches(QUrl(mw.serverURL()), QUrl.RemoveFragment):
         print("onclick handler needs to return false")
         return False
     # load all other links in browser
     openLink(url)
     return False
コード例 #12
0
ファイル: update.py プロジェクト: nichtleiter/ankiqt
def askAndUpdate(mw, ver):
    baseStr = _("""<h1>Anki Updated</h1>Anki %s has been released.<br><br>""") % ver
    msg = QMessageBox(mw)
    msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
    msg.setIcon(QMessageBox.Information)
    msg.setText(baseStr + _("Would you like to download it now?"))
    button = QPushButton(_("Ignore this update"))
    msg.addButton(button, QMessageBox.RejectRole)
    msg.setDefaultButton(QMessageBox.Yes)
    ret = msg.exec_()
    if msg.clickedButton() == button:
        # ignore this update
        mw.pm.meta["suppressUpdate"] = ver
    elif ret == QMessageBox.Yes:
        openLink(aqt.appWebsite)
コード例 #13
0
ファイル: overview.py プロジェクト: kchien/ankiqt
 def _linkHandler(self, url):
     print "link", url
     if url == "study":
         self.mw.col.startTimebox()
         self.mw.moveToState("review")
     elif url == "anki":
         print "anki menu"
     elif url == "opts":
         self.mw.onDeckConf()
     elif url == "refresh":
         self.mw.col.sched.rebuildDyn()
         self.mw.reset()
     elif url == "decks":
         self.mw.moveToState("deckBrowser")
     elif url == "review":
         openLink(aqt.appShared+"info/%s?v=%s"%(self.sid, self.sidVer))
コード例 #14
0
ファイル: overview.py プロジェクト: aaronharsh/ankiqt
 def _linkHandler(self, url):
     print "link", url
     if url == "study":
         self.mw.moveToState("review")
     elif url == "anki":
         print "anki menu"
     elif url == "cram":
         return showInfo("not yet implemented")
         #self.mw.col.cramGroups()
         #self.mw.moveToState("review")
     elif url == "opts":
         self.mw.onDeckConf()
     elif url == "decks":
         self.mw.moveToState("deckBrowser")
     elif url == "review":
         openLink(aqt.appShared+"info/%s?v=%s"%(self.sid, self.sidVer))
コード例 #15
0
ファイル: print.py プロジェクト: Araeos/derived-ankiplugins
def onPrint():
    path = os.path.join(mw.pm.profileFolder(), "print.html")
    ids = sortFieldOrderCids(mw.col.decks.selected())
    def esc(s):
        # strip off the repeated question in answer if exists
        #s = re.sub("(?si)^.*<hr id=answer>\n*", "", s)
        # remove type answer
        s = re.sub("\[\[type:[^]]+\]\]", "", s)
        return s
    def upath(path):
        if isWin:
            prefix = u"file:///"
        else:
            prefix = u"file://"
        return prefix + unicode(
            urllib.quote(path.encode("utf-8")), "utf-8")
    buf = open(path, "w")
    buf.write("<html><head>" +
              '<meta charset="utf-8">'
              + getBase(mw.col).encode("utf8") + "</head><body>")
    buf.write("""<style>
img { max-width: 100%; }
tr { page-break-after:auto; }
td { page-break-after:auto; }
td { border: 1px solid #ccc; padding: 1em; }
</style><table cellspacing=10 width=100%>""")
    first = True

    mw.progress.start(immediate=True)
    for j, cid in enumerate(ids):
        if j % CARDS_PER_ROW == 0:
            if not first:
                buf.write("</tr>")
            else:
                first = False
            buf.write("<tr>")
        c = mw.col.getCard(cid)
        cont = u"<td><center>%s</center></td>" % esc(c._getQA(True, False)['a'])
        buf.write(cont.encode("utf8"))
        if j % 50 == 0:
            mw.progress.update("Cards exported: %d" % (j+1))
    buf.write("</tr>")
    buf.write("</table></body></html>")
    mw.progress.finish()
    buf.close()
    openLink(upath(path))
コード例 #16
0
ファイル: update.py プロジェクト: ClashTheBunny/ankiqt
def askAndUpdate(parent, version=None):
    version = version['latestVersion']
    baseStr = (
        _('''<h1>Anki Updated</h1>Anki %s has been released.<br><br>''') %
        version)
    msg = QMessageBox(parent)
    msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
    msg.setIcon(QMessageBox.Information)
    msg.setText(baseStr + _("Would you like to download it now?"))
    button = QPushButton(_("Ignore this update"))
    msg.addButton(button, QMessageBox.RejectRole)
    ret = msg.exec_()
    if msg.clickedButton() == button:
        # ignore this update
        parent.config['suppressUpdate'] = version
    elif ret == QMessageBox.Yes:
        openLink(aqt.appWebsite)
コード例 #17
0
ファイル: __init__.py プロジェクト: dae/ankiplugins
def onPrint():
    path = os.path.join(QStandardPaths.writableLocation(
        QStandardPaths.DesktopLocation), "print.html")
    ids = sortFieldOrderCids(mw.col.decks.selected())
    def esc(s):
        # strip off the repeated question in answer if exists
        #s = re.sub("(?si)^.*<hr id=answer>\n*", "", s)
        # remove type answer
        s = re.sub(r"\[\[type:[^]]+\]\]", "", s)
        return s
    buf = open(path, "w", encoding="utf8")
    buf.write("<html><head>" +
              '<meta charset="utf-8">'
              + mw.baseHTML() + "</head><body>")
    buf.write("""<style>
img { max-width: 100%; }
tr { page-break-inside:avoid; page-break-after:auto }
td { page-break-after:auto; }
td { border: 1px solid #ccc; padding: 1em; }
</style><table cellspacing=10 width=100%>""")
    first = True

    mw.progress.start(immediate=True)
    for j, cid in enumerate(ids):
        if j % config['cardsPerRow'] == 0:
            if not first:
                buf.write("</tr>")
            else:
                first = False
            buf.write("<tr>")
        c = mw.col.getCard(cid)
        qatxt = c._getQA(True, False)['a']
        qatxt = mungeQA(mw.col, qatxt)
        cont = u'<td width="{1}%"><center>{0}</center></td>'.format(
            esc(qatxt), 100/config['cardsPerRow'])
        buf.write(cont)
        if j % 50 == 0:
            mw.progress.update("Cards exported: %d" % (j+1))
    buf.write("</tr>")
    buf.write("</table></body></html>")
    mw.progress.finish()
    buf.close()
    openLink(QUrl.fromLocalFile(path))
コード例 #18
0
    def acceptNavigationRequest(self, url: QUrl, navType: Any,
                                isMainFrame: bool) -> bool:
        if (not self.open_links_externally or "_anki/pages" in url.path()
                or url.path() == "/_anki/legacyPageData"):
            return super().acceptNavigationRequest(url, navType, isMainFrame)

        if not isMainFrame:
            return True
        # data: links generated by setHtml()
        if url.scheme() == "data":
            return True
        # catch buggy <a href='#' onclick='func()'> links
        from aqt import mw

        if url.matches(QUrl(mw.serverURL()),
                       cast(Any, QUrl.UrlFormattingOption.RemoveFragment)):
            print("onclick handler needs to return false")
            return False
        # load all other links in browser
        openLink(url)
        return False
コード例 #19
0
ファイル: gui.py プロジェクト: multani/chinese-support-redux
def load_menu():
    dictionaries = [
        ('en', _('English')),
        ('de', _('German')),
        ('fr', _('French')),
        (None, _('None')),
    ]

    for d, name in dictionaries:
        add_menu_item(
            'Chinese::Set Dictionary',
            name,
            partial(config.update, {'dictionary': d}),
            checkable=True,
            checked=bool(config['dictionary'] == d),
        )

    for t in transcriptions:
        add_menu_item(
            'Chinese::Set Transcription',
            t,
            partial(config.update, {'transcription': t}),
            checkable=True,
            checked=bool(config['transcription'] == t),
        )

    for s in speech_engines:
        add_menu_item(
            'Chinese::Set Speech Engine',
            s,
            partial(config.update, {'speech': s}),
            checkable=True,
            checked=bool(config['speech'] == s),
        )

    add_menu('Chinese::Fill Notes')
    add_menu_item('Chinese::Fill Notes', _('Fill Hanzi'), bulk_fill_hanzi)
    add_menu_item('Chinese::Fill Notes', _('Fill Transcription'),
                  bulk_fill_transcript)
    add_menu_item('Chinese::Fill Notes', _('Fill Definitions'), bulk_fill_defs)
    add_menu_item('Chinese::Fill Notes', _('Fill Sound'), bulk_fill_sound)
    add_menu_item('Chinese::Fill Notes', _('Fill Silhouette'),
                  bulk_fill_silhouette)

    add_menu('Chinese::Help')
    add_menu_item(
        'Chinese::Help',
        _('Report a bug or make a feature request'),
        lambda: openLink(CSR_GITHUB_URL + '/issues'),
    )
    add_menu_item('Chinese::Help', _('About...'), showAbout)
コード例 #20
0
 def _linkHandler(self, url):
     if url == "study":
         self.mw.col.startTimebox()
         self.mw.moveToState("review")
     elif url == "anki":
         print "anki menu"
     elif url == "opts":
         self.mw.onDeckConf()
     elif url == "cram":
         deck = self.mw.col.decks.current()
         self.mw.onCram("'deck:%s'" % deck['name'])
     elif url == "refresh":
         self.mw.col.sched.rebuildDyn()
         self.mw.reset()
     elif url == "empty":
         self.mw.col.sched.emptyDyn(self.mw.col.decks.selected())
         self.mw.reset()
     elif url == "decks":
         self.mw.moveToState("deckBrowser")
     elif url == "review":
         openLink(aqt.appShared + "info/%s?v=%s" % (self.sid, self.sidVer))
     elif url == "limits":
         self.onLimits()
コード例 #21
0
def loadMenu():
    global ui_actions

    menu = mw.form.menuTools.addMenu("Korean Support")

    submenu = menu.addMenu(_("Use local dictionary"))
    for d, d_names in dictionaries:
        ui_actions["dict_" + d] = add_action(
            d_names, submenu, set_dict_constructor(d), True
        )

    #    submenu = menu.addMenu(_('Use Microsoft Translate'))
    #    for name, code in msTranslateLanguages:
    #        ui_actions['dict_' + code] = add_action(
    #            name, submenu, set_dict_constructor(code), True)

    submenu = menu.addMenu(_("Text-to-speech"))
    subsubmenu = submenu.addMenu(_("Set speech engine"))
    for i in speech_options:
        ui_actions["speech_" + i] = add_action(
            i, subsubmenu, set_option_constructor("speech", i), True
        )
    ui_actions["tts_slow"] = add_action(
        _("Use slow speed"), submenu, toggle_option_constructor("tts_slow"), True
    )
    subsubmenu = submenu.addMenu(_("NAVER Papago Gender"))
    for name, i in naver_gender_options:
        ui_actions["naver_tts_gender_" + i] = add_action(
            name, subsubmenu, set_option_constructor("naver_tts_gender", i), True
        )

    submenu = menu.addMenu(_("Fill incomplete notes"))
    add_action(_("Fill missing sounds"), submenu, fill_sounds)
    add_action(_("Fill translation"), submenu, fill_translation)
    add_action(_("Fill silhouette"), submenu, fill_silhouette)

    submenu = menu.addMenu(_("Help"))
    add_action(
        _("Report a bug or make a feature request"),
        submenu,
        lambda: openLink(CSR_GITHUB_URL + "/issues"),
    )
    ui_actions["debug"] = add_action(
        _("Debug mode"), submenu, toggle_option_constructor("debug"), True
    )

    add_action(_("About..."), menu, showAbout)

    update_dict_action_checkboxes()
コード例 #22
0
    def openInBrowser(self, website, query):
        """
            Setup enviroment for web browser and invoke it
        """

        note = self._currentNote
        self._lastProvider = website
        Feedback.log('OpenInBrowser: {}'.format(note))

        if cfg.getConfig().useSystemBrowser:
            target = self._browser.formatTargetURL(website, query)
            openLink(target)
            return

        fieldList = note.model()['flds']
        fieldsNames = {
            ind: val
            for ind, val in enumerate(map(lambda i: i['name'], fieldList))
        }
        self._browser.infoList = [
            'No action available', 'Required: Text selected or link to image'
        ]
        self._browser.setFields(fieldsNames)
        self._browser.open(website, query)
コード例 #23
0
ファイル: bridge.py プロジェクト: willmhuynh/emacs
 def __call__(self, url, *args):
     if url.lower().startswith("http"):
         return openLink(url)
     elif url == "domDone":
         self._onDomDone()
         return False
     elif not url.startswith(AMBOSS_LINK_PREFIX):
         return True
     _, cmd, *data = url.split(":")
     if cmd == "login" and len(data) >= 2:
         userId, token = data[0], data[1]
         self._loginHandler.login(userId, token)
     elif cmd == "close":
         self._loginDialog.accept()
     return False
コード例 #24
0
    def openInBrowser(self, website, query, note, isEditMode=False):
        """
            Setup enviroment for web browser and invoke it
        """

        self._currentNote = note
        Feedback.log('OpenInBrowser: {} ({})'.format(note, self.isEditing()))

        if cfg.getConfig().useSystemBrowser:
            target = self._browser.formatTargetURL(website, query)
            openLink(target)
            return

        if self.isEditing():
            fieldList = note.model()['flds']
            fieldsNames = {
                ind: val
                for ind, val in enumerate(map(lambda i: i['name'], fieldList))
            }
            self._browser.setFields(fieldsNames)
        else:
            self._browser.setFields(None)  # clear fields

        self._browser.open(website, query)
コード例 #25
0
def create_get_help_submenu(parent: QMenu) -> QMenu:
    submenu_name = "Get Anki Help"
    menu_options = [
        (
            "Online Mastery Course",
            "https://courses.ankipalace.com/?utm_source=anking_bg_add-on&utm_medium=anki_add-on&utm_campaign=mastery_course",
        ),
        ("Daily Q and A Support", "https://www.ankipalace.com/memberships"),
        ("1-on-1 Tutoring", "https://www.ankipalace.com/tutoring"),
    ]
    submenu = QMenu(submenu_name, parent)
    for name, url in menu_options:
        act = QAction(name, mw)
        act.triggered.connect(lambda _, u=url: openLink(u))
        submenu.addAction(act)
    return submenu
コード例 #26
0
 def _linkHandler(self, url):
     """Support for binding custom actions to text links"""
     if isinstance(url, QUrl):
         url = url.toString()
     if not url.startswith("action://"):
         return openLink(url)
     protocol, cmd = url.split("://")
     if cmd == "debug-toggle":
         self._toggleDebugging()
     elif cmd == "debug-open":
         self._openDebuglog()
     elif cmd == "debug-copy":
         self._copyDebuglog()
     elif cmd == "debug-clear":
         self._clearDebuglog()
     elif cmd == "changelog":
         self._openChangelog()
コード例 #27
0
def loadMenu():
    global ui_actions

    menu = mw.form.menuTools.addMenu('Chinese Support')

    submenu = menu.addMenu(_('Use local dictionary'))
    for d, d_names in dictionaries:
        ui_actions['dict_' + d] = add_action(d_names, submenu,
                                             set_dict_constructor(d), True)


#    submenu = menu.addMenu(_('Use Microsoft Translate'))
#    for name, code in msTranslateLanguages:
#        ui_actions['dict_' + code] = add_action(
#            name, submenu, set_dict_constructor(code), True)

    submenu = menu.addMenu(_('Set transcription'))
    for i in transcriptions:
        ui_actions['transcription_' + i] = add_action(
            i, submenu, set_option_constructor('transcription', i), True)

    submenu = menu.addMenu(_('Set speech engine'))
    for i in speech_options:
        ui_actions['speech_' + i] = add_action(
            i, submenu, set_option_constructor('speech', i), True)

    submenu = menu.addMenu(_('Fill incomplete notes'))
    add_action(_('Fill missing sounds'), submenu, fill_sounds)
    add_action(_('Fill pinyin and color'), submenu, fill_pinyin)
    add_action(_('Fill translation'), submenu, fill_translation)
    add_action(_('Fill simplified/traditional'), submenu, fill_simp_trad)
    add_action(_('Fill silhouette'), submenu, fill_silhouette)

    submenu = menu.addMenu(_('Help'))
    add_action(_('Report a bug or make a feature request'), submenu,
               lambda: openLink(CSR_GITHUB_URL + '/issues'))

    add_action(_('About...'), menu, showAbout)

    update_dict_action_checkboxes()
コード例 #28
0
def load_menu():
    for k, v in PHONETIC_TARGETS.items():
        add_menu_item(
            'Chinese::Phonetics',
            k,
            partial(config.update, {'target': v}),
            checkable=True,
            checked=bool(config['target'] == v),
        )

    for k, v in SPEECH_ENGINES.items():
        add_menu_item(
            'Chinese::Speech Engine',
            k,
            partial(config.update, {'speech': v}),
            checkable=True,
            checked=bool(config['speech'] == v),
        )

    add_menu('Chinese::Bulk Fill')
    add_menu_item('Chinese::Bulk Fill', _('Hanzi'), bulk_fill_hanzi)
    add_menu_item('Chinese::Bulk Fill', _('Transcription'),
                  bulk_fill_transcript)
    add_menu_item('Chinese::Bulk Fill', _('Definitions'), bulk_fill_defs)
    add_menu_item('Chinese::Bulk Fill', _('Classifiers'),
                  bulk_fill_classifiers)
    add_menu_item('Chinese::Bulk Fill', _('Sound'), bulk_fill_sound)
    add_menu_item('Chinese::Bulk Fill', _('Silhouette'), bulk_fill_silhouette)
    add_menu_item('Chinese::Bulk Fill', _('Usage'), bulk_fill_usage)
    add_menu_item('Chinese::Bulk Fill', _('All'), bulk_fill_all)

    add_menu('Chinese::Help')
    add_menu_item(
        'Chinese::Help',
        _('Report a bug or make a feature request'),
        lambda: openLink(CSR_GITHUB_URL + '/issues'),
    )
    add_menu_item('Chinese::Help', _('About...'), showAbout)
コード例 #29
0
ファイル: ui.py プロジェクト: hoeken/chinese-support-addon
def goto_page(page):
    openLink(page)
コード例 #30
0
ファイル: addmcds.py プロジェクト: bryanlyon/mcdsupport
 def helpRequested(self):
     openLink('http://code.google.com/p/mcdsupport/wiki/Help')
コード例 #31
0
ファイル: deckbrowser.py プロジェクト: kchien/ankiqt
 def _onShared(self):
     print "fixme: check & warn if schema modified first"
     openLink(aqt.appShared+"decks/")
コード例 #32
0
ファイル: webview.py プロジェクト: Glutanimate/anki
 def _openLinksExternally(self, url):
     openLink(url)
コード例 #33
0
 def linkClicked(url):
     openLink(url)
コード例 #34
0
ファイル: about.py プロジェクト: kingdynasty/anki
 def onLink(url):
     openLink(url.toString())
コード例 #35
0
def setup_plugin():
    openLink("https://github.com/ttempe/chinese-support-addon/wiki/Setup-Instructions")
コード例 #36
0
def on_help():
    url = "https://github.com/RumovZ/find-replace-tags/"
    openLink(url)
コード例 #37
0
def help_plugin():
    openLink("https://github.com/ttempe/chinese-support-addon/wiki")
コード例 #38
0
ファイル: addons.py プロジェクト: subfusc/anki
 def onBrowse(self):
     openLink(aqt.appShared + "addons/")
コード例 #39
0
ファイル: webview.py プロジェクト: Stvad/anki
 def acceptNavigationRequest(self, url, navType, isMainFrame):
     # load all other links in browser
     openLink(url)
     return False
コード例 #40
0
 def _onShared(self) -> None:
     openLink(f"{aqt.appShared}decks/")
コード例 #41
0
def attemptOpenLink(cmd):
    if cmd.startswith('openLink:'):
        openLink(cmd[9:])
コード例 #42
0
ファイル: Preview.py プロジェクト: JeffDonovan/anki-addons
 def linkClicked(url):
     openLink(url)
コード例 #43
0
    def getAboutTab(self):
        tab_4 = QWidget()
        tab_4.setObjectName("tab_4")
        tab4vl = QVBoxLayout()
        miaAbout = QGroupBox()
        miaAbout.setTitle('Mass Immersion Approach')
        miaAboutVL = QVBoxLayout()

        miaAbout.setStyleSheet("QGroupBox { font-weight: bold; } ")
        miaAboutText = QLabel(
            "This an original MIA add-on. MIA, or “Mass Immersion Approach,” is a comprehensive approach to acquiring foreign languages. You can learn more <a href='https://massimmersionapproach.com'>here</a>."
        )
        miaAboutText.setWordWrap(True)
        miaAboutText.setOpenExternalLinks(True)
        miaAbout.setLayout(miaAboutVL)
        miaAboutLinksTitle = QLabel("<b>Links<b>")
        miaAboutLinksMIA = QLabel("MIA:")
        miaAboutLinksHL1 = QHBoxLayout()

        miaSiteIcon = self.getSVGWidget('MIA.svg')
        miaSiteIcon.setCursor(QCursor(Qt.PointingHandCursor))

        miaFBIcon = self.getSVGWidget('Facebook.svg')
        miaFBIcon.setCursor(QCursor(Qt.PointingHandCursor))

        miaPatreonIcon = self.getSVGWidget('Patreon.svg')
        miaPatreonIcon.setCursor(QCursor(Qt.PointingHandCursor))

        miaAboutLinksHL1.addWidget(miaAboutLinksMIA)
        miaAboutLinksHL1.addWidget(miaSiteIcon)
        miaAboutLinksHL1.addWidget(miaFBIcon)
        miaAboutLinksHL1.addWidget(miaPatreonIcon)
        miaAboutLinksHL1.addStretch()
        miaAboutLinksHL2 = QHBoxLayout()
        miaAboutLinksHL3 = QHBoxLayout()

        matt = QLabel("Matt vs. Japan:")
        mattYT = MIALabel()

        mattYT = self.getSVGWidget('Youtube.svg')
        mattYT.setCursor(QCursor(Qt.PointingHandCursor))

        mattTW = self.getSVGWidget('Twitter.svg')
        mattTW.setCursor(QCursor(Qt.PointingHandCursor))

        miaAboutLinksHL2.addWidget(matt)
        miaAboutLinksHL2.addWidget(mattYT)
        miaAboutLinksHL2.addWidget(mattTW)
        miaAboutLinksHL2.addStretch()

        yoga = QLabel("Yoga MIA:")
        yogaYT = self.getSVGWidget('Youtube.svg')
        yogaYT.setCursor(QCursor(Qt.PointingHandCursor))

        yogaTW = self.getSVGWidget('Twitter.svg')
        yogaTW.setCursor(QCursor(Qt.PointingHandCursor))

        miaAboutLinksHL3.addWidget(yoga)
        miaAboutLinksHL3.addWidget(yogaYT)
        miaAboutLinksHL3.addWidget(yogaTW)
        miaAboutLinksHL3.addStretch()

        miaAboutVL.addWidget(miaAboutText)
        miaAboutVL.addWidget(miaAboutLinksTitle)
        miaAboutVL.addLayout(miaAboutLinksHL1)
        miaAboutVL.addLayout(miaAboutLinksHL2)
        miaAboutVL.addLayout(miaAboutLinksHL3)

        miaContact = QGroupBox()
        miaContact.setTitle('Contact Us')
        miaContactVL = QVBoxLayout()
        miaContact.setStyleSheet("QGroupBox { font-weight: bold; } ")
        miaContactText = QLabel(
            "If you would like to report a bug or contribute to the add-on, the best way to do so is by starting a ticket or pull request on GitHub. If you are looking for personal assistance using the add-on, check out the MIA Patreon Discord Server."
        )
        miaContactText.setWordWrap(True)

        gitHubIcon = self.getSVGWidget('Github.svg')
        gitHubIcon.setCursor(QCursor(Qt.PointingHandCursor))

        miaThanks = QGroupBox()
        miaThanks.setTitle('A Word of Thanks')
        miaThanksVL = QVBoxLayout()
        miaThanks.setStyleSheet("QGroupBox { font-weight: bold; } ")
        miaThanksText = QLabel(
            "We would not have been able to develop this add-on without the support our  <a href='https://www.patreon.com/join/massimmersionapproach?'>patrons</a>. Special thanks to Harrison D, Rafael C, Isaac, Jean-Felix M, Shaquille G, Zdennis, Tj B, Daniel L, Grinners, Garrett H, Mirzhan I, Matt S, Abdulrazzaq A, Darwish, Stian F, Aaron G, Stephen K, Keith W, Jermal, Jacob R, Renfred H, Luvoir, David L, David J, Stein E, Eric J M, and everyone else who supports MIA on Patreon!"
        )
        miaThanksText.setOpenExternalLinks(True)
        miaThanksText.setWordWrap(True)
        miaThanksVL.addWidget(miaThanksText)

        miaContactVL.addWidget(miaContactText)
        miaContactVL.addWidget(gitHubIcon)
        miaContact.setLayout(miaContactVL)
        miaThanks.setLayout(miaThanksVL)
        tab4vl.addWidget(miaAbout)
        tab4vl.addWidget(miaContact)
        tab4vl.addWidget(miaThanks)
        tab4vl.addStretch()
        tab_4.setLayout(tab4vl)

        miaSiteIcon.clicked.connect(
            lambda: openLink('https://massimmersionapproach.com/'))
        miaFBIcon.clicked.connect(lambda: openLink(
            'https://www.facebook.com/MassImmersionApproach/'))
        miaPatreonIcon.clicked.connect(
            lambda: openLink('https://www.patreon.com/massimmersionapproach'))
        mattYT.clicked.connect(lambda: openLink(
            'https://www.youtube.com/user/MATTvsJapan?sub_confirmation=1'))
        mattTW.clicked.connect(
            lambda: openLink('https://twitter.com/mattvsjapan'))
        yogaYT.clicked.connect(lambda: openLink(
            'https://www.youtube.com/c/yogamia?sub_confirmation=1'))
        yogaTW.clicked.connect(
            lambda: openLink('https://twitter.com/Yoga_MIA'))
        gitHubIcon.clicked.connect(
            lambda: openLink('https://github.com/mass-immersion-approach'))
        return tab_4
コード例 #44
0
 def onBrowse(self):
     openLink(aqt.appShared + "addons21/2.1")
コード例 #45
0
ファイル: main.py プロジェクト: terrisage/Anki
 def onDonate(self):
     openLink(aqt.appDonate)
コード例 #46
0
ファイル: main.py プロジェクト: fossabot/anki
 def onDonate(self):
     """Ask the OS to open the donate web page"""
     openLink(aqt.appDonate)
コード例 #47
0
 def _onShared(self):
     print "fixme: check & warn if schema modified first"
     openLink(aqt.appShared + "decks/")
コード例 #48
0
 def _onShared(self):
     openLink(aqt.appShared + "decks/")
コード例 #49
0
def invoke_ImageOcc_help():
    utils.openLink(image_occlusion_help_link)
コード例 #50
0
ファイル: course.py プロジェクト: r-appleton/addons
 def help(self, page=None):
     if self._help:
         openLink(
             'file:///' +
             os.path.join(self._help[0], page if page else self._help[1]))
コード例 #51
0
ファイル: deckbrowser.py プロジェクト: intact/anki
 def _onShared(self):
     openLink(aqt.appShared+"decks/")
コード例 #52
0
 def _openLinksExternally(self, url: str) -> None:
     openLink(url)
コード例 #53
0
 def onGiovanni(self):
     openLink(self._giovanni_link)
コード例 #54
0
ファイル: main.py プロジェクト: jdeut/ankiqt
 def onDonate(self):
     openLink(aqt.appDonate)
コード例 #55
0
 def onGlutanimate(self):
     openLink(self._glutanimate_link)
コード例 #56
0
    def getAboutTab(self):
        tab_4 = QWidget()
        tab_4.setObjectName("tab_4")
        tab4vl = QVBoxLayout()
        migakuAbout = QGroupBox()
        migakuAbout.setTitle('Migaku')
        migakuAboutVL = QVBoxLayout()

        migakuAbout.setStyleSheet("QGroupBox { font-weight: bold; } ")
        migakuAboutText = QLabel(
            "This an original Migaku add-on. Migaku seeks to be a comprehensive platform for acquiring foreign languages. The official Migaku website will be published soon!"
        )
        migakuAboutText.setWordWrap(True)
        migakuAboutText.setOpenExternalLinks(True)
        migakuAbout.setLayout(migakuAboutVL)
        migakuAboutLinksTitle = QLabel("<b>Links<b>")

        migakuAboutLinksHL3 = QHBoxLayout()

        migakuInfo = QLabel("Migaku:")
        migakuInfoYT = self.getSVGWidget('Youtube.svg')
        migakuInfoYT.setCursor(QCursor(Qt.PointingHandCursor))

        migakuInfoTW = self.getSVGWidget('Twitter.svg')
        migakuInfoTW.setCursor(QCursor(Qt.PointingHandCursor))

        migakuPatreonIcon = self.getSVGWidget('Patreon.svg')
        migakuPatreonIcon.setCursor(QCursor(Qt.PointingHandCursor))
        migakuAboutLinksHL3.addWidget(migakuInfo)
        migakuAboutLinksHL3.addWidget(migakuInfoYT)
        migakuAboutLinksHL3.addWidget(migakuInfoTW)
        migakuAboutLinksHL3.addWidget(migakuPatreonIcon)
        migakuAboutLinksHL3.addStretch()

        migakuAboutVL.addWidget(migakuAboutText)
        migakuAboutVL.addWidget(migakuAboutLinksTitle)
        migakuAboutVL.addLayout(migakuAboutLinksHL3)

        migakuContact = QGroupBox()
        migakuContact.setTitle('Contact Us')
        migakuContactVL = QVBoxLayout()
        migakuContact.setStyleSheet("QGroupBox { font-weight: bold; } ")
        migakuContactText = QLabel(
            "If you would like to report a bug or contribute to the add-on, the best way to do so is by starting a ticket or pull request on GitHub. If you are looking for personal assistance using the add-on, check out the Migaku Patreon Discord Server."
        )
        migakuContactText.setWordWrap(True)

        gitHubIcon = self.getSVGWidget('Github.svg')
        gitHubIcon.setCursor(QCursor(Qt.PointingHandCursor))

        migakuThanks = QGroupBox()
        migakuThanks.setTitle('A Word of Thanks')
        migakuThanksVL = QVBoxLayout()
        migakuThanks.setStyleSheet("QGroupBox { font-weight: bold; } ")
        migakuThanksText = QLabel(
            "Thanks so much to all Migaku supporters! I would not have been able to develop this add-on or any other Migaku project without your support!"
        )
        migakuThanksText.setOpenExternalLinks(True)
        migakuThanksText.setWordWrap(True)
        migakuThanksVL.addWidget(migakuThanksText)

        migakuContactVL.addWidget(migakuContactText)
        migakuContactVL.addWidget(gitHubIcon)
        migakuContact.setLayout(migakuContactVL)
        migakuThanks.setLayout(migakuThanksVL)
        tab4vl.addWidget(migakuAbout)
        tab4vl.addWidget(migakuContact)
        tab4vl.addWidget(migakuThanks)
        tab4vl.addStretch()
        tab_4.setLayout(tab4vl)

        migakuPatreonIcon.clicked.connect(
            lambda: openLink('https://www.patreon.com/Migaku'))
        migakuInfoYT.clicked.connect(
            lambda: openLink('https://www.youtube.com/c/ImmerseWithYoga'))
        migakuInfoTW.clicked.connect(
            lambda: openLink('https://twitter.com/Migaku_Yoga'))
        gitHubIcon.clicked.connect(lambda: openLink(
            'https://github.com/migaku-official/Migaku-Dictionary-Addon'))
        return tab_4
コード例 #57
0
 def acceptNavigationRequest(self, url, navType, isMainFrame):
     if not isMainFrame:
         return True
     # load all other links in browser
     openLink(url)
     return False
コード例 #58
0
ファイル: webview.py プロジェクト: usawarion/anki
 def _openLinksExternally(self, url):
     openLink(url)
コード例 #59
0
def launch_doc():
    utils.openLink(DOCURL)