diff --git a/anki/__init__.py b/anki/__init__.py index d7f33c917..213d10587 100644 --- a/anki/__init__.py +++ b/anki/__init__.py @@ -30,6 +30,6 @@ if arch[1] == "ELF": sys.path.insert(0, os.path.join(ext, "py2.%d-%s" % ( 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 __all__ = ["Collection"] diff --git a/anki/media.py b/anki/media.py index 7d37e8354..7493964b1 100644 --- a/anki/media.py +++ b/anki/media.py @@ -384,6 +384,15 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0); if not os.path.getsize(f): os.unlink(f) 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? if f not in self.cache: added.append(f) @@ -432,6 +441,7 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0); def forceResync(self): self.db.execute("delete from media") + self.db.execute("update meta set lastUsn=0,dirMod=0") self.db.execute("vacuum analyze") self.db.commit() diff --git a/anki/sync.py b/anki/sync.py index d3d261f85..cab986cae 100644 --- a/anki/sync.py +++ b/anki/sync.py @@ -608,7 +608,7 @@ class RemoteServer(HttpSyncer): def syncURL(self): if os.getenv("DEV"): - return "http://localhost:5000/sync/" + return "https://l1.ankiweb.net/sync/" return SYNC_BASE + "sync/" def hostKey(self, user, pw): @@ -673,6 +673,8 @@ class FullSyncer(HttpSyncer): self.col = col def syncURL(self): + if os.getenv("DEV"): + return "https://l1.ankiweb.net/sync/" return SYNC_BASE + "sync/" def download(self): @@ -801,6 +803,7 @@ class MediaSyncer(object): if serverLastUsn - processedCnt == lastUsn: self.col.log("lastUsn in sync, updating local") + lastUsn = serverLastUsn self.col.media.setLastUsn(serverLastUsn) # commits else: self.col.log("concurrent update, skipping usn update") @@ -848,7 +851,7 @@ class RemoteMediaServer(HttpSyncer): def syncURL(self): if os.getenv("DEV"): - return "http://localhost:5001/" + return "https://l1.ankiweb.net/msync/" return SYNC_BASE + "msync/" def begin(self): diff --git a/aqt/__init__.py b/aqt/__init__.py index f6c0bf2fb..61aa24158 100644 --- a/aqt/__init__.py +++ b/aqt/__init__.py @@ -53,7 +53,7 @@ class DialogManager(object): def open(self, name, *args): (creator, instance) = self._dialogs[name] if instance: - instance.setWindowState(Qt.WindowActive) + instance.setWindowState(instance.windowState() | Qt.WindowActive) instance.activateWindow() instance.raise_() return instance @@ -253,4 +253,4 @@ environment points to a valid, writable folder.""") # load the main window import aqt.main mw = aqt.main.AnkiQt(app, pm, args) - app.exec_() \ No newline at end of file + app.exec_()