update help references and some old links

This commit is contained in:
Damien Elmes 2011-03-29 16:57:40 +09:00
parent 2d76f2516e
commit 292f6403a1
23 changed files with 46 additions and 95 deletions

View file

@ -8,8 +8,7 @@ from PyQt4.QtGui import *
appName="Anki"
appVersion="1.99"
appWebsite="http://ankisrs.net/"
appWiki="http://ankisrs.net/wiki/"
appHelpSite="http://ankisrs.net/docs/"
appHelpSite="http://ankisrs.net/docs/dev/"
appDonate="http://ankisrs.net/support/"
modDir=os.path.dirname(os.path.abspath(__file__))
runningDir=os.path.split(modDir)[0]
@ -19,6 +18,14 @@ if hasattr(sys, "frozen"):
sys.path.append(modDir)
modDir = os.path.dirname(sys.argv[0])
def openHelp(name):
if "#" in name:
name = name.split("#")
name = name[0] + ".html#" + name[1]
else:
name = name + ".html"
QDesktopServices.openUrl(QUrl(appHelpSite + name))
# Dialog manager - manages modeless windows
##########################################################################

View file

@ -14,7 +14,7 @@ def show(parent):
abouttext += '<p>' + _("Anki is a friendly, intelligent spaced learning \
system. It's free and open source.")
abouttext += '<p>' + _("Version %s") % appVersion + '<br>'
abouttext += _("<a href='http://ichi2.net/anki/'>Visit website</a>") + \
abouttext += (_("<a href='%s'>Visit website</a>") % aqt.appWebsite) + \
"</span>"
abouttext += '<p>' + _("Written by Damien Elmes, with patches, translation,\
testing and design from:<p>%(cont)s") % {'cont': u"""

View file

@ -129,8 +129,7 @@ class ActiveTagsChooser(QDialog):
QDialog.accept(self)
def onHelp(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki +
"SelectiveStudy"))
aqt.openHelp("SelectiveStudy")
def show(parent, type):
at = ActiveTagsChooser(parent, type)

View file

@ -59,7 +59,7 @@ class AddCards(QDialog):
self.dialog.modelArea.setLayout(self.modelChooser)
def helpRequested(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki + "AddItems"))
aqt.openHelp("AddItems")
def addButtons(self):
self.addButton = QPushButton(_("Add"))

View file

@ -1137,8 +1137,8 @@ where id in %s""" % ids2str(sf))
}, parent=self)
def onFindReplaceHelp(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki +
"Browser#FindReplace"))
aqt.openHelp("Browser#FindReplace")
# Edit: finding dupes
######################################################################
@ -1270,7 +1270,7 @@ select fm.id, fm.name from fieldmodels fm""")
######################################################################
def onHelp(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki + "Browser"))
aqt.openHelp("Browser")
# Generate card dialog
######################################################################
@ -1315,8 +1315,7 @@ order by ordinal""" % ids2str(self.cms))
QDialog.accept(self)
def onHelp(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki +
"Browser#GenerateCards"))
aqt.openHelp("Browser#GenerateCards")
# Change model dialog
######################################################################
@ -1476,5 +1475,4 @@ Are you sure you want to continue?"""), parent=self):
return QDialog.accept(self)
def onHelp(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki +
"Browser#ChangeModel"))
aqt.openHelp("Browser#ChangeModel")

View file

@ -325,8 +325,7 @@ order by n""", id=card.id)
QDialog.reject(self)
def onHelp(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki +
"CardLayout"))
aqt.openHelp("CardLayout")
# Fields
##########################################################################

View file

@ -147,8 +147,7 @@ class DeckProperties(QDialog):
self.d.setModified()
def helpRequested(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki +
"DeckProperties"))
aqt.openHelp("DeckProperties")
def reject(self):
n = _("Deck Properties")

View file

@ -884,8 +884,7 @@ class FactEditor(object):
def onHtmlEdit(self):
def helpRequested():
QDesktopServices.openUrl(QUrl(aqt.appWiki +
"HtmlEditor"))
aqt.openHelp("HtmlEditor")
w = self.focusedEdit()
if w:
self.saveFields()

