dialog refactor wip

This commit is contained in:
Damien Elmes 2010-11-29 04:56:45 +09:00
parent 5ecb4bde49
commit 35a5569038
14 changed files with 1639 additions and 2192 deletions

View file

@ -10,7 +10,7 @@ def importAll():
import cardlist import cardlist
import deckproperties import deckproperties
import importing import importing
import displayproperties import clayout
import exporting import exporting
import facteditor import facteditor
import help import help
@ -67,7 +67,6 @@ class DialogManager(object):
def registerDialogs(self): def registerDialogs(self):
self.registerDialog("AddCards", addcards.AddCards) self.registerDialog("AddCards", addcards.AddCards)
self.registerDialog("CardList", cardlist.EditDeck) self.registerDialog("CardList", cardlist.EditDeck)
self.registerDialog("DisplayProperties", displayproperties.DisplayProperties)
self.registerDialog("Graphs", self.graphProxy) self.registerDialog("Graphs", self.graphProxy)
dialogs = DialogManager() dialogs = DialogManager()

554
ankiqt/ui/clayout.py Normal file
View file

@ -0,0 +1,554 @@
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys, re
import ankiqt.forms
import anki
from anki.models import *
from anki.facts import *
from anki.fonts import toCanonicalFont
from anki.cards import Card
from ankiqt.ui.utils import saveGeom, restoreGeom
from ankiqt import ui
class CardLayout(QDialog):
def __init__(self, parent, fact, card=None):
QDialog.__init__(self, parent) #, Qt.Window)
self.parent = parent
self.mw = ankiqt.mw
self.deck = self.mw.deck
self.fact = fact
self.model = fact.model
self.card = card or self.model.cardModels[0]
self.ignoreUpdate = False
self.plastiqueStyle = None
if (sys.platform.startswith("darwin") or
sys.platform.startswith("win32")):
self.plastiqueStyle = QStyleFactory.create("plastique")
self.form = ankiqt.forms.clayout.Ui_Dialog()
self.form.setupUi(self)
# self.connect(self.form.helpButton, SIGNAL("clicked()"),
# self.onHelp)
# self.setupChooser()
self.setupCards()
# self.setupFields()
# self.setupButtons()
restoreGeom(self, "CardLayout")
self.exec_()
def setupCards(self):
self.connect(self.form.cardList, SIGNAL("activated(int)"),
self.cardChanged)
self.connect(self.form.alignment,
SIGNAL("activated(int)"),
self.saveCard)
self.connect(self.form.background,
SIGNAL("clicked()"),
lambda w=self.form.background:\
self.chooseColour(w))
if self.plastiqueStyle:
self.form.background.setStyle(self.plastiqueStyle)
self.drawCards()
def formatToScreen(self, fmt):
fmt = fmt.replace("<br>", "<br>\n")
fmt = re.sub("%\((.+?)\)s", "{{\\1}}", fmt)
return fmt
def screenToFormat(self, fmt):
fmt = fmt.replace("<br>\n", "<br>")
fmt = re.sub("{{(.+?)}}", "%(\\1)s", fmt)
return fmt
def saveCurrentCard(self):
if not self.currentCard:
return
card = self.currentCard
newname = unicode(self.form.cardName.text())
if not newname:
newname = _("Card-%d") % (self.model.cardModels.index(card) + 1)
self.updateField(card, 'name', newname)
s = unicode(self.form.cardQuestion.toPlainText())
changed = self.updateField(card, 'qformat', self.screenToFormat(s))
s = unicode(self.form.cardAnswer.toPlainText())
changed2 = self.updateField(card, 'aformat', self.screenToFormat(s))
self.needRebuild = self.needRebuild or changed or changed2
self.updateField(card, 'questionInAnswer', self.form.questionInAnswer.isChecked())
self.updateField(card, 'allowEmptyAnswer', self.form.allowEmptyAnswer.isChecked())
idx = self.form.typeAnswer.currentIndex()
if not idx:
self.updateField(card, 'typeAnswer', u"")
else:
self.updateField(card, 'typeAnswer', self.fieldNames[idx-1])
self.ignoreCardUpdate = True
self.updateCards()
self.ignoreCardUpdate = False
def updateField(self, obj, field, value):
if getattr(obj, field) != value:
setattr(obj, field, value)
self.model.setModified()
self.deck.setModified()
return True
return False
def drawCards(self):
self.form.cardList.clear()
self.form.cardList.addItems(
QStringList([c.name for c in self.model.cardModels]))
self.form.alignment.clear()
self.form.alignment.addItems(
QStringList(alignmentLabels().values()))
self.cardChanged(0)
def cardChanged(self, idx):
self.card = self.model.cardModels[idx]
self.readCard()
self.drawQuestionAndAnswer()
def readCard(self):
card = self.card
self.form.background.setPalette(QPalette(QColor(
getattr(card, "lastFontColour"))))
self.form.cardQuestion.setPlainText(self.formatToScreen(card.qformat))
self.form.cardAnswer.setPlainText(self.formatToScreen(card.aformat))
self.form.questionInAnswer.setChecked(card.questionInAnswer)
self.form.allowEmptyAnswer.setChecked(card.allowEmptyAnswer)
self.form.typeAnswer.clear()
self.fieldNames = self.deck.s.column0("""
select fieldModels.name as n from fieldModels, cardModels
where cardModels.modelId = fieldModels.modelId
and cardModels.id = :id
order by n""", id=card.id)
s = [_("Don't ask me to type in the answer")]
s += [_("Compare with field '%s'") % f for f in self.fieldNames]
self.form.typeAnswer.insertItems(0, QStringList(s))
try:
idx = self.fieldNames.index(card.typeAnswer)
except ValueError:
idx = -1
self.form.typeAnswer.setCurrentIndex(idx + 1)
def saveCard(self):
if not self.card:
return
self.card.questionAlign = self.form.align.currentIndex()
setattr(self.card, "lastFontColour", unicode(
self.form.backgroundColour.palette().window().color().name()))
self.card.model.setModified()
self.deck.setModified()
self.drawQuestionAndAnswer()
def cwidget(self, name, type):
"Return a card widget."
return getattr(self.form, type + name)
def setupFields(self):
self.connect(self.form.fieldList, SIGNAL("currentRowChanged(int)"),
self.fieldChanged)
for type in ("quiz", "edit"):
self.connect(self.fwidget("fontFamily", type),
SIGNAL("currentFontChanged(QFont)"),
self.saveField)
self.connect(self.fwidget("fontSize", type),
SIGNAL("valueChanged(int)"),
self.saveField)
self.connect(self.fwidget("useFamily", type),
SIGNAL("stateChanged(int)"),
self.saveField)
self.connect(self.fwidget("useSize", type),
SIGNAL("stateChanged(int)"),
self.saveField)
if type == "quiz":
self.connect(self.fwidget("useColour", type),
SIGNAL("stateChanged(int)"),
self.saveField)
w = self.fwidget("fontColour", type)
if self.plastiqueStyle:
w.setStyle(self.plastiqueStyle)
self.connect(w,
SIGNAL("clicked()"),
lambda w=w: self.chooseColour(w))
elif type == "edit":
self.connect(self.form.rtl,
SIGNAL("stateChanged(int)"),
self.saveField)
self.currentField = None
self.drawFields()
def drawFields(self):
self.form.fieldList.clear()
n = 1
self.ignoreUpdate = True
for field in self.model.fieldModels:
item = QListWidgetItem(
_("Field %(num)d: %(name)s") % {
'num': n,
'name': field.name,
})
self.form.fieldList.addItem(item)
n += 1
self.form.fieldList.setCurrentRow(0)
self.fieldChanged(0)
self.ignoreUpdate = False
def fwidget(self, name, type):
"Return a field widget."
if type == "edit":
return getattr(self.form, name+"Edit")
else:
return getattr(self.form, name)
def fieldChanged(self, idx):
self.saveField()
self.currentField = None
field = self.model.fieldModels[idx]
for type in ("quiz", "edit"):
# family
if getattr(field, type + 'FontFamily'):
self.fwidget("useFamily", type).setCheckState(Qt.Checked)
self.fwidget("fontFamily", type).setCurrentFont(QFont(
getattr(field, type + 'FontFamily')))
self.fwidget("fontFamily", type).setEnabled(True)
else:
self.fwidget("useFamily", type).setCheckState(Qt.Unchecked)
self.fwidget("fontFamily", type).setEnabled(False)
# size
if getattr(field, type + 'FontSize'):
self.fwidget("useSize", type).setCheckState(Qt.Checked)
self.fwidget("fontSize", type).setValue(
getattr(field, type + 'FontSize'))
self.fwidget("fontSize", type).setEnabled(True)
else:
self.fwidget("useSize", type).setCheckState(Qt.Unchecked)
self.fwidget("fontSize", type).setEnabled(False)
if type == "quiz":
# colour
if getattr(field, type + 'FontColour'):
self.fwidget("useColour", type).setCheckState(Qt.Checked)
self.fwidget("fontColour", type).setPalette(QPalette(QColor(
getattr(field, type + 'FontColour'))))
self.fwidget("fontColour", type).setEnabled(True)
else:
self.fwidget("useColour", type).setCheckState(Qt.Unchecked)
self.fwidget("fontColour", type).setEnabled(False)
elif type == "edit":
self.form.rtl.setChecked(not not field.features)
self.currentField = field
def saveField(self, *args):
if self.ignoreUpdate:
return
field = self.currentField
if not field:
return
for type in ("quiz", "edit"):
# family
if self.fwidget("useFamily", type).isChecked():
setattr(field, type + 'FontFamily', toCanonicalFont(unicode(
self.fwidget("fontFamily", type).currentFont().family())))
else:
setattr(field, type + 'FontFamily', None)
# size
if self.fwidget("useSize", type).isChecked():
setattr(field, type + 'FontSize',
int(self.fwidget("fontSize", type).value()))
else:
setattr(field, type + 'FontSize', None)
# colour
if type == "quiz":
if self.fwidget("useColour", type).isChecked():
w = self.fwidget("fontColour", type)
c = w.palette().window().color()
setattr(field, type + 'FontColour', str(c.name()))
else:
setattr(field, type + 'FontColour', None)
elif type == "edit":
if self.form.rtl.isChecked():
field.features = u"rtl"
else:
field.features = u""
field.model.setModified()
self.deck.flushMod()
self.drawQuestionAndAnswer()
def chooseColour(self, button):
new = QColorDialog.getColor(button.palette().window().color(), self)
if new.isValid():
button.setPalette(QPalette(new))
self.saveField()
self.saveCard()
def drawQuestionAndAnswer(self):
print "draw qa"
return
self.deck.flushMod()
f = self.deck.newFact()
f.tags = u""
for field in f.fields:
f[field.name] = field.name
f.model = self.model
c = Card(f, self.card)
t = "<body><br><center>" + c.htmlQuestion() + "</center></body>"
bg = "body { background-color: %s; }\n" % self.card.lastFontColour
self.form.question.setText(
"<style>\n" + bg + self.deck.rebuildCSS() + "</style>\n" + t)
t = "<body><br><center>" + c.htmlAnswer() + "</center></body>"
self.form.answer.setText(
"<style>\n" + bg + self.deck.rebuildCSS() + "</style>\n" + t)
self.mw.updateViews(self.mw.state)
def reject(self):
saveGeom(self, "CardLayout")
QDialog.reject(self)
def onHelp(self):
QDesktopServices.openUrl(QUrl(ankiqt.appWiki +
"DisplayProperties"))
# Fields
##########################################################################
# def setupFields(self):
# self.fieldOrdinalUpdatedIds = []
# self.ignoreFieldUpdate = False
# self.currentField = None
# self.updateFields()
# self.readCurrentField()
# self.connect(self.form.fieldList, SIGNAL("currentRowChanged(int)"),
# self.fieldRowChanged)
# self.connect(self.form.tabWidget, SIGNAL("currentChanged(int)"),
# self.fieldRowChanged)
# self.connect(self.form.fieldAdd, SIGNAL("clicked()"),
# self.addField)
# self.connect(self.form.fieldDelete, SIGNAL("clicked()"),
# self.deleteField)
# self.connect(self.form.fieldUp, SIGNAL("clicked()"),
# self.moveFieldUp)
# self.connect(self.form.fieldDown, SIGNAL("clicked()"),
# self.moveFieldDown)
# self.connect(self.form.fieldName, SIGNAL("lostFocus()"),
# self.updateFields)
# def updateFields(self, row = None):
# oldRow = self.form.fieldList.currentRow()
# if oldRow == -1:
# oldRow = 0
# self.form.fieldList.clear()
# n = 1
# for field in self.model.fieldModels:
# label = _("Field %(num)d: %(name)s [%(cards)s non-empty]") % {
# 'num': n,
# 'name': field.name,
# 'cards': self.deck.fieldModelUseCount(field)
# }
# item = QListWidgetItem(label)
# self.form.fieldList.addItem(item)
# n += 1
# count = self.form.fieldList.count()
# if row != None:
# self.form.fieldList.setCurrentRow(row)
# else:
# while (count > 0 and oldRow > (count - 1)):
# oldRow -= 1
# self.form.fieldList.setCurrentRow(oldRow)
# self.enableFieldMoveButtons()
# def fieldRowChanged(self):
# if self.ignoreFieldUpdate:
# return
# self.saveCurrentField()
# self.readCurrentField()
# def readCurrentField(self):
# if not len(self.model.fieldModels):
# self.form.fieldEditBox.hide()
# self.form.fieldUp.setEnabled(False)
# self.form.fieldDown.setEnabled(False)
# return
# else:
# self.form.fieldEditBox.show()
# self.currentField = self.model.fieldModels[self.form.fieldList.currentRow()]
# field = self.currentField
# self.form.fieldName.setText(field.name)
# self.form.fieldUnique.setChecked(field.unique)
# self.form.fieldRequired.setChecked(field.required)
# self.form.numeric.setChecked(field.numeric)
# def enableFieldMoveButtons(self):
# row = self.form.fieldList.currentRow()
# if row < 1:
# self.form.fieldUp.setEnabled(False)
# else:
# self.form.fieldUp.setEnabled(True)
# if row == -1 or row >= (self.form.fieldList.count() - 1):
# self.form.fieldDown.setEnabled(False)
# else:
# self.form.fieldDown.setEnabled(True)
# def saveCurrentField(self):
# if not self.currentField:
# return
# field = self.currentField
# name = unicode(self.form.fieldName.text()).strip()
# # renames
# if not name:
# name = _("Field %d") % (self.model.fieldModels.index(field) + 1)
# if name != field.name:
# self.deck.renameFieldModel(self.m, field, name)
# # the card models will have been updated
# self.readCurrentCard()
# # unique, required, numeric
# self.updateField(field, 'unique',
# self.form.fieldUnique.checkState() == Qt.Checked)
# self.updateField(field, 'required',
# self.form.fieldRequired.checkState() == Qt.Checked)
# self.updateField(field, 'numeric',
# self.form.numeric.checkState() == Qt.Checked)
# self.ignoreFieldUpdate = True
# self.updateFields()
# self.ignoreFieldUpdate = False
# def addField(self):
# f = FieldModel(required=False, unique=False)
# f.name = _("Field %d") % (len(self.model.fieldModels) + 1)
# self.deck.addFieldModel(self.m, f)
# self.updateFields()
# self.form.fieldList.setCurrentRow(len(self.model.fieldModels)-1)
# self.form.fieldName.setFocus()
# self.form.fieldName.selectAll()
# def deleteField(self):
# row = self.form.fieldList.currentRow()
# if row == -1:
# return
# if len(self.model.fieldModels) < 2:
# ui.utils.showInfo(
# _("Please add a new field first."),
# parent=self)
# return
# field = self.model.fieldModels[row]
# count = self.deck.fieldModelUseCount(field)
# if count:
# if not ui.utils.askUser(
# _("This field is used by %d cards. If you delete it,\n"
# "all information in this field will be lost.\n"
# "\nReally delete this field?") % count,
# parent=self):
# return
# self.deck.deleteFieldModel(self.m, field)
# self.currentField = None
# self.updateFields()
# # need to update q/a format
# self.readCurrentCard()
# def moveFieldUp(self):
# row = self.form.fieldList.currentRow()
# if row == -1:
# return
# if row == 0:
# return
# field = self.model.fieldModels[row]
# tField = self.model.fieldModels[row - 1]
# self.model.fieldModels.remove(field)
# self.model.fieldModels.insert(row - 1, field)
# if field.id not in self.fieldOrdinalUpdatedIds:
# self.fieldOrdinalUpdatedIds.append(field.id)
# if tField.id not in self.fieldOrdinalUpdatedIds:
# self.fieldOrdinalUpdatedIds.append(tField.id)
# self.ignoreFieldUpdate = True
# self.updateFields(row - 1)
# self.ignoreFieldUpdate = False
# def moveFieldDown(self):
# row = self.form.fieldList.currentRow()
# if row == -1:
# return
# if row == len(self.model.fieldModels) - 1:
# return
# field = self.model.fieldModels[row]
# tField = self.model.fieldModels[row + 1]
# self.model.fieldModels.remove(field)
# self.model.fieldModels.insert(row + 1, field)
# if field.id not in self.fieldOrdinalUpdatedIds:
# self.fieldOrdinalUpdatedIds.append(field.id)
# if tField.id not in self.fieldOrdinalUpdatedIds:
# self.fieldOrdinalUpdatedIds.append(tField.id)
# self.ignoreFieldUpdate = True
# self.updateFields(row + 1)
# self.ignoreFieldUpdate = False
# rebuild ordinals if changed
# if len(self.fieldOrdinalUpdatedIds) > 0:
# self.deck.rebuildFieldOrdinals(self.model.id, self.fieldOrdinalUpdatedIds)
# self.model.setModified()
# self.deck.setModified()
# class PreviewDialog(QDialog):
# def __init__(self, parent, deck, fact, *args):
# QDialog.__init__(self, parent, *args)
# self.deck = deck
# self.fact = fact
# cards = self.deck.previewFact(self.fact)
# if not cards:
# ui.utils.showInfo(_("No cards to preview."),
# parent=parent)
# return
# self.cards = cards
# self.currentCard = 0
# self.form = ankiqt.forms.previewcards.Ui_Dialog()
# self.form.setupUi(self)
# self.form.webView.page().setLinkDelegationPolicy(
# QWebPage.DelegateExternalLinks)
# self.connect(self.form.webView,
# SIGNAL("linkClicked(QUrl)"),
# self.linkClicked)
# self.form.comboBox.addItems(QStringList(
# [c.cardModel.name for c in self.cards]))
# self.connect(self.form.comboBox, SIGNAL("activated(int)"),
# self.onChange)
# self.updateCard()
# restoreGeom(self, "preview")
# self.exec_()
# def linkClicked(self, url):
# QDesktopServices.openUrl(QUrl(url))
# def updateCard(self):
# c = self.cards[self.currentCard]
# styles = (self.deck.css +
# ("\nhtml { background: %s }" % c.cardModel.lastFontColour) +
# "\ndiv { white-space: pre-wrap; }")
# styles = runFilter("addStyles", styles, c)
# self.form.webView.setHtml(
# ('<html><head>%s</head><body>' % getBase(self.deck, c)) +
# "<style>" + styles + "</style>" +
# runFilter("drawQuestion", mungeQA(self.deck, c.htmlQuestion()),
# c) +
# "<br><br><hr><br><br>" +
# runFilter("drawAnswer", mungeQA(self.deck, c.htmlAnswer()),
# c)
# + "</body></html>")
# clearAudioQueue()
# playFromText(c.question)
# playFromText(c.answer)
# def onChange(self, idx):
# self.currentCard = idx
# self.updateCard()
# def reject(self):
# saveGeom(self, "preview")
# QDialog.reject(self)

