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