View file

@ -24,8 +24,7 @@ class GroupConf(QDialog):
self.setup()
self.connect(self.form.buttonBox,
SIGNAL("helpRequested()"),
lambda: QDesktopServices.openUrl(QUrl(
aqt.appWiki + "GroupOptions")))
lambda: aqt.openHelp("GroupOptions"))
self.connect(self.form.buttonBox.button(QDialogButtonBox.RestoreDefaults),
SIGNAL("clicked()"),
self.onRestore)

View file

@ -63,8 +63,7 @@ class GroupManager(QDialog):
b = button(_("&Options..."), self.onEdit).setShortcut("o")
self.connect(box,
SIGNAL("helpRequested()"),
lambda: QDesktopServices.openUrl(QUrl(
aqt.appWiki + "GroupManager")))
lambda: aqt.openHelp("GroupManager"))
def onStudy(self):
self.mw.deck.reset()

View file

@ -66,7 +66,7 @@ class UpdateMap(QDialog):
self.exec_()
def helpRequested(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki + "FileImport"))
aqt.openHelp("FileImport")
def accept(self):
self.updateKey = (
@ -312,4 +312,4 @@ you can enter it here. Use \\t to represent tab."""),
QDialog.reject(self)
def helpRequested(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki + "FileImport"))
aqt.openHelp("FileImport")

View file

@ -205,5 +205,4 @@ class AddModel(QDialog):
QDialog.accept(self)
def onHelp(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki +
"AddModel"))
aqt.openHelp("AddModel")

View file

@ -252,8 +252,7 @@ class ModelProperties(QDialog):
self.ignoreCardUpdate = False
def helpRequested(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki +
"ModelProperties"))
aqt.openHelp("ModelProperties")
# Cleanup
##########################################################################

View file

@ -123,9 +123,6 @@ to work with this version of Anki."""))
path = self.pluginsFolder()
openFolder(path)
def onGetPlugins(self):
QDesktopServices.openUrl(QUrl("http://ichi2.net/anki/wiki/Plugins"))
def enablePlugin(self, p):
pd = self.pluginsFolder()
old = os.path.join(pd, p)

View file

@ -248,7 +248,4 @@ class Preferences(QDialog):
return self.codeToIndex("en")
def helpRequested(self):
idx = self.dialog.tabWidget.currentIndex()
QDesktopServices.openUrl(QUrl(aqt.appWiki +
"Preferences#" +
tabs[idx]))
aqt.openHelp("Preferences")

View file

@ -527,9 +527,8 @@ div#filler {
# progress
addWgt(vertSep())
class QClickableProgress(QProgressBar):
url = "http://ichi2.net/anki/wiki/ProgressBars"
def mouseReleaseEvent(self, evt):
QDesktopServices.openUrl(QUrl(self.url))
aqt.openHelp("ProgressBars")
progressBarSize = (50, 14)
self.progressBar = QClickableProgress()
self.progressBar.setFixedSize(*progressBarSize)
@ -590,10 +589,9 @@ div#filler {
def onLeech(self, card):
print "leech"
return
link = aqt.appHelpSite + "Leeches.html"
txt = (_("""\
<b>%s</b>... is a <a href="http://ichi2.net/anki/wiki/Leeches">leech</a>.""")
% stripHTML(stripSounds(self.currentCard.question)).\
replace("\n", " ")[0:30])
Card was a <a href="%s">leech</a>.""") % link)
if isLeech and self.deck.db.scalar(
"select 1 from cards where id = :id and type < 0", id=cardId):
txt += _(" It has been suspended.")

View file

@ -69,8 +69,8 @@
This is an exported packaged deck created by Anki.<p>
To share this deck with other people, upload it to
<a href="http://anki.ichi2.net/file/upload">
http://anki.ichi2.net/file/upload</a>, or email
<a href="http://ankiweb.net/file/upload">
http://ankiweb.net/file/upload</a>, or email
it to your friends.
</body></html>''')
readme.close()

View file

@ -16,8 +16,7 @@ class StudyOptions(QDialog):
self.load()
self.connect(self.form.buttonBox,
SIGNAL("helpRequested()"),
lambda: QDesktopServices.openUrl(QUrl(
aqt.appWiki + "StudyOptions")))
lambda: aqt.openHelp("StudyOptions"))
self.exec_()
def setup(self):

View file

@ -288,7 +288,7 @@ This deck already exists on your computer. Overwrite the local copy?"""),
vbox = QVBoxLayout()
l = QLabel(_(
'<h1>Online Account</h1>'
'To use your free <a href="http://anki.ichi2.net/">online account</a>,<br>'
'To use your free <a href="http://ankiweb.net/">online account</a>,<br>'
"please enter your details below.<br><br>"
"You can change your details later with<br>"
"Settings->Preferences->Sync<br>"))

