make scrolling to answer customizable

This commit is contained in:
Damien Elmes 2008-11-23 08:04:32 +09:00
parent e0f9d09abd
commit 0207298bb5
4 changed files with 18 additions and 2 deletions

View file

@ -66,6 +66,7 @@ class Config(dict):
'showSuspendedCards': True,
'simpleToolbar': True,
'editCurrentOnly': True,
'scrollToAnswer': True,
}
for (k,v) in fields.items():
if not self.has_key(k):

View file

@ -170,6 +170,7 @@ class Preferences(QDialog):
self.dialog.showTimer.setChecked(self.config['showTimer'])
self.dialog.simpleToolbar.setChecked(self.config['simpleToolbar'])
self.dialog.editCurrentOnly.setChecked(self.config['editCurrentOnly'])
self.dialog.scrollToAnswer.setChecked(self.config['scrollToAnswer'])
self.dialog.toolbarIconSize.setText(str(self.config['iconSize']))
def updateAdvanced(self):
@ -185,6 +186,7 @@ class Preferences(QDialog):
self.config['suppressEstimates'] = self.dialog.suppressEstimates.isChecked()
self.config['simpleToolbar'] = self.dialog.simpleToolbar.isChecked()
self.config['editCurrentOnly'] = self.dialog.editCurrentOnly.isChecked()
self.config['scrollToAnswer'] = self.dialog.scrollToAnswer.isChecked()
i = 32
try:
i = int(self.dialog.toolbarIconSize.text())

View file

@ -125,8 +125,9 @@ class View(object):
def onLoadFinished(self):
if self.state == "showAnswer":
mf = self.body.page().mainFrame()
mf.evaluateJavaScript("location.hash = 'answer'")
if self.main.config['scrollToAnswer']:
mf = self.body.page().mainFrame()
mf.evaluateJavaScript("location.hash = 'answer'")
# Top section
##########################################################################

View file

@ -441,6 +441,13 @@
</property>
</widget>
</item>
<item row="10" column="0" >
<widget class="QCheckBox" name="scrollToAnswer" >
<property name="text" >
<string>Scroll down to the answer when showing answer</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -502,6 +509,10 @@
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>interfaceLang</tabstop>
<tabstop>interfaceFamily</tabstop>
<tabstop>interfaceSize</tabstop>
<tabstop>interfaceColour</tabstop>
<tabstop>backgroundColour</tabstop>
<tabstop>saveWhenClosing</tabstop>
<tabstop>saveAfterEvery</tabstop>
<tabstop>saveAfterEveryNum</tabstop>
@ -520,6 +531,7 @@
<tabstop>tallButtons</tabstop>
<tabstop>showTray</tabstop>
<tabstop>editCurrentOnly</tabstop>
<tabstop>scrollToAnswer</tabstop>
<tabstop>toolbarIconSize</tabstop>
<tabstop>buttonBox</tabstop>
</tabstops>