diff --git a/ankiqt/__init__.py b/ankiqt/__init__.py index fbbc1ce32..fc2483161 100644 --- a/ankiqt/__init__.py +++ b/ankiqt/__init__.py @@ -6,7 +6,7 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * appName="Anki" -appVersion="1.2.8" +appVersion="1.99" appWebsite="http://ankisrs.net/" appWiki="http://ichi2.net/anki/wiki/" appHelpSite="http://ankisrs.net/docs/" diff --git a/ankiqt/config.py b/ankiqt/config.py index 25f8dfee1..f50bfbc3e 100644 --- a/ankiqt/config.py +++ b/ankiqt/config.py @@ -6,8 +6,7 @@ from PyQt4.QtGui import * from PyQt4.QtCore import * -import os, sys, cPickle, locale, types, shutil, time, re -from anki.utils import genID +import os, sys, cPickle, locale, types, shutil, time, re, random # compatability def unpickleWxFont(*args): @@ -61,7 +60,7 @@ class Config(dict): 'factEditorAdvanced': False, 'forceLTR': False, 'iconSize': 32, - 'id': genID(), + 'id': random.randrange(0, 2**63), 'interfaceLang': "", 'lastMsg': -1, 'loadLastDeck': False, diff --git a/ankiqt/ui/cardlist.py b/ankiqt/ui/cardlist.py index f79456ea6..8d7fa7c0a 100644 --- a/ankiqt/ui/cardlist.py +++ b/ankiqt/ui/cardlist.py @@ -10,9 +10,7 @@ import time, types, sys, re from operator import attrgetter, itemgetter import anki, anki.utils, ankiqt.forms from ankiqt import ui -from anki.cards import cardsTable, Card -from anki.facts import factsTable, fieldsTable, Fact -from anki.utils import fmtTimeSpan, parseTags, findTag, addTags, deleteTags, \ +from anki.utils import fmtTimeSpan, parseTags, hasTag, addTags, delTags, \ stripHTMLAlt, ids2str from ankiqt.ui.utils import saveGeom, restoreGeom, saveSplitter, restoreSplitter from ankiqt.ui.utils import saveHeader, restoreHeader, saveState, \ diff --git a/ankiqt/ui/clayout.py b/ankiqt/ui/clayout.py index d086e6d2b..a40bc8481 100644 --- a/ankiqt/ui/clayout.py +++ b/ankiqt/ui/clayout.py @@ -9,7 +9,6 @@ import ankiqt.forms import anki from anki.models import * from anki.facts import * -from anki.fonts import toCanonicalFont from anki.cards import Card from anki.sound import playFromText, clearAudioQueue from ankiqt.ui.utils import saveGeom, restoreGeom, getBase, mungeQA, \ diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index d253ee615..0c377e87e 100755 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -11,13 +11,11 @@ from PyQt4.QtGui import * from PyQt4.QtWebKit import QWebPage from PyQt4 import pyqtconfig QtConfig = pyqtconfig.Configuration() -from anki import DeckStorage +from anki import Deck from anki.errors import * from anki.sound import hasSound, playFromText, clearAudioQueue, stripSounds -from anki.utils import addTags, deleteTags, parseTags, canonifyTags, \ +from anki.utils import addTags, parseTags, canonifyTags, \ stripHTML, checksum -from anki.media import rebuildMediaDir, downloadMissing, downloadRemote -from anki.db import OperationalError, SessionHelper, sqlite from anki.stdmodels import BasicModel from anki.hooks import runHook, addHook, removeHook, _hooks, wrap from anki.deck import newCardOrderLabels, newCardSchedulingLabels @@ -2812,6 +2810,8 @@ to work with this version of Anki.""")) ########################################################################## def setupFonts(self): + print "need setupFonts?" + return for (s, p) in anki.fonts.substitutions(): QFont.insertSubstitution(s, p) @@ -2859,15 +2859,6 @@ to work with this version of Anki.""")) self.busyCursor = False self.updatingBusy = False self.mainThread = QThread.currentThread() - self.oldSessionHelperGetter = SessionHelper.__getattr__ - SessionHelper.__getattr__ = wrap(SessionHelper.__getattr__, - self.checkProgressHandler, - pos="before") - - def checkProgressHandler(self, ses, k): - "Catch attempts to access the DB from a progress handler." - if self.inDbHandler: - raise Exception("Accessed DB while in progress handler") def setProgressParent(self, parent): self.progressParent = parent diff --git a/ankiqt/ui/modelproperties.py b/ankiqt/ui/modelproperties.py index 11920ca68..2a76d0138 100644 --- a/ankiqt/ui/modelproperties.py +++ b/ankiqt/ui/modelproperties.py @@ -6,7 +6,6 @@ from PyQt4.QtCore import * import sys, re import ankiqt.forms import anki -from anki.models import FieldModel, CardModel from ankiqt import ui class ModelProperties(QDialog): diff --git a/ankiqt/ui/sync.py b/ankiqt/ui/sync.py index 47909c2db..5879695d9 100755 --- a/ankiqt/ui/sync.py +++ b/ankiqt/ui/sync.py @@ -9,7 +9,7 @@ import anki from anki.sync import SyncClient, HttpSyncServerProxy, copyLocalMedia from anki.sync import SYNC_HOST, SYNC_PORT from anki.errors import * -from anki import DeckStorage +from anki import Deck from anki.db import sqlite import ankiqt.forms from anki.hooks import addHook, removeHook diff --git a/ankiqt/ui/view.py b/ankiqt/ui/view.py index 8fba34851..998e5b671 100644 --- a/ankiqt/ui/view.py +++ b/ankiqt/ui/view.py @@ -8,7 +8,6 @@ import anki, anki.utils from anki.sound import playFromText from anki.utils import stripHTML from anki.hooks import runHook, runFilter -from anki.media import stripMedia, escapeImages import types, time, re, os, urllib, sys, difflib import unicodedata as ucd from ankiqt import ui @@ -113,9 +112,9 @@ class View(object): # problem is more complicated - if we percent-escape as utf8 it fixes # some images but breaks others. When filenames are normalized by # dropbox they become unreadable if we escape them. - if not sys.platform.startswith("win32"): + if not sys.platform.startswith("win32") and self.main.deck: # and self.main.config['mediaLocation'] == "dropbox"): - b = escapeImages(b) + b = self.main.deck.media.escapeImages(b) self.body.setHtml(b) def write(self, text):