mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
fix help links; add tooltip when loading browser
This commit is contained in:
parent
ba15b41949
commit
167dc79550
16 changed files with 36 additions and 34 deletions
|
@ -6,7 +6,8 @@ from aqt.qt import *
|
|||
|
||||
appVersion="2.0-alpha3"
|
||||
appWebsite="http://ankisrs.net/"
|
||||
appHelpSite="http://ankisrs.net/docs/dev/"
|
||||
appHelpSite="http://ankisrs.net/docs/dev/manual.html"
|
||||
appChanges="http://ankisrs.net/docs/dev/changes.html"
|
||||
appDonate="http://ankisrs.net/support/"
|
||||
appShared="http://beta.ankiweb.net/shared/"
|
||||
mw = None # set on init
|
||||
|
|
|
@ -47,7 +47,7 @@ class AddCards(QDialog):
|
|||
self.mw, self.form.modelArea)
|
||||
|
||||
def helpRequested(self):
|
||||
openHelp("AddItems")
|
||||
openHelp("addingnotes")
|
||||
|
||||
def setupButtons(self):
|
||||
bb = self.form.buttonBox
|
||||
|
|
|
@ -828,7 +828,7 @@ where id in %s""" % ids2str(sf))
|
|||
return sf
|
||||
|
||||
def onHelp(self):
|
||||
openHelp("Browser")
|
||||
openHelp("browser")
|
||||
|
||||
# Misc menu options
|
||||
######################################################################
|
||||
|
@ -1121,7 +1121,7 @@ where id in %s""" % ids2str(self.selectedCards()), usn, mod)
|
|||
})
|
||||
|
||||
def onFindReplaceHelp(self):
|
||||
openHelp("Browser#FindReplace")
|
||||
openHelp("findreplace")
|
||||
|
||||
# Edit: finding dupes
|
||||
######################################################################
|
||||
|
@ -1397,7 +1397,7 @@ Are you sure you want to continue?""")):
|
|||
return QDialog.accept(self)
|
||||
|
||||
def onHelp(self):
|
||||
openHelp("Browser#ChangeModel")
|
||||
openHelp("browsermisc")
|
||||
|
||||
# Toolbar
|
||||
######################################################################
|
||||
|
|
|
@ -9,7 +9,7 @@ import aqt
|
|||
from anki.sound import playFromText, clearAudioQueue
|
||||
from aqt.utils import saveGeom, restoreGeom, getBase, mungeQA, \
|
||||
saveSplitter, restoreSplitter, showInfo, askUser, getOnlyText, \
|
||||
showWarning, openHelp
|
||||
showWarning, openHelp, openLink
|
||||
from anki.utils import isMac, isWin
|
||||
|
||||
class CardLayout(QDialog):
|
||||
|
@ -87,7 +87,7 @@ class CardLayout(QDialog):
|
|||
pform = aqt.forms.preview.Ui_Form()
|
||||
pform.setupUi(right)
|
||||
def linkClicked(url):
|
||||
QDesktopServices.openUrl(QUrl(url))
|
||||
openLink(url)
|
||||
for wig in pform.front, pform.back:
|
||||
wig.page().setLinkDelegationPolicy(
|
||||
QWebPage.DelegateExternalLinks)
|
||||
|
@ -276,4 +276,4 @@ Enter deck to place new %s cards in, or leave blank:""") %
|
|||
return QDialog.reject(self)
|
||||
|
||||
def onHelp(self):
|
||||
openHelp("CardLayout")
|
||||
openHelp("templates")
|
||||
|
|
|
@ -21,7 +21,7 @@ class DeckConf(QDialog):
|
|||
self.setWindowModality(Qt.WindowModal)
|
||||
self.connect(self.form.buttonBox,
|
||||
SIGNAL("helpRequested()"),
|
||||
lambda: openHelp("StudyOptions"))
|
||||
lambda: openHelp("deckoptions"))
|
||||
self.connect(self.form.confOpts, SIGNAL("clicked()"), self.confOpts)
|
||||
self.form.confOpts.setText(u"▾")
|
||||
self.connect(self.form.buttonBox.button(QDialogButtonBox.RestoreDefaults),
|
||||
|
|
|
@ -481,7 +481,7 @@ class Editor(object):
|
|||
form = aqt.forms.edithtml.Ui_Dialog()
|
||||
form.setupUi(d)
|
||||
d.connect(form.buttonBox, SIGNAL("helpRequested()"),
|
||||
lambda: openHelp("HtmlEditor"))
|
||||
lambda: openHelp("editor"))
|
||||
form.textEdit.setPlainText(self.note.fields[self.currentField])
|
||||
form.textEdit.moveCursor(QTextCursor.End)
|
||||
d.exec_()
|
||||
|
|
|
@ -155,4 +155,4 @@ class FieldDialog(QDialog):
|
|||
self.reject()
|
||||
|
||||
def onHelp(self):
|
||||
openHelp("Fields")
|
||||
openHelp("fields")
|
||||
|
|
|
@ -65,7 +65,7 @@ class UpdateMap(QDialog):
|
|||
self.exec_()
|
||||
|
||||
def helpRequested(self):
|
||||
openHelp("FileImport")
|
||||
openHelp("importing")
|
||||
|
||||
def accept(self):
|
||||
self.updateKey = (
|
||||
|
@ -147,7 +147,7 @@ class ImportDialog(QDialog):
|
|||
By default, Anki will detect the character between fields, such as
|
||||
a tab, comma, and so on. If Anki is detecting the character incorrectly,
|
||||
you can enter it here. Use \\t to represent tab."""),
|
||||
self, help="FileImport")
|
||||
self, help="importing")
|
||||
str = str.replace("\\t", "\t")
|
||||
str = str.encode("ascii")
|
||||
self.hideMapping()
|
||||
|
|
|
@ -19,7 +19,7 @@ import aqt, aqt.progress, aqt.webview, aqt.toolbar
|
|||
from aqt.utils import saveGeom, restoreGeom, showInfo, showWarning, \
|
||||
saveState, restoreState, getOnlyText, askUser, GetTextDialog, \
|
||||
askUserDialog, applyStyles, getText, showText, showCritical, getFile, \
|
||||
tooltip
|
||||
tooltip, openHelp, openLink
|
||||
|
||||
## fixme: open plugin folder broken on win32?
|
||||
|
||||
|
@ -674,10 +674,10 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
|
|||
aqt.about.show(self)
|
||||
|
||||
def onDonate(self):
|
||||
QDesktopServices.openUrl(QUrl(aqt.appDonate))
|
||||
openLink(aqt.appDonate)
|
||||
|
||||
def onDocumentation(self):
|
||||
QDesktopServices.openUrl(QUrl(aqt.appHelpSite))
|
||||
openHelp("")
|
||||
|
||||
# Importing & exporting
|
||||
##########################################################################
|
||||
|
|
|
@ -18,7 +18,7 @@ class Models(QDialog):
|
|||
self.form = aqt.forms.models.Ui_Dialog()
|
||||
self.form.setupUi(self)
|
||||
self.connect(self.form.buttonBox, SIGNAL("helpRequested()"),
|
||||
lambda: openHelp("Models"))
|
||||
lambda: openHelp("notetypes"))
|
||||
self.setupModels()
|
||||
self.exec_()
|
||||
|
||||
|
@ -102,7 +102,7 @@ class Models(QDialog):
|
|||
d.setWindowTitle(_("Options for %s") % self.model['name'])
|
||||
self.connect(
|
||||
frm.buttonBox, SIGNAL("helpRequested()"),
|
||||
lambda: openHelp("NoteOptions"))
|
||||
lambda: openHelp("latex"))
|
||||
d.exec_()
|
||||
self.model['latexPre'] = unicode(frm.latexHeader.toPlainText())
|
||||
self.model['latexPost'] = unicode(frm.latexFooter.toPlainText())
|
||||
|
@ -168,4 +168,4 @@ class AddModel(QDialog):
|
|||
QDialog.accept(self)
|
||||
|
||||
def onHelp(self):
|
||||
openHelp("AddModel")
|
||||
openHelp("notetypes")
|
||||
|
|
|
@ -17,7 +17,7 @@ class Preferences(QDialog):
|
|||
self.form = aqt.forms.preferences.Ui_Preferences()
|
||||
self.form.setupUi(self)
|
||||
self.connect(self.form.buttonBox, SIGNAL("helpRequested()"),
|
||||
lambda: openHelp("Preferences"))
|
||||
lambda: openHelp("profileprefs"))
|
||||
self.setupCollection()
|
||||
self.setupLang()
|
||||
self.setupNetwork()
|
||||
|
|
|
@ -8,7 +8,7 @@ from aqt.qt import *
|
|||
from anki.utils import fmtTimeSpan, stripHTML, isMac
|
||||
from anki.hooks import addHook, runHook, runFilter
|
||||
from anki.sound import playFromText, clearAudioQueue, hasSound
|
||||
from aqt.utils import mungeQA, getBase, shortcut
|
||||
from aqt.utils import mungeQA, getBase, shortcut, openLink
|
||||
import aqt
|
||||
|
||||
class Reviewer(object):
|
||||
|
@ -208,7 +208,7 @@ function _typeAnsPress() {
|
|||
(cmd, arg) = url.split(":", 1)
|
||||
self.typedAnswer = arg
|
||||
else:
|
||||
QDesktopServices.openUrl(QUrl(url))
|
||||
openLink(url)
|
||||
|
||||
# CSS
|
||||
##########################################################################
|
||||
|
|
|
@ -6,6 +6,7 @@ import urllib, urllib2, os, sys, time, httplib
|
|||
import anki, anki.utils, anki.lang, anki.stats
|
||||
import aqt
|
||||
import simplejson, platform
|
||||
from aqt.utils import openLink
|
||||
|
||||
baseUrl = "http://ankiweb.net/update/"
|
||||
#baseUrl = "http://localhost:8001/update/"
|
||||
|
@ -65,7 +66,7 @@ def askAndUpdate(parent, version=None):
|
|||
# ignore this update
|
||||
parent.config['suppressUpdate'] = version
|
||||
elif ret == QMessageBox.Yes:
|
||||
QDesktopServices.openUrl(QUrl(aqt.appWebsite))
|
||||
openLink(aqt.appWebsite)
|
||||
|
||||
def showMessages(main, data):
|
||||
aqt.ui.utils.showText(data['msg'], main, type="html")
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
import os, cPickle, ctypes, shutil
|
||||
from aqt.qt import *
|
||||
from anki.utils import isMac, isWin
|
||||
from aqt.utils import openHelp
|
||||
from anki import Collection
|
||||
from anki.importing import Anki1Importer
|
||||
from anki.db import DB
|
||||
import aqt
|
||||
|
||||
class Upgrader(object):
|
||||
|
||||
|
@ -131,7 +131,8 @@ carefully, as a lot has changed since the previous Anki version."""))
|
|||
def isComplete(self):
|
||||
return False
|
||||
def initializePage(self):
|
||||
openHelp("changes")
|
||||
# can't use openLink; gui not ready for tooltips
|
||||
QDesktopServices.openUrl(QUrl(aqt.appChanges))
|
||||
self.setCommitPage(True)
|
||||
self.setTitle(_("Upgrading"))
|
||||
self.label = l = QLabel()
|
||||
|
|
13
aqt/utils.py
13
aqt/utils.py
|
@ -7,15 +7,14 @@ import aqt
|
|||
from anki.sound import playFromText, stripSounds
|
||||
from anki.utils import call, isWin, isMac
|
||||
|
||||
def openHelp(name):
|
||||
if "#" in name:
|
||||
name = name.split("#")
|
||||
name = name[0] + ".html#" + name[1]
|
||||
else:
|
||||
name = name + ".html"
|
||||
QDesktopServices.openUrl(QUrl(aqt.appHelpSite + name))
|
||||
def openHelp(section):
|
||||
link = aqt.appHelpSite
|
||||
if section:
|
||||
link += "#%s" % section
|
||||
openLink(link)
|
||||
|
||||
def openLink(link):
|
||||
tooltip(_("Loading..."), period=1000)
|
||||
QDesktopServices.openUrl(QUrl(link))
|
||||
|
||||
def showWarning(text, parent=None, help=""):
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
import sys
|
||||
from aqt.qt import *
|
||||
from aqt.utils import fontForPlatform
|
||||
from aqt.utils import fontForPlatform, openLink
|
||||
from anki.utils import isMac
|
||||
import anki.js
|
||||
QtConfig = pyqtconfig.Configuration()
|
||||
|
@ -105,7 +105,7 @@ button {
|
|||
def eval(self, js):
|
||||
self.page().mainFrame().evaluateJavaScript(js)
|
||||
def _openLinksExternally(self, url):
|
||||
QDesktopServices.openUrl(QUrl(url))
|
||||
openLink(url)
|
||||
def _jsErr(self, msg, line, srcID):
|
||||
sys.stderr.write(_("JS error on line %(a)d: %(b)s") % dict(a=line, b=msg+"\n"))
|
||||
def _linkHandler(self, url):
|
||||
|
|
Loading…
Reference in a new issue