mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 08:22:24 -04:00
Merge branch 'master' of https://github.com/dae/anki
This commit is contained in:
commit
92072f57cd
4 changed files with 18 additions and 5 deletions
|
@ -30,6 +30,6 @@ if arch[1] == "ELF":
|
||||||
sys.path.insert(0, os.path.join(ext, "py2.%d-%s" % (
|
sys.path.insert(0, os.path.join(ext, "py2.%d-%s" % (
|
||||||
sys.version_info[1], arch[0][0:2])))
|
sys.version_info[1], arch[0][0:2])))
|
||||||
|
|
||||||
version="2.0.26" # build scripts grep this line, so preserve formatting
|
version="2.0.28" # build scripts grep this line, so preserve formatting
|
||||||
from anki.storage import Collection
|
from anki.storage import Collection
|
||||||
__all__ = ["Collection"]
|
__all__ = ["Collection"]
|
||||||
|
|
|
@ -384,6 +384,15 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0);
|
||||||
if not os.path.getsize(f):
|
if not os.path.getsize(f):
|
||||||
os.unlink(f)
|
os.unlink(f)
|
||||||
continue
|
continue
|
||||||
|
# check encoding
|
||||||
|
if not isMac:
|
||||||
|
normf = unicodedata.normalize("NFC", f)
|
||||||
|
if f != normf:
|
||||||
|
# wrong filename encoding which will cause sync errors
|
||||||
|
if os.path.exists(normf):
|
||||||
|
os.unlink(f)
|
||||||
|
else:
|
||||||
|
os.rename(f, normf)
|
||||||
# newly added?
|
# newly added?
|
||||||
if f not in self.cache:
|
if f not in self.cache:
|
||||||
added.append(f)
|
added.append(f)
|
||||||
|
@ -432,6 +441,7 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0);
|
||||||
|
|
||||||
def forceResync(self):
|
def forceResync(self):
|
||||||
self.db.execute("delete from media")
|
self.db.execute("delete from media")
|
||||||
|
self.db.execute("update meta set lastUsn=0,dirMod=0")
|
||||||
self.db.execute("vacuum analyze")
|
self.db.execute("vacuum analyze")
|
||||||
self.db.commit()
|
self.db.commit()
|
||||||
|
|
||||||
|
|
|
@ -608,7 +608,7 @@ class RemoteServer(HttpSyncer):
|
||||||
|
|
||||||
def syncURL(self):
|
def syncURL(self):
|
||||||
if os.getenv("DEV"):
|
if os.getenv("DEV"):
|
||||||
return "http://localhost:5000/sync/"
|
return "https://l1.ankiweb.net/sync/"
|
||||||
return SYNC_BASE + "sync/"
|
return SYNC_BASE + "sync/"
|
||||||
|
|
||||||
def hostKey(self, user, pw):
|
def hostKey(self, user, pw):
|
||||||
|
@ -673,6 +673,8 @@ class FullSyncer(HttpSyncer):
|
||||||
self.col = col
|
self.col = col
|
||||||
|
|
||||||
def syncURL(self):
|
def syncURL(self):
|
||||||
|
if os.getenv("DEV"):
|
||||||
|
return "https://l1.ankiweb.net/sync/"
|
||||||
return SYNC_BASE + "sync/"
|
return SYNC_BASE + "sync/"
|
||||||
|
|
||||||
def download(self):
|
def download(self):
|
||||||
|
@ -801,6 +803,7 @@ class MediaSyncer(object):
|
||||||
|
|
||||||
if serverLastUsn - processedCnt == lastUsn:
|
if serverLastUsn - processedCnt == lastUsn:
|
||||||
self.col.log("lastUsn in sync, updating local")
|
self.col.log("lastUsn in sync, updating local")
|
||||||
|
lastUsn = serverLastUsn
|
||||||
self.col.media.setLastUsn(serverLastUsn) # commits
|
self.col.media.setLastUsn(serverLastUsn) # commits
|
||||||
else:
|
else:
|
||||||
self.col.log("concurrent update, skipping usn update")
|
self.col.log("concurrent update, skipping usn update")
|
||||||
|
@ -848,7 +851,7 @@ class RemoteMediaServer(HttpSyncer):
|
||||||
|
|
||||||
def syncURL(self):
|
def syncURL(self):
|
||||||
if os.getenv("DEV"):
|
if os.getenv("DEV"):
|
||||||
return "http://localhost:5001/"
|
return "https://l1.ankiweb.net/msync/"
|
||||||
return SYNC_BASE + "msync/"
|
return SYNC_BASE + "msync/"
|
||||||
|
|
||||||
def begin(self):
|
def begin(self):
|
||||||
|
|
|
@ -53,7 +53,7 @@ class DialogManager(object):
|
||||||
def open(self, name, *args):
|
def open(self, name, *args):
|
||||||
(creator, instance) = self._dialogs[name]
|
(creator, instance) = self._dialogs[name]
|
||||||
if instance:
|
if instance:
|
||||||
instance.setWindowState(Qt.WindowActive)
|
instance.setWindowState(instance.windowState() | Qt.WindowActive)
|
||||||
instance.activateWindow()
|
instance.activateWindow()
|
||||||
instance.raise_()
|
instance.raise_()
|
||||||
return instance
|
return instance
|
||||||
|
|
Loading…
Reference in a new issue