View file

@ -8,7 +8,7 @@ import anki, anki.utils, anki.lang, anki.stats
import aqt
import simplejson, platform
baseUrl = "http://anki.ichi2.net/update/"
baseUrl = "http://ankiweb.net/update/"
#baseUrl = "http://localhost:8001/update/"
class LatestVersionFinder(QThread):

View file

@ -11,9 +11,6 @@ from anki.utils import call
def openLink(link):
QDesktopServices.openUrl(QUrl(link))
def openWikiLink(page):
openLink(aqt.appWiki + page)
def showWarning(text, parent=None, help=""):
"Show a small warning with an OK button."
return showInfo(text, parent, help, QMessageBox.warning)
@ -34,7 +31,7 @@ def showInfo(text, parent=None, help="", func=None):
while 1:
ret = func(parent, "Anki", text, sb)
if ret == QMessageBox.Help:
openWikiLink(help)
aqt.openHelp(help)
else:
break
@ -74,7 +71,7 @@ def askUser(text, parent=None, help="", defaultno=False):
r = QMessageBox.question(parent, "Anki", text, sb,
default)
if r == QMessageBox.Help:
openWikiLink(help)
aqt.openHelp(help)
else:
break
return r == QMessageBox.Yes
@ -105,7 +102,7 @@ class ButtonedDialog(QMessageBox):
but = self.clickedButton().text()
if but == "Help":
# FIXME stop dialog closing?
openWikiLink(self.help)
aqt.openHelp(self.help)
return self.clickedButton().text()
def setDefault(self, idx):
@ -156,7 +153,7 @@ class GetTextDialog(QDialog):
return QDialog.reject(self)
def helpRequested(self):
QDesktopServices.openUrl(QUrl(aqt.appWiki + self.help))
aqt.openHelp(self.help)
def getText(prompt, parent=None, help=None, edit=None, default=u"", title="Anki"):
if not parent:

View file

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>383</width>
<height>452</height>
<width>404</width>
<height>540</height>
</rect>
</property>
<property name="windowTitle">
@ -19,9 +19,6 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTabWidget" name="qtabwidget">
<property name="whatsThis">
<string>&lt;a href=&quot;http://ichi2.net/anki/wiki/DeckProperties#Synchronization&quot;&gt;Help&lt;/a&gt;</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
@ -183,20 +180,11 @@
<string>Advanced</string>
</attribute>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="6" column="2">
<widget class="QLineEdit" name="easyMin">
<property name="sizePolicy">

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>365</width>
<height>440</height>
<width>397</width>
<height>444</height>
</rect>
</property>
<property name="windowTitle">
@ -20,7 +20,7 @@
<enum>Qt::StrongFocus</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab_1">
<attribute name="title">
@ -173,31 +173,15 @@
<property name="spacing">
<number>10</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
</layout>
<layout class="QGridLayout"/>
</item>
<item>
<widget class="QLabel" name="label_16">
<property name="text">
<string>&lt;b&gt;Synchronisation&lt;/b&gt;&lt;a href=&quot;http://anki.ichi2.net/&quot;&gt;&lt;br&gt;Create a free account&lt;/a&gt;.</string>
<string>&lt;b&gt;Synchronisation&lt;/b&gt;&lt;a href=&quot;http://ankiweb.net/&quot;&gt;&lt;br&gt;Create a free account&lt;/a&gt;.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
@ -209,12 +193,6 @@
</item>
<item>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label_18">
<property name="text">