display time difference & more info in clock off msg; i18n it

This commit is contained in:
Damien Elmes 2013-10-20 10:26:11 +09:00
parent bab63de768
commit 58f13f1e9a
2 changed files with 22 additions and 12 deletions

View file

@ -808,16 +808,23 @@ title="%s">%s</button>''' % (
def newMsg(self, data): def newMsg(self, data):
aqt.update.showMessages(self, data) aqt.update.showMessages(self, data)
def clockIsOff(self): def clockIsOff(self, diff):
showWarning("""\ warn = _("""\
In order to ensure your collection works correctly when moved between \ In order to ensure your collection works correctly when moved between \
devices, Anki requires the system clock to be set correctly. Your system \ devices, Anki requires your computer's internal clock to be set correctly. \
clock appears to be wrong by more than 5 minutes. The internal clock can be wrong even if your system is showing the correct \
local time.
This can be because the \ Please go to the time settings on your computer and check the following:
clock is slow or fast, because the date is set incorrectly, or because \
the timezone or daylight savings information is incorrect. Please correct \ - AM/PM
the problem and restart Anki.""") - Clock drift
- Day, month and year
- Timezone
- Daylight savings
Difference to correct time: %d seconds.""") % diff
showWarning(warn)
self.app.closeAllWindows() self.app.closeAllWindows()
# Count refreshing # Count refreshing

View file

@ -1,14 +1,17 @@
# Copyright: Damien Elmes <anki@ichi2.net> # Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import urllib
import urllib2
import time
from aqt.qt import * from aqt.qt import *
import urllib, urllib2, time
import aqt import aqt
import platform
from aqt.utils import openLink from aqt.utils import openLink
from anki.utils import json, isWin, isMac, platDesc from anki.utils import json, platDesc
from aqt.utils import showText from aqt.utils import showText
class LatestVersionFinder(QThread): class LatestVersionFinder(QThread):
def __init__(self, main): def __init__(self, main):
@ -45,7 +48,7 @@ class LatestVersionFinder(QThread):
self.emit(SIGNAL("newVerAvail"), resp['ver']) self.emit(SIGNAL("newVerAvail"), resp['ver'])
diff = resp['time'] - time.time() diff = resp['time'] - time.time()
if abs(diff) > 300: if abs(diff) > 300:
self.emit(SIGNAL("clockIsOff")) self.emit(SIGNAL("clockIsOff"), diff)
def askAndUpdate(mw, ver): def askAndUpdate(mw, ver):
baseStr = ( baseStr = (