mirror of
https://github.com/wassname/sloth.git
synced 2026-07-08 00:51:16 +08:00
Consistently use next() free function to get next element
This commit is contained in:
@@ -287,7 +287,7 @@ class LabelTool(QObject):
|
||||
|
||||
current = self._current_image
|
||||
if current is None:
|
||||
current = self._model.iterator(ImageModelItem).next()
|
||||
current = next(self._model.iterator(ImageModelItem))
|
||||
|
||||
next_image = current.getSibling(idx)
|
||||
if next_image is not None:
|
||||
@@ -298,7 +298,7 @@ class LabelTool(QObject):
|
||||
if self._current_image is not None:
|
||||
next_image = self._current_image.getNextSibling(step)
|
||||
else:
|
||||
next_image = self._model.iterator(ImageModelItem).next()
|
||||
next_image = next(self._model.iterator(ImageModelItem))
|
||||
if next_image is not None:
|
||||
next_image = next_image.getNextSibling(step-1)
|
||||
|
||||
|
||||
@@ -48,10 +48,7 @@ class BackgroundLoader(QObject):
|
||||
self._message_displayed = True
|
||||
if self._level <= self._max_levels and self._rows > 0:
|
||||
try:
|
||||
if hasattr(self._iterator, "next"):
|
||||
item = self._iterator.next()
|
||||
else:
|
||||
item = next(self._iterator)
|
||||
item = next(self._iterator)
|
||||
self._next_rows += item.rowCount()
|
||||
self._pos += 1
|
||||
self._progress.setValue(int((float(self._pos) / float(self._rows) + self._level - 1) * 1000))
|
||||
|
||||
@@ -179,11 +179,7 @@ class DefaultAttributeHandler(QGroupBox, AbstractAttributeHandler):
|
||||
self._inputField.setPlaceholderText(", ".join(selected_values))
|
||||
elif len(selected_values) == 1:
|
||||
it = iter(selected_values)
|
||||
if hasattr(it, 'next'):
|
||||
self._inputField.setText(it.next())
|
||||
else:
|
||||
self._inputField.setText(next(it))
|
||||
|
||||
self._inputField.setText(next(it))
|
||||
|
||||
def updateButtons(self):
|
||||
selected_values = self.getSelectedValues()
|
||||
|
||||
Reference in New Issue
Block a user