View file

@ -1,318 +0,0 @@
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys, re
import ankiqt.forms
import anki
from anki.models import *
from anki.facts import *
from anki.fonts import toCanonicalFont
from anki.cards import Card
from ankiqt import ui
class DisplayProperties(QDialog):
def __init__(self, parent, main=None):
QDialog.__init__(self, parent, Qt.Window)
if not main:
main = parent
self.parent = parent
self.main = main
self.deck = main.deck
self.ignoreUpdate = False
self.plastiqueStyle = None
if (sys.platform.startswith("darwin") or
sys.platform.startswith("win32")):
self.plastiqueStyle = QStyleFactory.create("plastique")
self.dialog = ankiqt.forms.displayproperties.Ui_DisplayProperties()
self.dialog.setupUi(self)
self.model = self.deck.currentModel
self.setupChooser()
self.setupCards()
self.setupFields()
self.setupButtons()
self.show()
ui.dialogs.open("DisplayProperties", self)
def setupChooser(self):
self.modelChooser = ui.modelchooser.ModelChooser(self,
self.main,
self.main.deck,
self.modelChanged,
cards=False)
self.dialog.modelArea.setLayout(self.modelChooser)
def modelChanged(self, model):
self.model = model
self.drawCards()
self.drawFields()
def setupButtons(self):
self.connect(self.dialog.preview, SIGNAL("clicked()"),
self.previewClicked)
self.connect(self.dialog.helpButton, SIGNAL("clicked()"),
self.onHelp)
if self.main.config['showFontPreview']:
self.dialog.preview.setChecked(True)
else:
self.dialog.preview.setChecked(False)
self.previewClicked()
def previewClicked(self):
if self.dialog.preview.isChecked():
self.dialog.previewGroup.show()
self.setMaximumWidth(16777215)
self.setMinimumWidth(790)
self.main.config['showFontPreview'] = True
else:
self.dialog.previewGroup.hide()
self.setFixedWidth(380)
self.main.config['showFontPreview'] = False
def setupCards(self):
self.connect(self.dialog.cardList, SIGNAL("activated(int)"),
self.cardChanged)
for type in ("question", "answer"):
self.connect(self.cwidget("Font", type),
SIGNAL("currentFontChanged(QFont)"),
self.saveCard)
self.connect(self.cwidget("Size", type),
SIGNAL("valueChanged(int)"),
self.saveCard)
w = self.cwidget("Colour", type)
if self.plastiqueStyle:
w.setStyle(self.plastiqueStyle)
self.connect(w,
SIGNAL("clicked()"),
lambda w=w: self.chooseColour(w))
self.connect(self.cwidget("Align", type),
SIGNAL("activated(int)"),
self.saveCard)
# background colour
self.connect(self.dialog.backgroundColour,
SIGNAL("clicked()"),
lambda w=self.dialog.backgroundColour:\
self.chooseColour(w))
if self.plastiqueStyle:
self.dialog.backgroundColour.setStyle(self.plastiqueStyle)
self.drawCards()
def drawCards(self):
self.dialog.cardList.clear()
self.dialog.cardList.addItems(
QStringList([c.name for c in self.model.cardModels]))
for t in ("question", "answer"):
self.cwidget("Align", t).clear()
self.cwidget("Align", t).addItems(
QStringList(alignmentLabels().values()))
self.cardChanged(0)
def cardChanged(self, idx):
self.card = self.model.cardModels[idx]
self.readCard()
self.drawQuestionAndAnswer()
def readCard(self):
card = self.card
self.card = None
for type in ("question", "answer"):
self.cwidget("Font", type).setCurrentFont(QFont(
getattr(card, type + "FontFamily")))
self.cwidget("Size", type).setValue(
getattr(card, type + "FontSize"))
self.cwidget("Colour", type).setPalette(QPalette(QColor(
getattr(card, type + "FontColour"))))
self.cwidget("Align", type).setCurrentIndex(
getattr(card, type + "Align"))
self.dialog.backgroundColour.setPalette(QPalette(QColor(
getattr(card, "lastFontColour"))))
self.card = card
def saveCard(self):
if not self.card:
return
for type in ("question", "answer"):
setattr(self.card, type + "FontFamily", toCanonicalFont(unicode(
self.cwidget("Font", type).currentFont().family())))
setattr(self.card, type + "FontSize", int(
self.cwidget("Size", type).value()))
setattr(self.card, type + "Align", int(
self.cwidget("Align", type).currentIndex()))
w = self.cwidget("Colour", type)
c = w.palette().window().color()
setattr(self.card, type + "FontColour", unicode(c.name()))
self.card.model.setModified()
self.deck.setModified()
setattr(self.card, "lastFontColour", unicode(
self.dialog.backgroundColour.palette().window().color().name()))
self.drawQuestionAndAnswer()
def cwidget(self, name, type):
"Return a card widget."
return getattr(self.dialog, type + name)
def setupFields(self):
self.connect(self.dialog.fieldList, SIGNAL("currentRowChanged(int)"),
self.fieldChanged)
for type in ("quiz", "edit"):
self.connect(self.fwidget("fontFamily", type),
SIGNAL("currentFontChanged(QFont)"),
self.saveField)
self.connect(self.fwidget("fontSize", type),
SIGNAL("valueChanged(int)"),
self.saveField)
self.connect(self.fwidget("useFamily", type),
SIGNAL("stateChanged(int)"),
self.saveField)
self.connect(self.fwidget("useSize", type),
SIGNAL("stateChanged(int)"),
self.saveField)
if type == "quiz":
self.connect(self.fwidget("useColour", type),
SIGNAL("stateChanged(int)"),
self.saveField)
w = self.fwidget("fontColour", type)
if self.plastiqueStyle:
w.setStyle(self.plastiqueStyle)
self.connect(w,
SIGNAL("clicked()"),
lambda w=w: self.chooseColour(w))
elif type == "edit":
self.connect(self.dialog.rtl,
SIGNAL("stateChanged(int)"),
self.saveField)
self.currentField = None
self.drawFields()
def drawFields(self):
self.dialog.fieldList.clear()
n = 1
self.ignoreUpdate = True
for field in self.model.fieldModels:
item = QListWidgetItem(
_("Field %(num)d: %(name)s") % {
'num': n,
'name': field.name,
})
self.dialog.fieldList.addItem(item)
n += 1
self.dialog.fieldList.setCurrentRow(0)
self.fieldChanged(0)
self.ignoreUpdate = False
def fwidget(self, name, type):
"Return a field widget."
if type == "edit":
return getattr(self.dialog, name+"Edit")
else:
return getattr(self.dialog, name)
def fieldChanged(self, idx):
self.saveField()
self.currentField = None
field = self.model.fieldModels[idx]
for type in ("quiz", "edit"):
# family
if getattr(field, type + 'FontFamily'):
self.fwidget("useFamily", type).setCheckState(Qt.Checked)
self.fwidget("fontFamily", type).setCurrentFont(QFont(
getattr(field, type + 'FontFamily')))
self.fwidget("fontFamily", type).setEnabled(True)
else:
self.fwidget("useFamily", type).setCheckState(Qt.Unchecked)
self.fwidget("fontFamily", type).setEnabled(False)
# size
if getattr(field, type + 'FontSize'):
self.fwidget("useSize", type).setCheckState(Qt.Checked)
self.fwidget("fontSize", type).setValue(
getattr(field, type + 'FontSize'))
self.fwidget("fontSize", type).setEnabled(True)
else:
self.fwidget("useSize", type).setCheckState(Qt.Unchecked)
self.fwidget("fontSize", type).setEnabled(False)
if type == "quiz":
# colour
if getattr(field, type + 'FontColour'):
self.fwidget("useColour", type).setCheckState(Qt.Checked)
self.fwidget("fontColour", type).setPalette(QPalette(QColor(
getattr(field, type + 'FontColour'))))
self.fwidget("fontColour", type).setEnabled(True)
else:
self.fwidget("useColour", type).setCheckState(Qt.Unchecked)
self.fwidget("fontColour", type).setEnabled(False)
elif type == "edit":
self.dialog.rtl.setChecked(not not field.features)
self.currentField = field
def saveField(self, *args):
if self.ignoreUpdate:
return
field = self.currentField
if not field:
return
for type in ("quiz", "edit"):
# family
if self.fwidget("useFamily", type).isChecked():
setattr(field, type + 'FontFamily', toCanonicalFont(unicode(
self.fwidget("fontFamily", type).currentFont().family())))
else:
setattr(field, type + 'FontFamily', None)
# size
if self.fwidget("useSize", type).isChecked():
setattr(field, type + 'FontSize',
int(self.fwidget("fontSize", type).value()))
else:
setattr(field, type + 'FontSize', None)
# colour
if type == "quiz":
if self.fwidget("useColour", type).isChecked():
w = self.fwidget("fontColour", type)
c = w.palette().window().color()
setattr(field, type + 'FontColour', str(c.name()))
else:
setattr(field, type + 'FontColour', None)
elif type == "edit":
if self.dialog.rtl.isChecked():
field.features = u"rtl"
else:
field.features = u""
field.model.setModified()
self.deck.flushMod()
self.drawQuestionAndAnswer()
def chooseColour(self, button):
new = QColorDialog.getColor(button.palette().window().color(), self)
if new.isValid():
button.setPalette(QPalette(new))
self.saveField()
self.saveCard()
def drawQuestionAndAnswer(self):
self.deck.flushMod()
f = self.deck.newFact()
f.tags = u""
for field in f.fields:
f[field.name] = field.name
f.model = self.model
c = Card(f, self.card)
t = "<body><br><center>" + c.htmlQuestion() + "</center></body>"
bg = "body { background-color: %s; }\n" % self.card.lastFontColour
self.dialog.question.setText(
"<style>\n" + bg + self.deck.rebuildCSS() + "</style>\n" + t)
t = "<body><br><center>" + c.htmlAnswer() + "</center></body>"
self.dialog.answer.setText(
"<style>\n" + bg + self.deck.rebuildCSS() + "</style>\n" + t)
self.main.updateViews(self.main.state)
def reject(self):
ui.dialogs.close("DisplayProperties")
self.modelChooser.deinit()
QDialog.reject(self)
def onHelp(self):
QDesktopServices.openUrl(QUrl(ankiqt.appWiki +
"DisplayProperties"))

