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