Skip to content

Commit

Permalink
Merge pull request #4 from nanthony21/dev
Browse files Browse the repository at this point in the history
Fix usage of renamed class
  • Loading branch information
nanthony21 authored Apr 13, 2021
2 parents e66612f + 76a5913 commit 831ef57
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from PyQt5.QtGui import QTextDocument, QAbstractTextDocumentLayout, QPalette
from PyQt5.QtWidgets import QStyledItemDelegate, QWidget, QStyleOptionViewItem, QStyle, QGridLayout, QTableWidget, \
QTableWidgetItem, QAbstractItemView, QSizePolicy, QApplication
from pwspy.utility.acquisition.steps import SequencerStep, CoordSequencerStep, StepTypeNames, ContainerStep
from pwspy.utility.acquisition.steps import SequencerStep, IterableSequencerStep, StepTypeNames, ContainerStep


class IterationRangeEditor(QWidget):
Expand Down Expand Up @@ -49,7 +49,7 @@ def __init__(self, parent: QWidget):
l.setRowStretch(1, 1) # Allow the actual wigdets to sit at the top of the layout without getting stretched out.
self.setLayout(l)

def setFromStep(self, step: CoordSequencerStep) -> None:
def setFromStep(self, step: IterableSequencerStep) -> None:
"""
Update the appearance and labels of this widget based on the `Step` provided as input.
Expand Down Expand Up @@ -152,7 +152,7 @@ def __init__(self, parent: QWidget = None):
self.editor = None

def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QtCore.QModelIndex) -> QWidget:
if isinstance(index.internalPointer(), CoordSequencerStep):
if isinstance(index.internalPointer(), IterableSequencerStep):
widg = IterationRangeEditor(parent)
widg.setFromStep(index.internalPointer())
widg.resize(option.rect.size())
Expand All @@ -163,7 +163,7 @@ def createEditor(self, parent: QWidget, option: QStyleOptionViewItem, index: QtC

def setModelData(self, editor: IterationRangeEditor, model: QtCore.QAbstractItemModel, index: QtCore.QModelIndex) -> None:
step: SequencerStep = index.internalPointer()
if isinstance(step, CoordSequencerStep):
if isinstance(step, IterableSequencerStep):
coordRange = (step.id, editor.getSelection())
step.setData(QtCore.Qt.EditRole, coordRange)
self._editing = None
Expand All @@ -176,7 +176,7 @@ def editorEvent(self, event: QtCore.QEvent, model: QtCore.QAbstractItemModel, op
return super().editorEvent(event, model, option, index)

def sizeHint(self, option: QStyleOptionViewItem, index: QtCore.QModelIndex) -> QtCore.QSize:
if isinstance(index.internalPointer(), CoordSequencerStep) and self._editing == index:
if isinstance(index.internalPointer(), IterableSequencerStep) and self._editing == index:
self.initStyleOption(option, index)
editor = self.createEditor(None, option, index)
s = editor.sizeHint()
Expand All @@ -185,7 +185,7 @@ def sizeHint(self, option: QStyleOptionViewItem, index: QtCore.QModelIndex) -> Q
return super().sizeHint(option, index)

def displayText(self, value: typing.Any, locale: QtCore.QLocale) -> str:
if isinstance(value, CoordSequencerStep):
if isinstance(value, IterableSequencerStep):
itRangeCoord: typing.Tuple[int, typing.Sequence[int]] = value.data(QtCore.Qt.EditRole)
if itRangeCoord is None:
selectedIterations = [] # TODO this happens for steps where we haven't assigned any iterations (non iterable step types). Should we have a `None` here?
Expand Down

0 comments on commit 831ef57

Please sign in to comment.