From a253d756e3ca6acfd59da1dfedc3f10568d93a56 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 26 Apr 2011 08:45:26 +0900 Subject: [PATCH] use pyqt api2; move all imports into a single file for pyside --- aqt/__init__.py | 3 +-- aqt/about.py | 2 +- aqt/activetags.py | 3 +-- aqt/addcards.py | 3 +-- aqt/addons.py | 3 +-- aqt/browser.py | 33 +++++++++++++++------------------ aqt/clayout.py | 12 ++++-------- aqt/deckbrowser.py | 3 +-- aqt/deckopts.py | 3 +-- aqt/editcurrent.py | 3 +-- aqt/editor.py | 4 +--- aqt/errors.py | 3 +-- aqt/exporting.py | 6 ++---- aqt/getshared.py | 3 +-- aqt/groupconf.py | 3 +-- aqt/groups.py | 3 +-- aqt/importing.py | 3 +-- aqt/main.py | 6 ++---- aqt/modelchooser.py | 6 ++---- aqt/models.py | 3 +-- aqt/overview.py | 3 +-- aqt/preferences.py | 8 +++----- aqt/progress.py | 3 +-- aqt/qt.py | 13 +++++++++++++ aqt/reviewer.py | 3 +-- aqt/sound.py | 3 +-- aqt/stats.py | 3 +-- aqt/studyopts.py | 9 ++++----- aqt/sync.py | 3 +-- aqt/tagedit.py | 9 ++++----- aqt/templates.py | 3 +-- aqt/update.py | 3 +-- aqt/utils.py | 5 ++--- aqt/webview.py | 5 +---- 34 files changed, 75 insertions(+), 106 deletions(-) create mode 100644 aqt/qt.py diff --git a/aqt/__init__.py b/aqt/__init__.py index 1805d6d94..0625a6f05 100644 --- a/aqt/__init__.py +++ b/aqt/__init__.py @@ -2,8 +2,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import os, sys -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from aqt.qt import * appName="Anki" appVersion="1.99" diff --git a/aqt/about.py b/aqt/about.py index ae4c62ac6..8e69a5b03 100644 --- a/aqt/about.py +++ b/aqt/about.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * +from aqt.qt import * import aqt.forms from aqt import appVersion diff --git a/aqt/activetags.py b/aqt/activetags.py index d63560344..1113b04ca 100644 --- a/aqt/activetags.py +++ b/aqt/activetags.py @@ -1,8 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import aqt from anki.utils import parseTags, joinTags, canonifyTags from aqt.ui.utils import saveGeom, restoreGeom diff --git a/aqt/addcards.py b/aqt/addcards.py index 141851056..2154d678a 100644 --- a/aqt/addcards.py +++ b/aqt/addcards.py @@ -2,8 +2,7 @@ # -*- coding: utf-8 -*- # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import sys, re import aqt.forms import anki diff --git a/aqt/addons.py b/aqt/addons.py index 492c64205..38fc0f592 100644 --- a/aqt/addons.py +++ b/aqt/addons.py @@ -3,8 +3,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import sys, os, re, traceback -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from aqt.qt import * from aqt.utils import showInfo, showWarning, openFolder, isWin from anki.hooks import runHook diff --git a/aqt/browser.py b/aqt/browser.py index bb40a0447..661eb6a54 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -3,9 +3,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import sre_constants -from PyQt4.QtGui import * -from PyQt4.QtCore import * -from PyQt4.QtWebKit import QWebPage +from aqt.qt import * import time, types, sys, re from operator import attrgetter, itemgetter import anki, anki.utils, aqt.forms @@ -69,37 +67,37 @@ class DeckModel(QAbstractTableModel): def data(self, index, role): if not index.isValid(): - return QVariant() + return if role == Qt.FontRole: f = QFont() f.setPixelSize(self.browser.mw.config['editFontSize']) - return QVariant(f) + return f if role == Qt.TextAlignmentRole: align = Qt.AlignVCenter if index.column() > 1: align |= Qt.AlignHCenter - return QVariant(align) + return align elif role == Qt.DisplayRole or role == Qt.EditRole: - return QVariant(self.columnData(index)) + return self.columnData(index) else: - return QVariant() + return def headerData(self, section, orientation, role): if orientation == Qt.Vertical: - return QVariant() + return elif role == Qt.DisplayRole: type = self.columnType(section) for stype, name in self.browser.columns: if type == stype: txt = name break - return QVariant(txt) + return txt elif role == Qt.FontRole: f = QFont() f.setPixelSize(10) - return QVariant(f) + return f else: - return QVariant() + return def flags(self, index): return Qt.ItemFlag(Qt.ItemIsEnabled | @@ -435,7 +433,7 @@ class Browser(QMainWindow): self.onSearch) self.setTabOrder(self.form.searchEdit, self.form.tableView) self.compModel = QStringListModel() - self.compModel.setStringList(QStringList(self.mw.config['searchHistory'])) + self.compModel.setStringList(self.mw.config['searchHistory']) self.searchComp = QCompleter(self.compModel, self.form.searchEdit) self.searchComp.setCompletionMode(QCompleter.UnfilteredPopupCompletion) self.searchComp.setCaseSensitivity(Qt.CaseInsensitive) @@ -448,7 +446,7 @@ class Browser(QMainWindow): if txt not in sh: sh.insert(0, txt) sh = sh[:30] - self.compModel.setStringList(QStringList(sh)) + self.compModel.setStringList(sh) self.mw.config['searchHistory'] = sh self.model.search(txt, reset) if not self.model.cards: @@ -1096,7 +1094,7 @@ where id in %s""" % ids2str(self.selectedCards()), mod) frm = aqt.forms.findreplace.Ui_Dialog() frm.setupUi(d) d.setWindowModality(Qt.WindowModal) - frm.field.addItems(QStringList([_("All Fields")] + fields)) + frm.field.addItems([_("All Fields")] + fields) self.connect(frm.buttonBox, SIGNAL("helpRequested()"), self.onFindReplaceHelp) if not d.exec_(): @@ -1162,7 +1160,7 @@ select fm.id, fm.name from fieldmodels fm""") names = byName.keys() names.sort() alldata = [(byName[n], n) for n in names] + data - dialog.searchArea.addItems(QStringList([d[1] for d in alldata])) + dialog.searchArea.addItems([d[1] for d in alldata]) # links dialog.webView.page().setLinkDelegationPolicy( QWebPage.DelegateAllLinks) @@ -1382,12 +1380,11 @@ class ChangeModel(QDialog): l = QGridLayout() combos = [] targets = [x['name'] for x in dst] + [_("Nothing")] - qtargets = QStringList(targets) indices = {} for i, x in enumerate(src): l.addWidget(QLabel(_("Change %s to:") % x['name']), i, 0) cb = QComboBox() - cb.addItems(qtargets) + cb.addItems(targets) idx = min(i, len(targets)-1) cb.setCurrentIndex(idx) indices[cb] = idx diff --git a/aqt/clayout.py b/aqt/clayout.py index 216034ab2..d6cd796b1 100644 --- a/aqt/clayout.py +++ b/aqt/clayout.py @@ -1,9 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * -from PyQt4.QtWebKit import QWebPage, QWebView +from aqt.qt import * import re from anki.consts import * import aqt @@ -114,13 +112,12 @@ class CardLayout(QDialog): linkClicked) if self.plastiqueStyle: f.background.setStyle(self.plastiqueStyle) - f.alignment.addItems( - QStringList(alignmentLabels().values())) + f.alignment.addItems(alignmentLabels().values()) self.typeFieldNames = self.model.fieldMap() s = [_("Don't ask me to type in the answer")] s += [_("Compare with field '%s'") % fi for fi in self.typeFieldNames.keys()] - f.typeAnswer.insertItems(0, QStringList(s)) + f.typeAnswer.insertItems(0, s) def formatToScreen(self, fmt): fmt = fmt.replace("}}
", "}}\n") @@ -177,8 +174,7 @@ class CardLayout(QDialog): idx = n else: cards.append(c.template()['name']) - self.form.cardList.addItems( - QStringList(cards)) + self.form.cardList.addItems(cards) self.form.cardList.setCurrentIndex(idx) self.cardChanged(idx) self.form.cardList.setFocus() diff --git a/aqt/deckbrowser.py b/aqt/deckbrowser.py index 1dbbf30f6..28bf5a93b 100644 --- a/aqt/deckbrowser.py +++ b/aqt/deckbrowser.py @@ -4,8 +4,7 @@ import time, os, stat, shutil, re from operator import itemgetter -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from aqt.qt import * from anki import Deck from anki.utils import fmtTimeSpan from anki.hooks import addHook diff --git a/aqt/deckopts.py b/aqt/deckopts.py index d6b46e404..95745e61b 100644 --- a/aqt/deckopts.py +++ b/aqt/deckopts.py @@ -1,8 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import sys, re import aqt from aqt.utils import maybeHideClose diff --git a/aqt/editcurrent.py b/aqt/editcurrent.py index 1f9206534..fae60720f 100644 --- a/aqt/editcurrent.py +++ b/aqt/editcurrent.py @@ -2,8 +2,7 @@ # -*- coding: utf-8 -*- # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import aqt.editor from aqt.utils import saveGeom, restoreGeom from anki.hooks import addHook, removeHook diff --git a/aqt/editor.py b/aqt/editor.py index 53c0aeec4..c69de697b 100644 --- a/aqt/editor.py +++ b/aqt/editor.py @@ -2,9 +2,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * -from PyQt4.QtWebKit import QWebView, QWebPage +from aqt.qt import * import re, os, sys, urllib2, ctypes, simplejson, traceback from anki.utils import stripHTML, parseTags, isWin, namedtmp from anki.sound import play diff --git a/aqt/errors.py b/aqt/errors.py index 0f01c311e..258ee520c 100644 --- a/aqt/errors.py +++ b/aqt/errors.py @@ -2,8 +2,7 @@ # -*- coding: utf-8 -*- # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from aqt.qt import * import sys from aqt.utils import showText diff --git a/aqt/exporting.py b/aqt/exporting.py index 79e19bf87..dfa8648c6 100644 --- a/aqt/exporting.py +++ b/aqt/exporting.py @@ -1,8 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import anki, aqt from anki.exporting import exporters as exporters_ from anki.utils import parseTags @@ -31,8 +30,7 @@ class ExportDialog(QDialog): self.exec_() def setup(self): - self.dialog.format.insertItems( - 0, QStringList(list(zip(*exporters())[0]))) + self.dialog.format.insertItems(0, list(zip(*exporters())[0])) self.connect(self.dialog.format, SIGNAL("activated(int)"), self.exporterChanged) self.exporterChanged(0) diff --git a/aqt/getshared.py b/aqt/getshared.py index 50d6b8ed8..9b9a0b920 100644 --- a/aqt/getshared.py +++ b/aqt/getshared.py @@ -2,8 +2,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import aqt, simplejson, time, cStringIO, zipfile, os, re, gzip import traceback, urllib2, socket, cgi from aqt.ui.utils import saveGeom, restoreGeom, showInfo diff --git a/aqt/groupconf.py b/aqt/groupconf.py index c5ae43d50..03fe35a51 100644 --- a/aqt/groupconf.py +++ b/aqt/groupconf.py @@ -2,8 +2,7 @@ # -*- coding: utf-8 -*- # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from aqt.qt import * import aqt, simplejson from anki.utils import ids2str from aqt.utils import showInfo, showWarning diff --git a/aqt/groups.py b/aqt/groups.py index b096b2884..56b059b27 100644 --- a/aqt/groups.py +++ b/aqt/groups.py @@ -2,8 +2,7 @@ # -*- coding: utf-8 -*- # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from aqt.qt import * import aqt from aqt.utils import showInfo, getOnlyText diff --git a/aqt/importing.py b/aqt/importing.py index 3f561c8d6..cefabd23c 100644 --- a/aqt/importing.py +++ b/aqt/importing.py @@ -2,8 +2,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import os, copy, time, sys, re, traceback -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import anki import anki.importing as importing from aqt.ui.utils import getOnlyText diff --git a/aqt/main.py b/aqt/main.py index f00b2569f..22142d219 100755 --- a/aqt/main.py +++ b/aqt/main.py @@ -6,9 +6,7 @@ import os, sys, re, stat, traceback, signal import shutil, time, zipfile from operator import itemgetter -from PyQt4.QtCore import * -from PyQt4.QtGui import * -from PyQt4 import pyqtconfig +from aqt.qt import * QtConfig = pyqtconfig.Configuration() from anki import Deck @@ -355,7 +353,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors") if not self.deck or self.deck.path != x and os.path.exists(x)]) self.switchDecks.sort() - combo.addItems(QStringList([x[0] for x in self.switchDecks])) + combo.addItems([x[0] for x in self.switchDecks]) self.connect(combo, SIGNAL("activated(int)"), self.onSwitchActivated) vbox.addWidget(combo) diff --git a/aqt/modelchooser.py b/aqt/modelchooser.py index ae88ecff2..c4e3fa7a9 100644 --- a/aqt/modelchooser.py +++ b/aqt/modelchooser.py @@ -1,8 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * from operator import attrgetter from anki import stdmodels from anki.lang import ngettext @@ -94,8 +93,7 @@ class ModelChooser(QHBoxLayout): self.models.clear() self._models = sorted(self.deck.models().values(), key=attrgetter("name")) - self.models.addItems(QStringList( - [m.name for m in self._models])) + self.models.addItems([m.name for m in self._models]) for c, m in enumerate(self._models): if m.id == self.deck.conf['currentModelId']: self.models.setCurrentIndex(c) diff --git a/aqt/models.py b/aqt/models.py index ee9d00416..7ad7c4bdc 100644 --- a/aqt/models.py +++ b/aqt/models.py @@ -1,8 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * from aqt.utils import showInfo, askUser, getText, maybeHideClose import aqt.modelchooser, aqt.clayout diff --git a/aqt/overview.py b/aqt/overview.py index a87728405..3b0298b5b 100644 --- a/aqt/overview.py +++ b/aqt/overview.py @@ -3,8 +3,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import simplejson -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from aqt.qt import * from anki.consts import NEW_CARDS_RANDOM from anki.hooks import addHook from aqt.utils import limitedCount diff --git a/aqt/preferences.py b/aqt/preferences.py index aff651be6..10a7b71d1 100644 --- a/aqt/preferences.py +++ b/aqt/preferences.py @@ -3,8 +3,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import os -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * from anki.lang import langs from aqt.utils import openFolder, showWarning import aqt @@ -60,12 +59,11 @@ class Preferences(QDialog): self.form.retranslateUi(self) def setupMedia(self): - self.form.mediaChoice.addItems( - QStringList([ + self.form.mediaChoice.addItems([ _("Keep media next to deck"), _("Keep media in DropBox"), _("Keep media in custom folder"), - ])) + ]) if not self.config['mediaLocation']: idx = 0 elif self.config['mediaLocation'] == "dropbox": diff --git a/aqt/progress.py b/aqt/progress.py index 2b7a53306..6c641675a 100644 --- a/aqt/progress.py +++ b/aqt/progress.py @@ -3,8 +3,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import time -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * # fixme: if mw->subwindow opens a progress dialog with mw as the parent, mw # gets raised on finish on compiz. perhaps we should be using the progress diff --git a/aqt/qt.py b/aqt/qt.py new file mode 100644 index 000000000..a6a9bebcd --- /dev/null +++ b/aqt/qt.py @@ -0,0 +1,13 @@ +# Copyright: Damien Elmes +# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + +# imports are all in this file to make moving to pyside easier in the future + +import sip +sip.setapi('QString', 2) +sip.setapi('QVariant', 2) +sip.setapi('QUrl', 2) +from PyQt4.QtCore import * +from PyQt4.QtGui import * +from PyQt4.QtWebKit import QWebPage, QWebView +from PyQt4 import pyqtconfig diff --git a/aqt/reviewer.py b/aqt/reviewer.py index 5f7403d1a..ef6808df9 100644 --- a/aqt/reviewer.py +++ b/aqt/reviewer.py @@ -4,8 +4,7 @@ import time, os, stat, shutil, difflib, simplejson import unicodedata as ucd -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from aqt.qt import * from anki.utils import fmtTimeSpan, stripHTML from anki.hooks import addHook, runHook, runFilter from anki.sound import playFromText, clearAudioQueue, hasSound diff --git a/aqt/sound.py b/aqt/sound.py index 32542f5bf..2cf1151b1 100644 --- a/aqt/sound.py +++ b/aqt/sound.py @@ -1,8 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import time from anki.sound import Recorder, play diff --git a/aqt/stats.py b/aqt/stats.py index 4ae352034..3fa20bad6 100644 --- a/aqt/stats.py +++ b/aqt/stats.py @@ -2,8 +2,7 @@ # -*- coding: utf-8 -*- # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import os from aqt.webview import AnkiWebView from aqt.utils import saveGeom, restoreGeom, maybeHideClose diff --git a/aqt/studyopts.py b/aqt/studyopts.py index 6593da229..5d2c7e352 100644 --- a/aqt/studyopts.py +++ b/aqt/studyopts.py @@ -2,8 +2,7 @@ # -*- coding: utf-8 -*- # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from aqt.qt import * import datetime, time, aqt class StudyOptions(QDialog): @@ -20,11 +19,11 @@ class StudyOptions(QDialog): def setup(self): import anki.consts as c self.form.newOrder.insertItems( - 0, QStringList(c.newCardOrderLabels().values())) + 0, c.newCardOrderLabels().values()) self.form.newSpread.insertItems( - 0, QStringList(c.newCardSchedulingLabels().values())) + 0, c.newCardSchedulingLabels().values()) self.form.revOrder.insertItems( - 0, QStringList(c.revCardOrderLabels().values())) + 0, c.revCardOrderLabels().values()) self.connect(self.form.buttonBox, SIGNAL("helpRequested()"), lambda: aqt.openHelp("StudyOptions")) diff --git a/aqt/sync.py b/aqt/sync.py index 29486494b..8544cc991 100755 --- a/aqt/sync.py +++ b/aqt/sync.py @@ -1,8 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import os, types, socket, time, traceback import aqt import anki diff --git a/aqt/tagedit.py b/aqt/tagedit.py index f411ab839..8fc9302f0 100644 --- a/aqt/tagedit.py +++ b/aqt/tagedit.py @@ -1,8 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * from anki.utils import parseTags, canonifyTags, joinTags import re, sys @@ -29,13 +28,13 @@ class TagEdit(QLineEdit): l = self.deck.tagList() else: l = self.deck.groups() - self.model.setStringList(QStringList(l)) + self.model.setStringList(l) def addTags(self, tags): l = list(set([unicode(x) for x in list(self.model.stringList())] + tags)) l.sort(key=lambda x: x.lower()) - self.model.setStringList(QStringList(l)) + self.model.setStringList(l) def focusOutEvent(self, evt): QLineEdit.focusOutEvent(self, evt) @@ -56,7 +55,7 @@ class TagCompleter(QCompleter): self.tags.append(u"") p = self.edit.cursorPosition() self.cursor = str.count(" ", 0, p) - return QStringList(self.tags[self.cursor]) + return self.tags[self.cursor] def pathFromIndex(self, idx): if self.cursor is None: diff --git a/aqt/templates.py b/aqt/templates.py index 941850db2..b0d39c807 100644 --- a/aqt/templates.py +++ b/aqt/templates.py @@ -1,8 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import aqt from aqt.utils import saveGeom, restoreGeom, askUser, getText diff --git a/aqt/update.py b/aqt/update.py index 2032dd1be..ea10825f0 100644 --- a/aqt/update.py +++ b/aqt/update.py @@ -1,8 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtCore import * -from PyQt4.QtGui import * +from aqt.qt import * import urllib, urllib2, os, sys, time, httplib import anki, anki.utils, anki.lang, anki.stats import aqt diff --git a/aqt/utils.py b/aqt/utils.py index 5d22f7f5a..51f663b63 100644 --- a/aqt/utils.py +++ b/aqt/utils.py @@ -1,8 +1,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -from PyQt4.QtGui import * -from PyQt4.QtCore import * +from aqt.qt import * import re, os, sys, urllib, time import aqt from anki.sound import playFromText, stripSounds @@ -188,7 +187,7 @@ def chooseList(prompt, choices, startrow=0, parent=None): t = QLabel(prompt) l.addWidget(t) c = QListWidget() - c.addItems(QStringList(choices)) + c.addItems(choices) c.setCurrentRow(startrow) l.addWidget(c) bb = QDialogButtonBox(QDialogButtonBox.Ok) diff --git a/aqt/webview.py b/aqt/webview.py index af16df1b0..1cd5dda75 100644 --- a/aqt/webview.py +++ b/aqt/webview.py @@ -3,10 +3,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import sys -from PyQt4.QtCore import * -from PyQt4.QtGui import * -from PyQt4.QtWebKit import QWebPage, QWebView -from PyQt4 import pyqtconfig +from aqt.qt import * import anki.js QtConfig = pyqtconfig.Configuration()