add 'show current only' again

This commit is contained in:
Damien Elmes 2008-11-19 17:24:52 +09:00
parent 34177f0caa
commit f5234f52eb
4 changed files with 16 additions and 1 deletions

View file

@ -64,6 +64,7 @@ class Config(dict):
'showTimer': True, 'showTimer': True,
'showSuspendedCards': True, 'showSuspendedCards': True,
'simpleToolbar': True, 'simpleToolbar': True,
'editCurrentOnly': 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):

View file

@ -264,8 +264,12 @@ class EditDeck(QDialog):
def selectLastCard(self): def selectLastCard(self):
"Show the row corresponding to the current card." "Show the row corresponding to the current card."
if self.parent.config['editCurrentOnly']:
if self.parent.currentCard:
self.dialog.filterEdit.setText("<current>")
self.dialog.filterEdit.selectAll()
self.updateSearch() self.updateSearch()
if self.parent.currentCard: if not self.parent.config['editCurrentOnly'] and self.parent.currentCard:
currentCardIndex = self.findCardInDeckModel( currentCardIndex = self.findCardInDeckModel(
self.model, self.parent.currentCard ) self.model, self.parent.currentCard )
if currentCardIndex >= 0: if currentCardIndex >= 0:

View file

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

View file

@ -511,6 +511,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0" >
<widget class="QCheckBox" name="editCurrentOnly" >
<property name="text" >
<string>Show only current card in editor</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -598,6 +605,7 @@
<tabstop>showToolbar</tabstop> <tabstop>showToolbar</tabstop>
<tabstop>tallButtons</tabstop> <tabstop>tallButtons</tabstop>
<tabstop>showTray</tabstop> <tabstop>showTray</tabstop>
<tabstop>editCurrentOnly</tabstop>
<tabstop>toolbarIconSize</tabstop> <tabstop>toolbarIconSize</tabstop>
<tabstop>buttonBox</tabstop> <tabstop>buttonBox</tabstop>
</tabstops> </tabstops>