View file

@ -49,6 +49,7 @@ class FactEditor(object):
self.changeTimer = None self.changeTimer = None
self.lastCloze = None self.lastCloze = None
self.resetOnEdit = True self.resetOnEdit = True
self.card=None
addHook("deckClosed", self.deckClosedHook) addHook("deckClosed", self.deckClosedHook)
addHook("guiReset", self.refresh) addHook("guiReset", self.refresh)
addHook("colourChanged", self.colourChanged) addHook("colourChanged", self.colourChanged)
@ -106,6 +107,9 @@ class FactEditor(object):
def setupFields(self): def setupFields(self):
# init for later # init for later
self.fields = {} self.fields = {}
# button styles for mac
self.plastiqueStyle = QStyleFactory.create("plastique")
self.widget.setStyle(self.plastiqueStyle)
# top level vbox # top level vbox
self.fieldsBox = QVBoxLayout(self.widget) self.fieldsBox = QVBoxLayout(self.widget)
self.fieldsBox.setMargin(0) self.fieldsBox.setMargin(0)
@ -115,6 +119,20 @@ class FactEditor(object):
self.iconsBox2 = QHBoxLayout() self.iconsBox2 = QHBoxLayout()
self.fieldsBox.addLayout(self.iconsBox) self.fieldsBox.addLayout(self.iconsBox)
self.fieldsBox.addLayout(self.iconsBox2) self.fieldsBox.addLayout(self.iconsBox2)
# card layout
self.iconsBox.addItem(QSpacerItem(20,1, QSizePolicy.Expanding))
self.clayout = QPushButton("&Edit Card")
self.clayout.connect(self.clayout, SIGNAL("clicked()"), self.onCardLayout)
self.clayout.setSizePolicy(QSizePolicy.Preferred,QSizePolicy.Preferred)
self.clayout.setFixedHeight(20)
# self.clayout.setFixedWidth(48)
self.clayout.setIcon(QIcon(":/icons/edit.png"))
#self.clayout.setIconSize(QSize(32,32))
#self.clayout.setToolTip(_("Bold text (Ctrl+b)"))
#self.clayout.setShortcut(_("Ctrl+b"))
self.clayout.setFocusPolicy(Qt.NoFocus)
self.iconsBox.addWidget(self.clayout)
self.clayout.setStyle(self.plastiqueStyle)
# scrollarea # scrollarea
self.fieldsScroll = QScrollArea() self.fieldsScroll = QScrollArea()
self.fieldsScroll.setWidgetResizable(True) self.fieldsScroll.setWidgetResizable(True)
@ -133,15 +151,13 @@ class FactEditor(object):
self.fieldsBox.addLayout(self.tagsBox) self.fieldsBox.addLayout(self.tagsBox)
# icons # icons
self.iconsBox.setMargin(0) self.iconsBox.setMargin(0)
self.iconsBox.addItem(QSpacerItem(20,1, QSizePolicy.Expanding))
self.iconsBox2.setMargin(0) self.iconsBox2.setMargin(0)
self.iconsBox2.setMargin(0)
self.iconsBox2.addItem(QSpacerItem(20,1, QSizePolicy.Expanding))
# button styles for mac
self.plastiqueStyle = QStyleFactory.create("plastique")
self.widget.setStyle(self.plastiqueStyle)
# bold # bold
spc = QSpacerItem(5,5)
self.iconsBox.addItem(spc)
self.bold = QPushButton() self.bold = QPushButton()
self.bold.setFixedHeight(20)
self.bold.setFixedWidth(20)
self.bold.setCheckable(True) self.bold.setCheckable(True)
self.bold.connect(self.bold, SIGNAL("toggled(bool)"), self.toggleBold) self.bold.connect(self.bold, SIGNAL("toggled(bool)"), self.toggleBold)
self.bold.setIcon(QIcon(":/icons/text_bold.png")) self.bold.setIcon(QIcon(":/icons/text_bold.png"))
@ -153,6 +169,8 @@ class FactEditor(object):
self.bold.setStyle(self.plastiqueStyle) self.bold.setStyle(self.plastiqueStyle)
# italic # italic
self.italic = QPushButton(self.widget) self.italic = QPushButton(self.widget)
self.italic.setFixedHeight(20)
self.italic.setFixedWidth(20)
self.italic.setCheckable(True) self.italic.setCheckable(True)
self.italic.connect(self.italic, SIGNAL("toggled(bool)"), self.toggleItalic) self.italic.connect(self.italic, SIGNAL("toggled(bool)"), self.toggleItalic)
self.italic.setIcon(QIcon(":/icons/text_italic.png")) self.italic.setIcon(QIcon(":/icons/text_italic.png"))
@ -164,6 +182,8 @@ class FactEditor(object):
self.italic.setStyle(self.plastiqueStyle) self.italic.setStyle(self.plastiqueStyle)
# underline # underline
self.underline = QPushButton(self.widget) self.underline = QPushButton(self.widget)
self.underline.setFixedHeight(20)
self.underline.setFixedWidth(20)
self.underline.setCheckable(True) self.underline.setCheckable(True)
self.underline.connect(self.underline, SIGNAL("toggled(bool)"), self.toggleUnderline) self.underline.connect(self.underline, SIGNAL("toggled(bool)"), self.toggleUnderline)
self.underline.setIcon(QIcon(":/icons/text_under.png")) self.underline.setIcon(QIcon(":/icons/text_under.png"))
@ -180,8 +200,8 @@ class FactEditor(object):
self.foreground.setShortcut(_("F7, F7")) self.foreground.setShortcut(_("F7, F7"))
self.foreground.setFocusPolicy(Qt.NoFocus) self.foreground.setFocusPolicy(Qt.NoFocus)
self.foreground.setEnabled(False) self.foreground.setEnabled(False)
self.foreground.setFixedWidth(30) self.foreground.setFixedWidth(20)
self.foreground.setFixedHeight(26) self.foreground.setFixedHeight(20)
self.foregroundFrame = QFrame() self.foregroundFrame = QFrame()
self.foregroundFrame.setAutoFillBackground(True) self.foregroundFrame.setAutoFillBackground(True)
hbox = QHBoxLayout() hbox = QHBoxLayout()
@ -190,60 +210,62 @@ class FactEditor(object):
self.foreground.setLayout(hbox) self.foreground.setLayout(hbox)
self.iconsBox.addWidget(self.foreground) self.iconsBox.addWidget(self.foreground)
self.foreground.setStyle(self.plastiqueStyle) self.foreground.setStyle(self.plastiqueStyle)
self.iconsBox.addItem(QSpacerItem(5,1, QSizePolicy.Fixed))
# picker # picker
vbox = QVBoxLayout() # vbox = QVBoxLayout()
vbox.setMargin(0) # vbox.setMargin(0)
vbox.setSpacing(0) # vbox.setSpacing(0)
hbox = QHBoxLayout() # hbox = QHBoxLayout()
hbox.setMargin(0) # hbox.setMargin(0)
hbox.setSpacing(0) # hbox.setSpacing(0)
self.fleft = QPushButton() # self.fleft = QPushButton()
self.fleft.connect(self.fleft, SIGNAL("clicked()"), self.previousForeground) # self.fleft.connect(self.fleft, SIGNAL("clicked()"), self.previousForeground)
self.fleft.setToolTip(_("Previous colour (F7 then F6)")) # self.fleft.setToolTip(_("Previous colour (F7 then F6)"))
self.fleft.setText("<") # self.fleft.setText("<")
self.fleft.setShortcut(_("F7, F6")) # self.fleft.setShortcut(_("F7, F6"))
self.fleft.setFocusPolicy(Qt.NoFocus) # self.fleft.setFocusPolicy(Qt.NoFocus)
self.fleft.setEnabled(False) # self.fleft.setEnabled(False)
self.fleft.setFixedWidth(15) # self.fleft.setFixedWidth(15)
self.fleft.setFixedHeight(14) # self.fleft.setFixedHeight(14)
hbox.addWidget(self.fleft) # hbox.addWidget(self.fleft)
self.fleft.setStyle(self.plastiqueStyle) # self.fleft.setStyle(self.plastiqueStyle)
self.fright = QPushButton() # self.fright = QPushButton()
self.fright.connect(self.fright, SIGNAL("clicked()"), self.nextForeground) # self.fright.setFixedHeight(20)
self.fright.setToolTip(_("Next colour (F7 then F8)")) # self.fright.connect(self.fright, SIGNAL("clicked()"), self.nextForeground)
self.fright.setText(">") # self.fright.setToolTip(_("Next colour (F7 then F8)"))
self.fright.setShortcut(_("F7, F8")) # self.fright.setText(">")
self.fright.setFocusPolicy(Qt.NoFocus) # self.fright.setShortcut(_("F7, F8"))
self.fright.setEnabled(False) # self.fright.setFocusPolicy(Qt.NoFocus)
self.fright.setFixedWidth(15) # self.fright.setEnabled(False)
self.fright.setFixedHeight(14) # self.fright.setFixedWidth(15)
hbox.addWidget(self.fright) # self.fright.setFixedHeight(14)
self.fright.setStyle(self.plastiqueStyle) # hbox.addWidget(self.fright)
vbox.addLayout(hbox) # self.fright.setStyle(self.plastiqueStyle)
self.fchoose = QPushButton() # vbox.addLayout(hbox)
self.fchoose.connect(self.fchoose, SIGNAL("clicked()"), self.selectForeground) # self.fchoose = QPushButton()
self.fchoose.setToolTip(_("Choose colour (F7 then F5)")) # self.fchoose.connect(self.fchoose, SIGNAL("clicked()"), self.selectForeground)
self.fchoose.setText("+") # self.fchoose.setToolTip(_("Choose colour (F7 then F5)"))
self.fchoose.setShortcut(_("F7, F5")) # self.fchoose.setText("+")
self.fchoose.setFocusPolicy(Qt.NoFocus) # self.fchoose.setShortcut(_("F7, F5"))
self.fchoose.setEnabled(False) # self.fchoose.setFocusPolicy(Qt.NoFocus)
self.fchoose.setFixedWidth(30) # self.fchoose.setEnabled(False)
self.fchoose.setFixedHeight(12) # self.fchoose.setFixedWidth(30)
vbox.addWidget(self.fchoose) # self.fchoose.setFixedHeight(12)
self.fchoose.setStyle(self.plastiqueStyle) # vbox.addWidget(self.fchoose)
self.iconsBox.addLayout(vbox) # self.fchoose.setStyle(self.plastiqueStyle)
# self.iconsBox.addLayout(vbox)
# cloze # cloze
spc = QSpacerItem(5,5) # spc = QSpacerItem(5,5)
self.iconsBox.addItem(spc) # self.iconsBox2.addItem(spc)
self.cloze = QPushButton(self.widget) self.cloze = QPushButton(self.widget)
self.cloze.setFixedHeight(20)
self.clozeSC = QShortcut(QKeySequence(_("F9")), self.widget) self.clozeSC = QShortcut(QKeySequence(_("F9")), self.widget)
self.cloze.connect(self.cloze, SIGNAL("clicked()"), self.cloze.connect(self.cloze, SIGNAL("clicked()"),
self.onCloze) self.onCloze)
self.cloze.connect(self.clozeSC, SIGNAL("activated()"), self.cloze.connect(self.clozeSC, SIGNAL("activated()"),
self.onCloze) self.onCloze)
self.cloze.setToolTip(_("Cloze (F9)")) self.cloze.setToolTip(_("Cloze (F9)"))
self.cloze.setFixedWidth(30) self.cloze.setFixedWidth(24)
self.cloze.setFixedHeight(26)
self.cloze.setText("[...]") self.cloze.setText("[...]")
self.cloze.setFocusPolicy(Qt.NoFocus) self.cloze.setFocusPolicy(Qt.NoFocus)
self.cloze.setEnabled(False) self.cloze.setEnabled(False)
@ -251,6 +273,8 @@ class FactEditor(object):
self.cloze.setStyle(self.plastiqueStyle) self.cloze.setStyle(self.plastiqueStyle)
# pictures # pictures
self.addPicture = QPushButton(self.widget) self.addPicture = QPushButton(self.widget)
self.addPicture.setFixedHeight(20)
self.addPicture.setFixedWidth(20)
self.addPicture.connect(self.addPicture, SIGNAL("clicked()"), self.onAddPicture) self.addPicture.connect(self.addPicture, SIGNAL("clicked()"), self.onAddPicture)
self.addPicture.setFocusPolicy(Qt.NoFocus) self.addPicture.setFocusPolicy(Qt.NoFocus)
self.addPicture.setShortcut(_("F3")) self.addPicture.setShortcut(_("F3"))
@ -261,6 +285,8 @@ class FactEditor(object):
self.addPicture.setStyle(self.plastiqueStyle) self.addPicture.setStyle(self.plastiqueStyle)
# sounds # sounds
self.addSound = QPushButton(self.widget) self.addSound = QPushButton(self.widget)
self.addSound.setFixedHeight(20)
self.addSound.setFixedWidth(20)
self.addSound.connect(self.addSound, SIGNAL("clicked()"), self.onAddSound) self.addSound.connect(self.addSound, SIGNAL("clicked()"), self.onAddSound)
self.addSound.setFocusPolicy(Qt.NoFocus) self.addSound.setFocusPolicy(Qt.NoFocus)
self.addSound.setShortcut(_("F4")) self.addSound.setShortcut(_("F4"))
@ -271,6 +297,8 @@ class FactEditor(object):
self.addSound.setStyle(self.plastiqueStyle) self.addSound.setStyle(self.plastiqueStyle)
# sounds # sounds
self.recSound = QPushButton(self.widget) self.recSound = QPushButton(self.widget)
self.recSound.setFixedHeight(20)
self.recSound.setFixedWidth(20)
self.recSound.connect(self.recSound, SIGNAL("clicked()"), self.onRecSound) self.recSound.connect(self.recSound, SIGNAL("clicked()"), self.onRecSound)
self.recSound.setFocusPolicy(Qt.NoFocus) self.recSound.setFocusPolicy(Qt.NoFocus)
self.recSound.setShortcut(_("F5")) self.recSound.setShortcut(_("F5"))
@ -279,35 +307,23 @@ class FactEditor(object):
self.recSound.setToolTip(_("Record audio (F5)")) self.recSound.setToolTip(_("Record audio (F5)"))
self.iconsBox.addWidget(self.recSound) self.iconsBox.addWidget(self.recSound)
self.recSound.setStyle(self.plastiqueStyle) self.recSound.setStyle(self.plastiqueStyle)
# preview
spc = QSpacerItem(5,5)
self.iconsBox.addItem(spc)
self.preview = QPushButton(self.widget)
self.previewSC = QShortcut(QKeySequence(_("F2")), self.widget)
self.preview.connect(self.preview, SIGNAL("clicked()"),
self.onPreview)
self.preview.connect(self.previewSC, SIGNAL("activated()"),
self.onPreview)
self.preview.setToolTip(_("Preview (F2)"))
self.preview.setIcon(QIcon(":/icons/document-preview.png"))
self.preview.setFocusPolicy(Qt.NoFocus)
self.iconsBox.addWidget(self.preview)
self.preview.setStyle(self.plastiqueStyle)
# more # more
self.more = QPushButton(self.widget) self.more = QPushButton(self.widget)
self.more.setFixedHeight(20)
self.more.setFixedWidth(20)
self.more.connect(self.more, SIGNAL("clicked()"), self.more.connect(self.more, SIGNAL("clicked()"),
self.onMore) self.onMore)
self.more.setToolTip(_("Show advanced options")) self.more.setToolTip(_("Show advanced options"))
self.more.setText(">>") self.more.setText(">>")
self.more.setFocusPolicy(Qt.NoFocus) self.more.setFocusPolicy(Qt.NoFocus)
self.more.setFixedWidth(30)
self.more.setFixedHeight(26)
self.iconsBox.addWidget(self.more) self.iconsBox.addWidget(self.more)
self.more.setStyle(self.plastiqueStyle) self.more.setStyle(self.plastiqueStyle)
# latex # latex
spc = QSpacerItem(5,5) spc = QSpacerItem(5,5, QSizePolicy.Expanding)
self.iconsBox2.addItem(spc) self.iconsBox2.addItem(spc)
self.latex = QPushButton(self.widget) self.latex = QPushButton(self.widget)
self.latex.setFixedHeight(20)
self.latex.setFixedWidth(20)
self.latex.setToolTip(_("Latex (Ctrl+l then l)")) self.latex.setToolTip(_("Latex (Ctrl+l then l)"))
self.latexSC = QShortcut(QKeySequence(_("Ctrl+l, l")), self.widget) self.latexSC = QShortcut(QKeySequence(_("Ctrl+l, l")), self.widget)
self.latex.connect(self.latex, SIGNAL("clicked()"), self.insertLatex) self.latex.connect(self.latex, SIGNAL("clicked()"), self.insertLatex)
@ -319,6 +335,8 @@ class FactEditor(object):
self.latex.setStyle(self.plastiqueStyle) self.latex.setStyle(self.plastiqueStyle)
# latex eqn # latex eqn
self.latexEqn = QPushButton(self.widget) self.latexEqn = QPushButton(self.widget)
self.latexEqn.setFixedHeight(20)
self.latexEqn.setFixedWidth(20)
self.latexEqn.setToolTip(_("Latex equation (Ctrl+l then e)")) self.latexEqn.setToolTip(_("Latex equation (Ctrl+l then e)"))
self.latexEqnSC = QShortcut(QKeySequence(_("Ctrl+l, e")), self.widget) self.latexEqnSC = QShortcut(QKeySequence(_("Ctrl+l, e")), self.widget)
self.latexEqn.connect(self.latexEqn, SIGNAL("clicked()"), self.insertLatexEqn) self.latexEqn.connect(self.latexEqn, SIGNAL("clicked()"), self.insertLatexEqn)
@ -330,6 +348,8 @@ class FactEditor(object):
self.latexEqn.setStyle(self.plastiqueStyle) self.latexEqn.setStyle(self.plastiqueStyle)
# latex math env # latex math env
self.latexMathEnv = QPushButton(self.widget) self.latexMathEnv = QPushButton(self.widget)
self.latexMathEnv.setFixedHeight(20)
self.latexMathEnv.setFixedWidth(20)
self.latexMathEnv.setToolTip(_("Latex math environment (Ctrl+l then m)")) self.latexMathEnv.setToolTip(_("Latex math environment (Ctrl+l then m)"))
self.latexMathEnvSC = QShortcut(QKeySequence(_("Ctrl+l, m")), self.widget) self.latexMathEnvSC = QShortcut(QKeySequence(_("Ctrl+l, m")), self.widget)
self.latexMathEnv.connect(self.latexMathEnv, SIGNAL("clicked()"), self.latexMathEnv.connect(self.latexMathEnv, SIGNAL("clicked()"),
@ -343,6 +363,8 @@ class FactEditor(object):
self.latexMathEnv.setStyle(self.plastiqueStyle) self.latexMathEnv.setStyle(self.plastiqueStyle)
# html # html
self.htmlEdit = QPushButton(self.widget) self.htmlEdit = QPushButton(self.widget)
self.htmlEdit.setFixedHeight(20)
self.htmlEdit.setFixedWidth(20)
self.htmlEdit.setToolTip(_("HTML Editor (Ctrl+F9)")) self.htmlEdit.setToolTip(_("HTML Editor (Ctrl+F9)"))
self.htmlEditSC = QShortcut(QKeySequence(_("Ctrl+F9")), self.widget) self.htmlEditSC = QShortcut(QKeySequence(_("Ctrl+F9")), self.widget)
self.htmlEdit.connect(self.htmlEdit, SIGNAL("clicked()"), self.htmlEdit.connect(self.htmlEdit, SIGNAL("clicked()"),
@ -369,6 +391,7 @@ class FactEditor(object):
self.fieldsGrid = QGridLayout(self.fieldsFrame) self.fieldsGrid = QGridLayout(self.fieldsFrame)
self.fieldsFrame.setLayout(self.fieldsGrid) self.fieldsFrame.setLayout(self.fieldsGrid)
self.fieldsGrid.setMargin(0) self.fieldsGrid.setMargin(0)
self.fieldsGrid.setSpacing(5)
def drawField(self, field, n): def drawField(self, field, n):
# label # label
@ -645,9 +668,9 @@ class FactEditor(object):
self.italic.setEnabled(val) self.italic.setEnabled(val)
self.underline.setEnabled(val) self.underline.setEnabled(val)
self.foreground.setEnabled(val) self.foreground.setEnabled(val)
self.fchoose.setEnabled(val) # self.fchoose.setEnabled(val)
self.fleft.setEnabled(val) # self.fleft.setEnabled(val)
self.fright.setEnabled(val) # self.fright.setEnabled(val)
self.addPicture.setEnabled(val) self.addPicture.setEnabled(val)
self.addSound.setEnabled(val) self.addSound.setEnabled(val)
self.latex.setEnabled(val) self.latex.setEnabled(val)
@ -781,9 +804,9 @@ class FactEditor(object):
self.latexMathEnv.setShown(toggle) self.latexMathEnv.setShown(toggle)
self.htmlEdit.setShown(toggle) self.htmlEdit.setShown(toggle)
def onPreview(self): def onCardLayout(self):
self.saveFields() self.saveFields()
PreviewDialog(self.parent, self.deck, self.fact) ui.clayout.CardLayout(self.parent, self.fact, self.card)
# FIXME: in some future version, we should use a different delimiter, as # FIXME: in some future version, we should use a different delimiter, as
# [sound] et al conflicts # [sound] et al conflicts
@ -1107,61 +1130,3 @@ class FactEdit(QTextEdit):
if self._ownLayout == None: if self._ownLayout == None:
self._ownLayout = self._programLayout self._ownLayout = self._programLayout
ActivateKeyboardLayout(self._ownLayout, 0) ActivateKeyboardLayout(self._ownLayout, 0)
class PreviewDialog(QDialog):
def __init__(self, parent, deck, fact, *args):
QDialog.__init__(self, parent, *args)
self.deck = deck
self.fact = fact
cards = self.deck.previewFact(self.fact)
if not cards:
ui.utils.showInfo(_("No cards to preview."),
parent=parent)
return
self.cards = cards
self.currentCard = 0
self.dialog = ankiqt.forms.previewcards.Ui_Dialog()
self.dialog.setupUi(self)
self.dialog.webView.page().setLinkDelegationPolicy(
QWebPage.DelegateExternalLinks)
self.connect(self.dialog.webView,
SIGNAL("linkClicked(QUrl)"),
self.linkClicked)
self.dialog.comboBox.addItems(QStringList(
[c.cardModel.name for c in self.cards]))
self.connect(self.dialog.comboBox, SIGNAL("activated(int)"),
self.onChange)
self.updateCard()
restoreGeom(self, "preview")
self.exec_()
def linkClicked(self, url):
QDesktopServices.openUrl(QUrl(url))
def updateCard(self):
c = self.cards[self.currentCard]
styles = (self.deck.css +
("\nhtml { background: %s }" % c.cardModel.lastFontColour) +
"\ndiv { white-space: pre-wrap; }")
styles = runFilter("addStyles", styles, c)
self.dialog.webView.setHtml(
('<html><head>%s</head><body>' % getBase(self.deck, c)) +
"<style>" + styles + "</style>" +
runFilter("drawQuestion", mungeQA(self.deck, c.htmlQuestion()),
c) +
"<br><br><hr><br><br>" +
runFilter("drawAnswer", mungeQA(self.deck, c.htmlAnswer()),
c)
+ "</body></html>")
clearAudioQueue()
playFromText(c.question)
playFromText(c.answer)
def onChange(self, idx):
self.currentCard = idx
self.updateCard()
def reject(self):
saveGeom(self, "preview")
QDialog.reject(self)

View file

@ -1905,9 +1905,6 @@ learnt today")
def onDeckProperties(self): def onDeckProperties(self):
self.deckProperties = ui.deckproperties.DeckProperties(self, self.deck) self.deckProperties = ui.deckproperties.DeckProperties(self, self.deck)
def onDisplayProperties(self):
ui.dialogs.get("DisplayProperties", self)
def onPrefs(self): def onPrefs(self):
ui.preferences.Preferences(self, self.config) ui.preferences.Preferences(self, self.config)
@ -2376,7 +2373,6 @@ This deck already exists on your computer. Overwrite the local copy?"""),
"Close", "Close",
"Addcards", "Addcards",
"Editdeck", "Editdeck",
"DisplayProperties",
"DeckProperties", "DeckProperties",
"Undo", "Undo",
"Redo", "Redo",
@ -2407,7 +2403,6 @@ This deck already exists on your computer. Overwrite the local copy?"""),
self.connect(m.actionExit, s, self, SLOT("close()")) self.connect(m.actionExit, s, self, SLOT("close()"))
self.connect(m.actionSyncdeck, s, self.syncDeck) self.connect(m.actionSyncdeck, s, self.syncDeck)
self.connect(m.actionDeckProperties, s, self.onDeckProperties) self.connect(m.actionDeckProperties, s, self.onDeckProperties)
self.connect(m.actionDisplayProperties, s,self.onDisplayProperties)
self.connect(m.actionAddcards, s, self.onAddCard) self.connect(m.actionAddcards, s, self.onAddCard)
self.connect(m.actionEditdeck, s, self.onEditDeck) self.connect(m.actionEditdeck, s, self.onEditDeck)
self.connect(m.actionEditCurrent, s, self.onEditCurrent) self.connect(m.actionEditCurrent, s, self.onEditCurrent)

View file

@ -28,9 +28,8 @@ class ModelProperties(QDialog):
self.dialog.setupUi(self) self.dialog.setupUi(self)
self.connect(self.dialog.buttonBox, SIGNAL("helpRequested()"), self.connect(self.dialog.buttonBox, SIGNAL("helpRequested()"),
self.helpRequested) self.helpRequested)
self.setupFields()
self.setupCards()
self.readData() self.readData()
self.setupCards()
self.show() self.show()
self.undoName = _("Model Properties") self.undoName = _("Model Properties")
self.deck.setUndoStart(self.undoName) self.deck.setUndoStart(self.undoName)
@ -43,178 +42,6 @@ class ModelProperties(QDialog):
self.dialog.initialSpacing.setText(str(self.m.initialSpacing/60)) self.dialog.initialSpacing.setText(str(self.m.initialSpacing/60))
self.dialog.mediaURL.setText(unicode(self.m.features)) self.dialog.mediaURL.setText(unicode(self.m.features))
# Fields
##########################################################################
def setupFields(self):
self.fieldOrdinalUpdatedIds = []
self.ignoreFieldUpdate = False
self.currentField = None
self.updateFields()
self.readCurrentField()
self.connect(self.dialog.fieldList, SIGNAL("currentRowChanged(int)"),
self.fieldRowChanged)
self.connect(self.dialog.tabWidget, SIGNAL("currentChanged(int)"),
self.fieldRowChanged)
self.connect(self.dialog.fieldAdd, SIGNAL("clicked()"),
self.addField)
self.connect(self.dialog.fieldDelete, SIGNAL("clicked()"),
self.deleteField)
self.connect(self.dialog.fieldUp, SIGNAL("clicked()"),
self.moveFieldUp)
self.connect(self.dialog.fieldDown, SIGNAL("clicked()"),
self.moveFieldDown)
self.connect(self.dialog.fieldName, SIGNAL("lostFocus()"),
self.updateFields)
def updateFields(self, row = None):
oldRow = self.dialog.fieldList.currentRow()
if oldRow == -1:
oldRow = 0
self.dialog.fieldList.clear()
n = 1
for field in self.m.fieldModels:
label = _("Field %(num)d: %(name)s [%(cards)s non-empty]") % {
'num': n,
'name': field.name,
'cards': self.deck.fieldModelUseCount(field)
}
item = QListWidgetItem(label)
self.dialog.fieldList.addItem(item)
n += 1
count = self.dialog.fieldList.count()
if row != None:
self.dialog.fieldList.setCurrentRow(row)
else:
while (count > 0 and oldRow > (count - 1)):
oldRow -= 1
self.dialog.fieldList.setCurrentRow(oldRow)
self.enableFieldMoveButtons()
def fieldRowChanged(self):
if self.ignoreFieldUpdate:
return
self.saveCurrentField()
self.readCurrentField()
def readCurrentField(self):
if not len(self.m.fieldModels):
self.dialog.fieldEditBox.hide()
self.dialog.fieldUp.setEnabled(False)
self.dialog.fieldDown.setEnabled(False)
return
else:
self.dialog.fieldEditBox.show()
self.currentField = self.m.fieldModels[self.dialog.fieldList.currentRow()]
field = self.currentField
self.dialog.fieldName.setText(field.name)
self.dialog.fieldUnique.setChecked(field.unique)
self.dialog.fieldRequired.setChecked(field.required)
self.dialog.numeric.setChecked(field.numeric)
def enableFieldMoveButtons(self):
row = self.dialog.fieldList.currentRow()
if row < 1:
self.dialog.fieldUp.setEnabled(False)
else:
self.dialog.fieldUp.setEnabled(True)
if row == -1 or row >= (self.dialog.fieldList.count() - 1):
self.dialog.fieldDown.setEnabled(False)
else:
self.dialog.fieldDown.setEnabled(True)
def saveCurrentField(self):
if not self.currentField:
return
field = self.currentField
name = unicode(self.dialog.fieldName.text()).strip()
# renames
if not name:
name = _("Field %d") % (self.m.fieldModels.index(field) + 1)
if name != field.name:
self.deck.renameFieldModel(self.m, field, name)
# the card models will have been updated
self.readCurrentCard()
# unique, required, numeric
self.updateField(field, 'unique',
self.dialog.fieldUnique.checkState() == Qt.Checked)
self.updateField(field, 'required',
self.dialog.fieldRequired.checkState() == Qt.Checked)
self.updateField(field, 'numeric',
self.dialog.numeric.checkState() == Qt.Checked)
self.ignoreFieldUpdate = True
self.updateFields()
self.ignoreFieldUpdate = False
def addField(self):
f = FieldModel(required=False, unique=False)
f.name = _("Field %d") % (len(self.m.fieldModels) + 1)
self.deck.addFieldModel(self.m, f)
self.updateFields()
self.dialog.fieldList.setCurrentRow(len(self.m.fieldModels)-1)
self.dialog.fieldName.setFocus()
self.dialog.fieldName.selectAll()
def deleteField(self):
row = self.dialog.fieldList.currentRow()
if row == -1:
return
if len(self.m.fieldModels) < 2:
ui.utils.showInfo(
_("Please add a new field first."),
parent=self)
return
field = self.m.fieldModels[row]
count = self.deck.fieldModelUseCount(field)
if count:
if not ui.utils.askUser(
_("This field is used by %d cards. If you delete it,\n"
"all information in this field will be lost.\n"
"\nReally delete this field?") % count,
parent=self):
return
self.deck.deleteFieldModel(self.m, field)
self.currentField = None
self.updateFields()
# need to update q/a format
self.readCurrentCard()
def moveFieldUp(self):
row = self.dialog.fieldList.currentRow()
if row == -1:
return
if row == 0:
return
field = self.m.fieldModels[row]
tField = self.m.fieldModels[row - 1]
self.m.fieldModels.remove(field)
self.m.fieldModels.insert(row - 1, field)
if field.id not in self.fieldOrdinalUpdatedIds:
self.fieldOrdinalUpdatedIds.append(field.id)
if tField.id not in self.fieldOrdinalUpdatedIds:
self.fieldOrdinalUpdatedIds.append(tField.id)
self.ignoreFieldUpdate = True
self.updateFields(row - 1)
self.ignoreFieldUpdate = False
def moveFieldDown(self):
row = self.dialog.fieldList.currentRow()
if row == -1:
return
if row == len(self.m.fieldModels) - 1:
return
field = self.m.fieldModels[row]
tField = self.m.fieldModels[row + 1]
self.m.fieldModels.remove(field)
self.m.fieldModels.insert(row + 1, field)
if field.id not in self.fieldOrdinalUpdatedIds:
self.fieldOrdinalUpdatedIds.append(field.id)
if tField.id not in self.fieldOrdinalUpdatedIds:
self.fieldOrdinalUpdatedIds.append(tField.id)
self.ignoreFieldUpdate = True
self.updateFields(row + 1)
self.ignoreFieldUpdate = False
# Cards # Cards
########################################################################## ##########################################################################
@ -236,8 +63,12 @@ class ModelProperties(QDialog):
self.moveCardUp) self.moveCardUp)
self.connect(self.dialog.cardDown, SIGNAL("clicked()"), self.connect(self.dialog.cardDown, SIGNAL("clicked()"),
self.moveCardDown) self.moveCardDown)
self.connect(self.dialog.cardName, SIGNAL("lostFocus()"), self.connect(self.dialog.cardRename, SIGNAL("clicked()"),
self.updateCards) self.renameCard)
def renameCard(self):
self.needRebuild = True
self.updateCards()
def updateCards(self, row = None): def updateCards(self, row = None):
oldRow = self.dialog.cardList.currentRow() oldRow = self.dialog.cardList.currentRow()
@ -250,7 +81,7 @@ class ModelProperties(QDialog):
status="" status=""
else: else:
status=_("; disabled") status=_("; disabled")
label = _("Card %(num)d (%(name)s): used %(cards)d times%(status)s") % { label = _("%(name)s: used %(cards)d times%(status)s") % {
'num': n, 'num': n,
'name': card.name, 'name': card.name,
'status': status, 'status': status,
@ -274,49 +105,18 @@ class ModelProperties(QDialog):
self.saveCurrentCard() self.saveCurrentCard()
self.readCurrentCard() self.readCurrentCard()
def formatToScreen(self, fmt):
fmt = fmt.replace("<br>", "<br>\n")
fmt = re.sub("%\((.+?)\)s", "{{\\1}}", fmt)
return fmt
def screenToFormat(self, fmt):
fmt = fmt.replace("<br>\n", "<br>")
fmt = re.sub("{{(.+?)}}", "%(\\1)s", fmt)
return fmt
def readCurrentCard(self): def readCurrentCard(self):
if not len(self.m.cardModels): if not len(self.m.cardModels):
self.dialog.cardEditBox.hide()
self.dialog.cardToggle.setEnabled(False) self.dialog.cardToggle.setEnabled(False)
self.dialog.cardDelete.setEnabled(False) self.dialog.cardDelete.setEnabled(False)
self.dialog.cardUp.setEnabled(False) self.dialog.cardUp.setEnabled(False)
self.dialog.cardDown.setEnabled(False) self.dialog.cardDown.setEnabled(False)
return return
else: else:
self.dialog.cardEditBox.show()
self.dialog.cardToggle.setEnabled(True) self.dialog.cardToggle.setEnabled(True)
self.dialog.cardDelete.setEnabled(True) self.dialog.cardDelete.setEnabled(True)
self.currentCard = self.m.cardModels[self.dialog.cardList.currentRow()] self.currentCard = self.m.cardModels[self.dialog.cardList.currentRow()]
card = self.currentCard card = self.currentCard
self.dialog.cardName.setText(card.name)
self.dialog.cardQuestion.setPlainText(self.formatToScreen(card.qformat))
self.dialog.cardAnswer.setPlainText(self.formatToScreen(card.aformat))
self.dialog.questionInAnswer.setChecked(card.questionInAnswer)
self.dialog.allowEmptyAnswer.setChecked(card.allowEmptyAnswer)
self.dialog.typeAnswer.clear()
self.fieldNames = self.deck.s.column0("""
select fieldModels.name as n from fieldModels, cardModels
where cardModels.modelId = fieldModels.modelId
and cardModels.id = :id
order by n""", id=card.id)
s = [_("Don't ask me to type in the answer")]
s += [_("Compare with field '%s'") % f for f in self.fieldNames]
self.dialog.typeAnswer.insertItems(0, QStringList(s))
try:
idx = self.fieldNames.index(card.typeAnswer)
except ValueError:
idx = -1
self.dialog.typeAnswer.setCurrentIndex(idx + 1)
self.updateToggleButtonText(card) self.updateToggleButtonText(card)
def enableCardMoveButtons(self): def enableCardMoveButtons(self):
@ -340,22 +140,6 @@ order by n""", id=card.id)
if not self.currentCard: if not self.currentCard:
return return
card = self.currentCard card = self.currentCard
newname = unicode(self.dialog.cardName.text())
if not newname:
newname = _("Card-%d") % (self.m.cardModels.index(card) + 1)
self.updateField(card, 'name', newname)
s = unicode(self.dialog.cardQuestion.toPlainText())
changed = self.updateField(card, 'qformat', self.screenToFormat(s))
s = unicode(self.dialog.cardAnswer.toPlainText())
changed2 = self.updateField(card, 'aformat', self.screenToFormat(s))
self.needRebuild = self.needRebuild or changed or changed2
self.updateField(card, 'questionInAnswer', self.dialog.questionInAnswer.isChecked())
self.updateField(card, 'allowEmptyAnswer', self.dialog.allowEmptyAnswer.isChecked())
idx = self.dialog.typeAnswer.currentIndex()
if not idx:
self.updateField(card, 'typeAnswer', u"")
else:
self.updateField(card, 'typeAnswer', self.fieldNames[idx-1])
self.ignoreCardUpdate = True self.ignoreCardUpdate = True
self.updateCards() self.updateCards()
self.ignoreCardUpdate = False self.ignoreCardUpdate = False
@ -370,13 +154,11 @@ order by n""", id=card.id)
def addCard(self): def addCard(self):
cards = len(self.m.cardModels) cards = len(self.m.cardModels)
name = _("Card %d") % (cards+1) name = _("Name_%d") % (cards+1)
cm = CardModel(name=name) cm = CardModel(name=name)
self.m.addCardModel(cm) self.m.addCardModel(cm)
self.updateCards() self.updateCards()
self.dialog.cardList.setCurrentRow(len(self.m.cardModels)-1) self.dialog.cardList.setCurrentRow(len(self.m.cardModels)-1)
self.dialog.cardName.setFocus()
self.dialog.cardName.selectAll()
def deleteCard(self): def deleteCard(self):
row = self.dialog.cardList.currentRow() row = self.dialog.cardList.currentRow()
@ -491,18 +273,12 @@ order by n""", id=card.id)
pass pass
# before field, or it's overwritten # before field, or it's overwritten
self.saveCurrentCard() self.saveCurrentCard()
self.saveCurrentField() # if changed, reset deck
# rebuild ordinals if changed reset = False
if len(self.fieldOrdinalUpdatedIds) > 0:
self.deck.rebuildFieldOrdinals(self.m.id, self.fieldOrdinalUpdatedIds)
self.m.setModified()
self.deck.setModified()
if len(self.cardOrdinalUpdatedIds) > 0: if len(self.cardOrdinalUpdatedIds) > 0:
self.deck.rebuildCardOrdinals(self.cardOrdinalUpdatedIds) self.deck.rebuildCardOrdinals(self.cardOrdinalUpdatedIds)
self.m.setModified() self.m.setModified()
self.deck.setModified() self.deck.setModified()
# if changed, reset deck
reset = False
if self.origModTime != self.deck.modified: if self.origModTime != self.deck.modified:
self.deck.updateTagsForModel(self.m) self.deck.updateTagsForModel(self.m)
reset = True reset = True

View file

@ -161,6 +161,12 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item> <item>
<widget class="QSplitter" name="splitter2"> <widget class="QSplitter" name="splitter2">
<property name="orientation"> <property name="orientation">

571
designer/clayout.ui Normal file
View file

@ -0,0 +1,571 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>464</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1" rowspan="3">
<widget class="QGroupBox" name="previewGroup">
<property name="title">
<string>Preview</string>
</property>
<layout class="QVBoxLayout" name="_3">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QTextEdit" name="preview">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Card Templates</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="_6">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="1">
<widget class="QTextEdit" name="cardQuestion">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QTextEdit" name="cardAnswer">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Template</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QComboBox" name="cardList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="editTemplates">
<property name="text">
<string>&amp;Edit</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" rowspan="2">
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="label_14">
<property name="text">
<string>Question</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="flipLabel">
<property name="text">
<string>&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href=&quot;#&quot;&gt;(flip)&lt;/a&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>Answer</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Alignment</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="alignment"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Background</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="background">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QComboBox" name="typeAnswer"/>
</item>
<item>
<widget class="QCheckBox" name="questionInAnswer">
<property name="text">
<string>Hide the question when showing answer</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="allowEmptyAnswer">
<property name="text">
<string>Allow the answer to be blank</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Fields</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListWidget" name="fieldList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>60</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="fieldAdd">
<property name="text">
<string>&amp;Add</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fieldUp">
<property name="toolTip">
<string>Move selected field up</string>
</property>
<property name="text">
<string>&amp;Up</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fieldDown">
<property name="toolTip">
<string>Move selected field down</string>
</property>
<property name="text">
<string>Dow&amp;n</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fieldDelete">
<property name="text">
<string>&amp;Delete</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="1">
<widget class="QLineEdit" name="fieldName"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Name</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Size</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QFontComboBox" name="fontFamily">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="fontColour">
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Reviewing</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="fontSize">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>300</number>
</property>
<property name="value">
<number>14</number>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Editing</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QSpinBox" name="fontSizeEdit">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>300</number>
</property>
<property name="value">
<number>14</number>
</property>
</widget>
</item>
<item row="0" column="5">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>1</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="rtl">
<property name="text">
<string>Reverse text direction (RTL)</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="numeric">
<property name="text">
<string>Sort as numbers in browser</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="fieldRequired">
<property name="text">
<string>Prevent empty entries</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="fieldUnique">
<property name="text">
<string>Prevent duplicates</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../icons.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>419</width> <width>379</width>
<height>457</height> <height>396</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -27,13 +27,13 @@
</property> </property>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tab_2">
<attribute name="title"> <attribute name="title">
<string>Models &amp;&amp; Priorities</string> <string>Basic</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_6"> <layout class="QGridLayout" name="gridLayout_6">
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_16"> <widget class="QLabel" name="label_16">
<property name="text"> <property name="text">
<string>&lt;h1&gt;Priorities&lt;/h1&gt;</string> <string>&lt;b&gt;Priorities&lt;/b&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -42,7 +42,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_21"> <widget class="QLabel" name="label_21">
<property name="text"> <property name="text">
<string>&lt;b&gt;Very High Priority&lt;/b&gt;</string> <string>Very high priority</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@ -55,7 +55,7 @@
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_17"> <widget class="QLabel" name="label_17">
<property name="text"> <property name="text">
<string>&lt;b&gt;High Priority&lt;/b&gt;</string> <string>High priority</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@ -68,7 +68,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_24"> <widget class="QLabel" name="label_24">
<property name="text"> <property name="text">
<string>&lt;b&gt;Low Priority&lt;/b&gt;</string> <string>Low priority</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@ -93,27 +93,30 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_14"> <widget class="QLabel" name="label_14">
<property name="text"> <property name="text">
<string>&lt;h1&gt;Models&lt;/h1&gt;</string> <string>&lt;b&gt;Models&lt;/b&gt;</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QListWidget" name="modelsList"/>
</item>
<item row="3" column="0"> <item row="3" column="0">
<layout class="QHBoxLayout" name="_2"> <layout class="QGridLayout" name="gridLayout_2">
<property name="spacing"> <item row="0" column="0">
<number>6</number> <widget class="QListWidget" name="modelsList">
</property> <property name="sizePolicy">
<property name="margin"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<number>0</number> <horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
</widget>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<widget class="QPushButton" name="modelsAdd"> <widget class="QPushButton" name="modelsAdd">
<property name="text"> <property name="text">
@ -144,45 +147,8 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>Synchronisation</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <spacer name="verticalSpacer_3">
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="whatsThis">
<string>label</string>
</property>
<property name="text">
<string>&lt;h1&gt;Synchronisation&lt;/h1&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="doSync">
<property name="text">
<string>Synchronise this deck</string>
</property>
</widget>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3"/>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -194,11 +160,33 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="0"> </layout>
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0">
<widget class="QCheckBox" name="doSync">
<property name="text">
<string>Synchronize this deck with AnkiWeb</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_13">
<property name="whatsThis">
<string>label</string>
</property>
<property name="text">
<string>&lt;b&gt;Synchronization&lt;/b&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_4"> <widget class="QWidget" name="tab_4">
@ -212,13 +200,6 @@
<property name="margin"> <property name="margin">
<number>6</number> <number>6</number>
</property> </property>
<item>
<widget class="QLabel" name="label_27">
<property name="text">
<string>&lt;h1&gt;Advanced&lt;/h1&gt;</string>
</property>
</widget>
</item>
<item> <item>
<layout class="QGridLayout"> <layout class="QGridLayout">
<property name="margin"> <property name="margin">
@ -227,88 +208,130 @@
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
<item row="5" column="2"> <item row="6" column="3">
<widget class="QLineEdit" name="easyMin"/> <widget class="QLineEdit" name="easyMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item> </item>
<item row="4" column="1"> <item row="5" column="2">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Min</string> <string>Min</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="6" column="2">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Min</string> <string>Min</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="4"> <item row="5" column="5">
<widget class="QLineEdit" name="midMax"/> <widget class="QLineEdit" name="midMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>&lt;b&gt;4: Initial Easy Interval&lt;/b&gt;</string> <string>Initial button 4 interval</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>&lt;b&gt;3: Initial Good Interval&lt;/b&gt;</string> <string>Initial button 3 interval</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="3"> <item row="6" column="4">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
<string>Max</string> <string>Max</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="4" column="3">
<widget class="QLineEdit" name="hardMin"/> <widget class="QLineEdit" name="hardMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item> </item>
<item row="4" column="2"> <item row="5" column="3">
<widget class="QLineEdit" name="midMin"/> <widget class="QLineEdit" name="midMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item> </item>
<item row="3" column="3"> <item row="4" column="4">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
<string>Max</string> <string>Max</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="4"> <item row="6" column="5">
<widget class="QLineEdit" name="easyMax"/> <widget class="QLineEdit" name="easyMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item> </item>
<item row="3" column="4"> <item row="4" column="5">
<widget class="QLineEdit" name="hardMax"/> <widget class="QLineEdit" name="hardMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="2">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Min</string> <string>Min</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="3"> <item row="5" column="4">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="text"> <property name="text">
<string>Max</string> <string>Max</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>&lt;b&gt;2: Initial Hard Interval&lt;/b&gt;</string> <string>Initial button 2 interval</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="4"> <item row="0" column="5">
<widget class="QLineEdit" name="delay0"> <widget class="QLineEdit" name="delay0">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@ -318,88 +341,111 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>&lt;b&gt;1: Extra Mature Delay&lt;/b&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLineEdit" name="delay1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>&lt;b&gt;1: Failure Multiplier&lt;/b&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLineEdit" name="delay2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_20"> <widget class="QLabel" name="label_20">
<property name="text"> <property name="text">
<string>&lt;b&gt;1: Again Delay&lt;/b&gt;</string> <string>Button 1 delay</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="5"> <item row="0" column="6">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>mins</string> <string>mins</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="5"> <item row="4" column="6">
<widget class="QLabel" name="label_25">
<property name="text">
<string>days</string>
</property>
</widget>
</item>
<item row="3" column="5">
<widget class="QLabel" name="label_30"> <widget class="QLabel" name="label_30">
<property name="text"> <property name="text">
<string>days</string> <string>days</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="5"> <item row="5" column="6">
<widget class="QLabel" name="label_31"> <widget class="QLabel" name="label_31">
<property name="text"> <property name="text">
<string>days</string> <string>days</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="5"> <item row="6" column="6">
<widget class="QLabel" name="label_32"> <widget class="QLabel" name="label_32">
<property name="text"> <property name="text">
<string>days</string> <string>days</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_19">
<property name="text">
<string>Button 1 multiplier</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Mature bonus</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="6">
<widget class="QLabel" name="label_25">
<property name="text">
<string>days</string>
</property>
</widget>
</item>
<item row="1" column="5">
<widget class="QLineEdit" name="delay2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QLineEdit" name="delay1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0" colspan="7">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -414,7 +460,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_29"> <widget class="QLabel" name="label_29">
<property name="text"> <property name="text">
<string>&lt;b&gt;New day starts at&lt;/b&gt;</string> <string>New day starts at</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -437,7 +483,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_26"> <widget class="QLabel" name="label_26">
<property name="text"> <property name="text">
<string>&lt;b&gt;Show failed cards early&lt;/b&gt;</string> <string>Show failed cards early</string>
</property> </property>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>
@ -467,7 +513,7 @@
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_11"> <widget class="QLabel" name="label_11">
<property name="text"> <property name="text">
<string>&lt;b&gt;Suspend leeches&lt;/b&gt;</string> <string>Suspend leeches</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -481,7 +527,7 @@
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_15"> <widget class="QLabel" name="label_15">
<property name="text"> <property name="text">
<string>&lt;b&gt;Leech failure threshold&lt;/b&gt;</string> <string>Leech failure threshold</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -491,7 +537,7 @@
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_23"> <widget class="QLabel" name="label_23">
<property name="text"> <property name="text">
<string>&lt;b&gt;Per-day scheduling&lt;/b&gt;</string> <string>Per-day scheduling</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -535,6 +581,7 @@
</widget> </widget>
<tabstops> <tabstops>
<tabstop>qtabwidget</tabstop> <tabstop>qtabwidget</tabstop>
<tabstop>doSync</tabstop>
<tabstop>modelsList</tabstop> <tabstop>modelsList</tabstop>
<tabstop>modelsAdd</tabstop> <tabstop>modelsAdd</tabstop>
<tabstop>modelsEdit</tabstop> <tabstop>modelsEdit</tabstop>
@ -542,10 +589,10 @@
<tabstop>highPriority</tabstop> <tabstop>highPriority</tabstop>
<tabstop>medPriority</tabstop> <tabstop>medPriority</tabstop>
<tabstop>lowPriority</tabstop> <tabstop>lowPriority</tabstop>
<tabstop>doSync</tabstop> <tabstop>buttonBox</tabstop>
<tabstop>delay0</tabstop> <tabstop>delay0</tabstop>
<tabstop>delay1</tabstop>
<tabstop>delay2</tabstop> <tabstop>delay2</tabstop>
<tabstop>delay1</tabstop>
<tabstop>hardMin</tabstop> <tabstop>hardMin</tabstop>
<tabstop>hardMax</tabstop> <tabstop>hardMax</tabstop>
<tabstop>midMin</tabstop> <tabstop>midMin</tabstop>
@ -557,7 +604,6 @@
<tabstop>timeOffset</tabstop> <tabstop>timeOffset</tabstop>
<tabstop>suspendLeeches</tabstop> <tabstop>suspendLeeches</tabstop>
<tabstop>leechFails</tabstop> <tabstop>leechFails</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections> <connections>

View file

@ -1,741 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DisplayProperties</class>
<widget class="QDialog" name="DisplayProperties">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>818</width>
<height>427</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Fonts &amp; Colours</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>:/icons/fonts.png</normaloff>:/icons/fonts.png</iconset>
</property>
<layout class="QVBoxLayout" name="_3">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>12</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>360</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>360</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout">
<property name="spacing">
<number>7</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="modelArea" native="true"/>
</item>
<item>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Cards</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Card:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cardList"/>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>5</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Question font</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="answerColour">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Answer size</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Answer colour</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Answer font</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QFontComboBox" name="answerFont"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Question alignment</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Question size</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="questionSize">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QFontComboBox" name="questionFont"/>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="questionColour">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="answerSize">
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Question colour</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Answer alignment</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="questionAlign"/>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="answerAlign">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Background colour</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QPushButton" name="backgroundColour">
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Fields</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QListWidget" name="fieldList">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string> &lt;b&gt;When reviewing and editing:&lt;/b&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="_4">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>5</number>
</property>
<item row="1" column="0">
<widget class="QCheckBox" name="useSize">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Use custom size</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QFontComboBox" name="fontFamily">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="useFamily">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Use custom font</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="fontSize">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>300</number>
</property>
<property name="value">
<number>14</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="useColour">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Use custom colour</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="fontColour">
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="text">
<string/>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string> &lt;b&gt;When editing (overrides above):&lt;/b&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="_5">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>5</number>
</property>
<item row="1" column="1">
<widget class="QSpinBox" name="fontSizeEdit">
<property name="minimum">
<number>5</number>
</property>
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="useSizeEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Use custom size</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QFontComboBox" name="fontFamilyEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="useFamilyEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Use custom font</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="rtl">
<property name="text">
<string>Right to Left (RTL)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="helpButton">
<property name="text">
<string>Help</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="preview">
<property name="text">
<string>Show preview</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QGroupBox" name="previewGroup">
<property name="title">
<string>Preview</string>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QTextEdit" name="question">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="answer">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>cardList</tabstop>
<tabstop>questionFont</tabstop>
<tabstop>questionSize</tabstop>
<tabstop>questionColour</tabstop>
<tabstop>questionAlign</tabstop>
<tabstop>answerFont</tabstop>
<tabstop>answerSize</tabstop>
<tabstop>answerColour</tabstop>
<tabstop>answerAlign</tabstop>
<tabstop>backgroundColour</tabstop>
<tabstop>fieldList</tabstop>
<tabstop>useFamily</tabstop>
<tabstop>fontFamily</tabstop>
<tabstop>useSize</tabstop>
<tabstop>fontSize</tabstop>
<tabstop>useColour</tabstop>
<tabstop>fontColour</tabstop>
<tabstop>useFamilyEdit</tabstop>
<tabstop>fontFamilyEdit</tabstop>
<tabstop>useSizeEdit</tabstop>
<tabstop>fontSizeEdit</tabstop>
<tabstop>rtl</tabstop>
<tabstop>helpButton</tabstop>
<tabstop>preview</tabstop>
<tabstop>closeButton</tabstop>
<tabstop>question</tabstop>
<tabstop>answer</tabstop>
</tabstops>
<resources>
<include location="../icons.qrc"/>
</resources>
<connections>
<connection>
<sender>closeButton</sender>
<signal>clicked()</signal>
<receiver>DisplayProperties</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>315</x>
<y>385</y>
</hint>
<hint type="destinationlabel">
<x>325</x>
<y>525</y>
</hint>
</hints>
</connection>
<connection>
<sender>useFamily</sender>
<signal>toggled(bool)</signal>
<receiver>fontFamily</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>107</x>
<y>187</y>
</hint>
<hint type="destinationlabel">
<x>178</x>
<y>194</y>
</hint>
</hints>
</connection>
<connection>
<sender>useSize</sender>
<signal>toggled(bool)</signal>
<receiver>fontSize</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>134</x>
<y>226</y>
</hint>
<hint type="destinationlabel">
<x>205</x>
<y>224</y>
</hint>
</hints>
</connection>
<connection>
<sender>useColour</sender>
<signal>toggled(bool)</signal>
<receiver>fontColour</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>93</x>
<y>256</y>
</hint>
<hint type="destinationlabel">
<x>175</x>
<y>253</y>
</hint>
</hints>
</connection>
<connection>
<sender>useFamilyEdit</sender>
<signal>toggled(bool)</signal>
<receiver>fontFamilyEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>122</x>
<y>299</y>
</hint>
<hint type="destinationlabel">
<x>215</x>
<y>301</y>
</hint>
</hints>
</connection>
<connection>
<sender>useSizeEdit</sender>
<signal>toggled(bool)</signal>
<receiver>fontSizeEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>129</x>
<y>340</y>
</hint>
<hint type="destinationlabel">
<x>210</x>
<y>337</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -3135,7 +3135,6 @@
<addaction name="separator"/> <addaction name="separator"/>
</widget> </widget>
<addaction name="actionStudyOptions"/> <addaction name="actionStudyOptions"/>
<addaction name="actionDisplayProperties"/>
<addaction name="actionDeckProperties"/> <addaction name="actionDeckProperties"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="menuPlugins"/> <addaction name="menuPlugins"/>

View file

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>420</width> <width>471</width>
<height>551</height> <height>435</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -18,30 +18,13 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QGroupBox" name="groupBox">
<property name="currentIndex"> <property name="title">
<number>0</number> <string>General</string>
</property>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>General &amp;&amp; Fields</string>
</attribute>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QLabel" name="label_2"> <layout class="QGridLayout" name="gridLayout_2">
<property name="text">
<string>&lt;h1&gt;General&lt;/h1&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>4</number> <number>4</number>
</property> </property>
@ -49,9 +32,9 @@
<number>4</number> <number>4</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>&lt;b&gt;Name&lt;/b&gt;</string> <string>Name</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@ -62,9 +45,9 @@
<widget class="QLineEdit" name="name"/> <widget class="QLineEdit" name="name"/>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_19"> <widget class="QLabel" name="label_20">
<property name="text"> <property name="text">
<string>&lt;b&gt;Minimum spacing&lt;/b&gt;</string> <string>Minimum spacing</string>
</property> </property>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>
@ -72,13 +55,9 @@
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_25"> <widget class="QLabel" name="label_26">
<property name="text"> <property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>Spacing multiplier</string>
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Spacing multiplier&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>
@ -86,23 +65,23 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QLineEdit" name="initialSpacing"/> <widget class="QLineEdit" name="initialSpacing"/>
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_6">
<item> <item>
<widget class="QLineEdit" name="spacing"/> <widget class="QLineEdit" name="spacing"/>
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>&lt;b&gt;Media URL&lt;/B&gt;</string> <string>Media URL</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -111,182 +90,18 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>&lt;h1&gt;Fields&lt;/h1&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="fieldList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>60</height>
</size>
</property>
</widget>
</item>
</layout> </layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="fieldAdd">
<property name="text">
<string>&amp;Add</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="fieldUp"> <widget class="QGroupBox" name="groupBox_2">
<property name="toolTip">
<string>Move selected field up</string>
</property>
<property name="text">
<string>Move &amp;Up</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fieldDown">
<property name="toolTip">
<string>Move selected field down</string>
</property>
<property name="text">
<string>Move Dow&amp;n</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="fieldDelete">
<property name="text">
<string>&amp;Delete</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="fieldEditBox">
<property name="title"> <property name="title">
<string/>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>&lt;b&gt;Options&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="fieldName"/>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="fieldUnique">
<property name="text">
<string>Prevent duplicates</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>&lt;b&gt;Name&lt;/b&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="fieldRequired">
<property name="text">
<string>Prevent empty entries</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="numeric">
<property name="text">
<string>Sort as numbers</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Card Templates</string> <string>Card Templates</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>&lt;h1&gt;Card Templates&lt;/h1&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QListWidget" name="cardList"> <widget class="QListWidget" name="cardList">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@ -302,10 +117,8 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="0" column="1">
</item> <layout class="QVBoxLayout" name="verticalLayout_4">
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QPushButton" name="cardAdd"> <widget class="QPushButton" name="cardAdd">
<property name="text"> <property name="text">
@ -313,13 +126,20 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="cardRename">
<property name="text">
<string>&amp;Rename</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="cardUp"> <widget class="QPushButton" name="cardUp">
<property name="toolTip"> <property name="toolTip">
<string>Move selected card model up</string> <string>Move selected card model up</string>
</property> </property>
<property name="text"> <property name="text">
<string>Move &amp;Up</string> <string>&amp;Up</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -329,7 +149,7 @@ p, li { white-space: pre-wrap; }
<string>Move selected card model down</string> <string>Move selected card model down</string>
</property> </property>
<property name="text"> <property name="text">
<string>Move Dow&amp;n</string> <string>Dow&amp;n</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -347,137 +167,25 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="cardEditBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QGridLayout" name="_3"> <spacer name="verticalSpacer_3">
<property name="margin"> <property name="orientation">
<number>0</number> <enum>Qt::Vertical</enum>
</property> </property>
<property name="spacing"> <property name="sizeHint" stdset="0">
<number>6</number> <size>
<width>20</width>
<height>40</height>
</size>
</property> </property>
<item row="3" column="0"> </spacer>
<widget class="QLabel" name="label_23">
<property name="text">
<string>&lt;b&gt;Options&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QTextEdit" name="cardAnswer">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_15">
<property name="text">
<string>&lt;b&gt;Answer&lt;/b&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="cardName"/>
</item>
<item row="1" column="1">
<widget class="QTextEdit" name="cardQuestion">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="tabChangesFocus">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>&lt;b&gt;Name&lt;/b&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>&lt;b&gt;Question&lt;/b&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="typeAnswer"/>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="questionInAnswer">
<property name="text">
<string>Hide the question when showing answer</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="allowEmptyAnswer">
<property name="text">
<string>Allow the answer to be blank</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
</layout> </layout>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</widget>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
@ -490,38 +198,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</item> </item>
</layout> </layout>
<zorder>buttonBox</zorder>
<zorder>tabWidget</zorder>
</widget> </widget>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>name</tabstop>
<tabstop>initialSpacing</tabstop>
<tabstop>spacing</tabstop>
<tabstop>mediaURL</tabstop>
<tabstop>fieldList</tabstop>
<tabstop>fieldAdd</tabstop>
<tabstop>fieldUp</tabstop>
<tabstop>fieldDown</tabstop>
<tabstop>fieldDelete</tabstop>
<tabstop>fieldName</tabstop>
<tabstop>fieldUnique</tabstop>
<tabstop>fieldRequired</tabstop>
<tabstop>numeric</tabstop>
<tabstop>cardList</tabstop>
<tabstop>cardAdd</tabstop>
<tabstop>cardUp</tabstop>
<tabstop>cardDown</tabstop>
<tabstop>cardToggle</tabstop>
<tabstop>cardDelete</tabstop>
<tabstop>cardName</tabstop>
<tabstop>cardQuestion</tabstop>
<tabstop>cardAnswer</tabstop>
<tabstop>typeAnswer</tabstop>
<tabstop>questionInAnswer</tabstop>
<tabstop>allowEmptyAnswer</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>

View file

@ -1,82 +0,0 @@
<ui version="4.0" >
<class>Dialog</class>
<widget class="QDialog" name="Dialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle" >
<string>Preview Cards</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QComboBox" name="comboBox" />
</item>
<item>
<widget class="QWebView" name="webView" >
<property name="url" >
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -68,7 +68,7 @@ cat $temp >> $init
rm $temp rm $temp
# use older integer format so qt4.4 still works # use older integer format so qt4.4 still works
sed -i 's/setProperty("value", 14)/setProperty("value", QtCore.QVariant(14))/' ankiqt/forms/displayproperties.py #sed -i 's/setProperty("value", 14)/setProperty("value", QtCore.QVariant(14))/' ankiqt/forms/displayproperties.py
echo "Building resources.." echo "Building resources.."
$pyrcc icons.qrc -o icons_rc.py $pyrcc icons.qrc -o icons_rc.py