Merge pull request #181 from Glutanimate/fix-previewer-navigation

Improve previewer navigation
This commit is contained in:
Damien Elmes 2017-03-26 15:49:34 +10:00 committed by GitHub
commit 783767be0d

View File

@ -1064,8 +1064,8 @@ where id in %s""" % ids2str(sf))
self.form.previewButton.setChecked(False) self.form.previewButton.setChecked(False)
def _onPreviewPrev(self): def _onPreviewPrev(self):
if self._previewState == "question": if self._previewState == "answer":
self._previewState = "answer" self._previewState = "question"
self._renderPreview() self._renderPreview()
else: else:
self.onPreviousCard() self.onPreviousCard()
@ -1085,7 +1085,8 @@ where id in %s""" % ids2str(sf))
def _updatePreviewButtons(self): def _updatePreviewButtons(self):
if not self._previewWindow: if not self._previewWindow:
return return
canBack = self.currentRow() > 0 or self._previewState == "question" current = self.currentRow()
canBack = (current > 0 or (current == 0 and self._previewState == "answer" ))
self._previewPrev.setEnabled(not not (self.singleCard and canBack)) self._previewPrev.setEnabled(not not (self.singleCard and canBack))
canForward = self.currentRow() < self.model.rowCount(None) - 1 or \ canForward = self.currentRow() < self.model.rowCount(None) - 1 or \
self._previewState == "question" self._previewState == "question"