Ensuring value of sortBackwards is a Boolean

As far as Python is concerned, this commit does not change anything at
all. The purpose of this commit is to avoid a rare bug in
AnkiDroid. https://github.com/ankidroid/Anki-Android/issues/5523

Indeed, because of
hh.sortIndicatorChanged.connect(self.onSortChanged), onSortChanged may
be called with the values 0 or 1 instead of True or False. Which means
than the method getBoolean in Ankidroid may throw an exception,
stating that the value is an integer and not a Boolean.
This commit is contained in:
Arthur Milchior 2019-10-28 04:25:12 +01:00
parent 0ffb308004
commit 35f42523d5

View file

@ -701,6 +701,7 @@ class Browser(QMainWindow):
hh.sectionMoved.connect(self.onColumnMoved)
def onSortChanged(self, idx, ord):
ord = bool(ord)
self.editor.saveNow(lambda: self._onSortChanged(idx, ord))
def _onSortChanged(self, idx, ord):