From 6564f00748b8e947b1b5bb7de7ee310cdc00b7b3 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Thu, 2 Apr 2020 10:31:29 +0200 Subject: [PATCH] Previewer: parent become private It seems parent is a method of QDialog, so it creates a typing problem --- qt/aqt/previewer.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/qt/aqt/previewer.py b/qt/aqt/previewer.py index 337fd1a13..163620653 100644 --- a/qt/aqt/previewer.py +++ b/qt/aqt/previewer.py @@ -29,7 +29,7 @@ class Previewer: _timer = None def __init__(self, parent: QWidget, mw: AnkiQt): - self.parent = parent + self._parent = parent self.mw = mw def card(self) -> Optional[Card]: @@ -258,37 +258,37 @@ class MultipleCardsPreviewer(Previewer): class BrowserPreviewer(MultipleCardsPreviewer): def card(self) -> Optional[Card]: - if self.parent.singleCard: - return self.parent.card + if self._parent.singleCard: + return self._parent.card else: return None def _onFinished(self, ok): super()._onFinished(ok) - self.parent.form.previewButton.setChecked(False) + self._parent.form.previewButton.setChecked(False) def _onPrevCard(self): - self.parent.editor.saveNow( - lambda: self.parent._moveCur(QAbstractItemView.MoveUp) + self._parent.editor.saveNow( + lambda: self._parent._moveCur(QAbstractItemView.MoveUp) ) def _onNextCard(self): - self.parent.editor.saveNow( - lambda: self.parent._moveCur(QAbstractItemView.MoveDown) + self._parent.editor.saveNow( + lambda: self._parent._moveCur(QAbstractItemView.MoveDown) ) def _should_enable_prev(self): - return super()._should_enable_prev() or self.parent.currentRow() > 0 + return super()._should_enable_prev() or self._parent.currentRow() > 0 def _should_enable_next(self): return ( super()._should_enable_next() - or self.parent.currentRow() < self.parent.model.rowCount(None) - 1 + or self._parent.currentRow() < self._parent.model.rowCount(None) - 1 ) def _onClose(self): super()._onClose() - self.parent.previewer = None + self._parent.previewer = None def _renderScheduled(self) -> None: super()._renderScheduled()