mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
move latex conf into model
This commit is contained in:
parent
b5b24be530
commit
d02cfa28d9
4 changed files with 128 additions and 43 deletions
|
@ -27,9 +27,6 @@ class DeckOptions(QDialog):
|
||||||
# syncing
|
# syncing
|
||||||
self.form.doSync.setChecked(self.d.syncingEnabled())
|
self.form.doSync.setChecked(self.d.syncingEnabled())
|
||||||
self.form.mediaURL.setText(self.d.conf['mediaURL'])
|
self.form.mediaURL.setText(self.d.conf['mediaURL'])
|
||||||
# latex
|
|
||||||
self.form.latexHeader.setText(self.d.conf['latexPre'])
|
|
||||||
self.form.latexFooter.setText(self.d.conf['latexPost'])
|
|
||||||
|
|
||||||
def helpRequested(self):
|
def helpRequested(self):
|
||||||
aqt.openHelp("DeckOptions")
|
aqt.openHelp("DeckOptions")
|
||||||
|
@ -51,9 +48,6 @@ class DeckOptions(QDialog):
|
||||||
if not url.endswith("/"):
|
if not url.endswith("/"):
|
||||||
url += "/"
|
url += "/"
|
||||||
self.d.conf['mediaURL'] = url
|
self.d.conf['mediaURL'] = url
|
||||||
# latex
|
|
||||||
self.d.conf['latexPre'] = unicode(self.form.latexHeader.toPlainText())
|
|
||||||
self.d.conf['latexPost'] = unicode(self.form.latexFooter.toPlainText())
|
|
||||||
QDialog.reject(self)
|
QDialog.reject(self)
|
||||||
if needSync:
|
if needSync:
|
||||||
aqt.mw.syncDeck(interactive=-1)
|
aqt.mw.syncDeck(interactive=-1)
|
||||||
|
|
|
@ -37,11 +37,14 @@ class Models(QDialog):
|
||||||
c(b, s, self.onRename)
|
c(b, s, self.onRename)
|
||||||
b = box.addButton(_("Delete"), t)
|
b = box.addButton(_("Delete"), t)
|
||||||
c(b, s, self.onDelete)
|
c(b, s, self.onDelete)
|
||||||
|
b = box.addButton(_("Advanced..."), t)
|
||||||
|
c(b, s, self.onAdvanced)
|
||||||
c(f.modelsList, SIGNAL("currentRowChanged(int)"), self.modelChanged)
|
c(f.modelsList, SIGNAL("currentRowChanged(int)"), self.modelChanged)
|
||||||
c(f.modelsList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"),
|
c(f.modelsList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"),
|
||||||
self.onRename)
|
self.onRename)
|
||||||
self.updateModelsList()
|
self.updateModelsList()
|
||||||
f.modelsList.setCurrentRow(0)
|
f.modelsList.setCurrentRow(0)
|
||||||
|
maybeHideClose(box)
|
||||||
|
|
||||||
def onRename(self):
|
def onRename(self):
|
||||||
txt = getText(_("New name?"), default=self.model.name)
|
txt = getText(_("New name?"), default=self.model.name)
|
||||||
|
@ -107,6 +110,16 @@ class Models(QDialog):
|
||||||
self.model = None
|
self.model = None
|
||||||
self.updateModelsList()
|
self.updateModelsList()
|
||||||
|
|
||||||
|
def onAdvanced(self):
|
||||||
|
d = QDialog(self)
|
||||||
|
frm = aqt.forms.modelopts.Ui_Dialog()
|
||||||
|
frm.setupUi(d)
|
||||||
|
frm.latexHeader.setText(self.model.conf['latexPre'])
|
||||||
|
frm.latexFooter.setText(self.model.conf['latexPost'])
|
||||||
|
d.exec_()
|
||||||
|
self.model.conf['latexPre'] = unicode(frm.latexHeader.toPlainText())
|
||||||
|
self.model.conf['latexPost'] = unicode(frm.latexFooter.toPlainText())
|
||||||
|
|
||||||
def saveModel(self):
|
def saveModel(self):
|
||||||
self.model.flush()
|
self.model.flush()
|
||||||
|
|
||||||
|
|
|
@ -82,41 +82,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>LaTeX</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>Header</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="latexHeader">
|
|
||||||
<property name="tabChangesFocus">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>Footer</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="latexFooter">
|
|
||||||
<property name="tabChangesFocus">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -136,8 +101,6 @@
|
||||||
<tabstop>doSync</tabstop>
|
<tabstop>doSync</tabstop>
|
||||||
<tabstop>mediaURL</tabstop>
|
<tabstop>mediaURL</tabstop>
|
||||||
<tabstop>buttonBox</tabstop>
|
<tabstop>buttonBox</tabstop>
|
||||||
<tabstop>latexHeader</tabstop>
|
|
||||||
<tabstop>latexFooter</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
|
115
designer/modelopts.ui
Normal file
115
designer/modelopts.ui
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Dialog</class>
|
||||||
|
<widget class="QDialog" name="Dialog">
|
||||||
|
<property name="windowModality">
|
||||||
|
<enum>Qt::ApplicationModal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>353</width>
|
||||||
|
<height>363</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Model Options</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="qtabwidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>LaTeX</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Header</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="latexHeader">
|
||||||
|
<property name="tabChangesFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Footer</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="latexFooter">
|
||||||
|
<property name="tabChangesFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<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>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>qtabwidget</tabstop>
|
||||||
|
<tabstop>buttonBox</tabstop>
|
||||||
|
<tabstop>latexHeader</tabstop>
|
||||||
|
<tabstop>latexFooter</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>Dialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>275</x>
|
||||||
|
<y>442</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>343</x>
|
||||||
|
<y>442</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
Loading…
Reference in a new issue