Previewer: parent become private

It seems parent is a method of QDialog, so it creates a typing problem
This commit is contained in:
Arthur Milchior 2020-04-02 10:31:29 +02:00
parent 31f2f60757
commit 6564f00748

View File

@ -29,7 +29,7 @@ class Previewer:
_timer = None _timer = None
def __init__(self, parent: QWidget, mw: AnkiQt): def __init__(self, parent: QWidget, mw: AnkiQt):
self.parent = parent self._parent = parent
self.mw = mw self.mw = mw
def card(self) -> Optional[Card]: def card(self) -> Optional[Card]:
@ -258,37 +258,37 @@ class MultipleCardsPreviewer(Previewer):
class BrowserPreviewer(MultipleCardsPreviewer): class BrowserPreviewer(MultipleCardsPreviewer):
def card(self) -> Optional[Card]: def card(self) -> Optional[Card]:
if self.parent.singleCard: if self._parent.singleCard:
return self.parent.card return self._parent.card
else: else:
return None return None
def _onFinished(self, ok): def _onFinished(self, ok):
super()._onFinished(ok) super()._onFinished(ok)
self.parent.form.previewButton.setChecked(False) self._parent.form.previewButton.setChecked(False)
def _onPrevCard(self): def _onPrevCard(self):
self.parent.editor.saveNow( self._parent.editor.saveNow(
lambda: self.parent._moveCur(QAbstractItemView.MoveUp) lambda: self._parent._moveCur(QAbstractItemView.MoveUp)
) )
def _onNextCard(self): def _onNextCard(self):
self.parent.editor.saveNow( self._parent.editor.saveNow(
lambda: self.parent._moveCur(QAbstractItemView.MoveDown) lambda: self._parent._moveCur(QAbstractItemView.MoveDown)
) )
def _should_enable_prev(self): 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): def _should_enable_next(self):
return ( return (
super()._should_enable_next() 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): def _onClose(self):
super()._onClose() super()._onClose()
self.parent.previewer = None self._parent.previewer = None
def _renderScheduled(self) -> None: def _renderScheduled(self) -> None:
super()._renderScheduled() super()._renderScheduled()