mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
use pyqt api2; move all imports into a single file for pyside
This commit is contained in:
parent
d02cfa28d9
commit
a253d756e3
34 changed files with 75 additions and 106 deletions
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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("}}<br>", "}}\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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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)
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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":
|
||||
|
|
|
@ -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
|
||||
|
|
13
aqt/qt.py
Normal file
13
aqt/qt.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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
|
|
@ -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
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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:
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# 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)
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue