Merge pull request #525 from Hk-tang/change-to-more-pythonic

Change not not to bool
This commit is contained in:
Damien Elmes 2020-03-24 16:01:15 +10:00 committed by GitHub
commit 6143a7e218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -29,6 +29,7 @@ Yoonchae Lee
Evandro Coan <github.com/evandrocoan>
Alan Du <alanhdu@gmail.com>
Yuchen Lei <lyc@xuming.studio>
Henry Tang <hktang@ualberta.ca>
********************

View File

@ -865,7 +865,7 @@ QTableView {{ gridline-color: {grid} }}
def _onRowChanged(self, current, previous) -> None:
update = self.updateTitle()
show = self.model.cards and update == 1
self.form.splitter.widget(1).setVisible(not not show)
self.form.splitter.widget(1).setVisible(bool(show))
idx = self.form.tableView.selectionModel().currentIndex()
if idx.isValid():
self.card = self.model.getCard(idx)
@ -1660,12 +1660,12 @@ where id in %s"""
and self._previewState == "answer"
and not self._previewBothSides
)
self._previewPrev.setEnabled(not not (self.singleCard and canBack))
self._previewPrev.setEnabled(bool(self.singleCard and canBack))
canForward = (
self.currentRow() < self.model.rowCount(None) - 1
or self._previewState == "question"
)
self._previewNext.setEnabled(not not (self.singleCard and canForward))
self._previewNext.setEnabled(bool(self.singleCard and canForward))
def _closePreview(self):
if self._previewWindow:
@ -1925,7 +1925,7 @@ update cards set usn=?, mod=?, did=? where id in """
######################################################################
def isSuspended(self):
return not not (self.card and self.card.queue == QUEUE_TYPE_SUSPENDED)
return bool(self.card and self.card.queue == QUEUE_TYPE_SUSPENDED)
def onSuspend(self):
self.editor.saveNow(self._onSuspend)
@ -1986,7 +1986,7 @@ update cards set usn=?, mod=?, did=? where id in """
self.deleteTags(tags="marked", label=False)
def isMarked(self):
return not not (self.card and self.card.note().hasTag("Marked"))
return bool(self.card and self.card.note().hasTag("Marked"))
# Repositioning
######################################################################