mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
make thai hack optional, move some adv options into first tab
This commit is contained in:
parent
21774b9fc4
commit
93731bf4f4
5 changed files with 70 additions and 42 deletions
|
@ -69,6 +69,7 @@ class Config(dict):
|
|||
'qaDivider': True,
|
||||
'splitQA': True,
|
||||
'sortIndex': 0,
|
||||
'addZeroSpace': True,
|
||||
}
|
||||
for (k,v) in fields.items():
|
||||
if not self.has_key(k):
|
||||
|
|
|
@ -175,6 +175,7 @@ class Preferences(QDialog):
|
|||
self.dialog.scrollToAnswer.setChecked(self.config['scrollToAnswer'])
|
||||
self.dialog.showDivider.setChecked(self.config['qaDivider'])
|
||||
self.dialog.splitQA.setChecked(self.config['splitQA'])
|
||||
self.dialog.addZeroSpace.setChecked(self.config['addZeroSpace'])
|
||||
self.dialog.toolbarIconSize.setText(str(self.config['iconSize']))
|
||||
|
||||
def updateAdvanced(self):
|
||||
|
@ -192,6 +193,7 @@ class Preferences(QDialog):
|
|||
self.config['scrollToAnswer'] = self.dialog.scrollToAnswer.isChecked()
|
||||
self.config['qaDivider'] = self.dialog.showDivider.isChecked()
|
||||
self.config['splitQA'] = self.dialog.splitQA.isChecked()
|
||||
self.config['addZeroSpace'] = self.dialog.addZeroSpace.isChecked()
|
||||
i = 32
|
||||
try:
|
||||
i = int(self.dialog.toolbarIconSize.text())
|
||||
|
|
|
@ -184,6 +184,4 @@ def mungeQA(deck, txt):
|
|||
create=True), match).encode("utf-8")), "utf-8")
|
||||
return 'img src="%s"' % src
|
||||
txt = re.sub('img src="(.*?)"', quote, txt)
|
||||
# hack to fix thai presentation issues
|
||||
txt = txt.replace("</span>", "​</span>")
|
||||
return txt
|
||||
|
|
|
@ -138,7 +138,7 @@ class View(object):
|
|||
height = 35
|
||||
else:
|
||||
height = 45
|
||||
self.write(self.center(mungeQA(self.main.deck, q), height))
|
||||
self.write(self.center(self.mungeQA(self.main.deck, q), height))
|
||||
if self.state != self.oldState and not nosound:
|
||||
playFromText(q)
|
||||
|
||||
|
@ -146,10 +146,17 @@ class View(object):
|
|||
"Show the answer."
|
||||
a = self.main.currentCard.htmlAnswer()
|
||||
self.write(self.center('<span id=answer />' +
|
||||
mungeQA(self.main.deck, a)))
|
||||
self.mungeQA(self.main.deck, a)))
|
||||
if self.state != self.oldState:
|
||||
playFromText(a)
|
||||
|
||||
def mungeQA(self, deck, txt):
|
||||
txt = mungeQA(deck, txt)
|
||||
# hack to fix thai presentation issues
|
||||
if self.main.config['addZeroSpace']:
|
||||
txt = txt.replace("</span>", "​</span>")
|
||||
return txt
|
||||
|
||||
def onLoadFinished(self):
|
||||
if self.state == "showAnswer":
|
||||
if self.main.config['scrollToAnswer']:
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>322</width>
|
||||
<height>438</height>
|
||||
<height>417</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
|
@ -15,6 +15,9 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget" >
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -24,13 +27,16 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>306</width>
|
||||
<height>372</height>
|
||||
<height>351</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
<string>Display</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
|
@ -67,8 +73,11 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><h1>Fonts & Colours</h1></string>
|
||||
<string><h1>Display</h1></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
|
@ -153,6 +162,34 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showDivider" >
|
||||
<property name="text" >
|
||||
<string>Show divider between question and answer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="splitQA" >
|
||||
<property name="text" >
|
||||
<string>Put space between question and answer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="suppressEstimates" >
|
||||
<property name="text" >
|
||||
<string>Don't show next time before answer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer" >
|
||||
<property name="orientation" >
|
||||
|
@ -174,7 +211,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>306</width>
|
||||
<height>372</height>
|
||||
<height>351</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
|
@ -362,7 +399,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>306</width>
|
||||
<height>372</height>
|
||||
<height>351</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
|
@ -392,66 +429,52 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QCheckBox" name="suppressEstimates" >
|
||||
<property name="text" >
|
||||
<string>Hide next interval when showing answer buttons</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QCheckBox" name="showLastCardContent" >
|
||||
<property name="text" >
|
||||
<string>Show last card's question/answer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<widget class="QCheckBox" name="showLastCardInterval" >
|
||||
<property name="text" >
|
||||
<string>Show last card's interval</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" >
|
||||
<widget class="QCheckBox" name="showToolbar" >
|
||||
<property name="text" >
|
||||
<string>Show toolbar on startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" >
|
||||
<item row="6" column="0" >
|
||||
<widget class="QCheckBox" name="tallButtons" >
|
||||
<property name="text" >
|
||||
<string>Tall buttons (for touchscreen)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" >
|
||||
<item row="7" column="0" >
|
||||
<widget class="QCheckBox" name="showTray" >
|
||||
<property name="text" >
|
||||
<string>Show tray icon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" >
|
||||
<item row="8" column="0" >
|
||||
<widget class="QCheckBox" name="scrollToAnswer" >
|
||||
<property name="text" >
|
||||
<string>Scroll down to the answer when showing answer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" >
|
||||
<widget class="QCheckBox" name="showDivider" >
|
||||
<item row="4" column="0" >
|
||||
<widget class="QCheckBox" name="showLastCardInterval" >
|
||||
<property name="text" >
|
||||
<string>Show divider between question and answer</string>
|
||||
<string>Show last card's interval</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" >
|
||||
<widget class="QCheckBox" name="splitQA" >
|
||||
<item row="3" column="0" >
|
||||
<widget class="QCheckBox" name="showLastCardContent" >
|
||||
<property name="text" >
|
||||
<string>Put space between question and answer</string>
|
||||
<string>Show last card's question/answer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" >
|
||||
<widget class="QCheckBox" name="addZeroSpace" >
|
||||
<property name="text" >
|
||||
<string>Add hidden char to text (fixes Thai on OSX)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -531,15 +554,12 @@
|
|||
<tabstop>syncOnClose</tabstop>
|
||||
<tabstop>simpleToolbar</tabstop>
|
||||
<tabstop>showTimer</tabstop>
|
||||
<tabstop>suppressEstimates</tabstop>
|
||||
<tabstop>showLastCardContent</tabstop>
|
||||
<tabstop>showLastCardInterval</tabstop>
|
||||
<tabstop>showToolbar</tabstop>
|
||||
<tabstop>tallButtons</tabstop>
|
||||
<tabstop>showTray</tabstop>
|
||||
<tabstop>scrollToAnswer</tabstop>
|
||||
<tabstop>showDivider</tabstop>
|
||||
<tabstop>splitQA</tabstop>
|
||||
<tabstop>toolbarIconSize</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
|
|
Loading…
Reference in a new issue