Fix previous commit (UI deleting optimisation)
This commit is contained in:
parent
0f61ed9f19
commit
ff92cc30c8
|
@ -2990,14 +2990,15 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
shifted = QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier
|
shifted = QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier
|
||||||
tableWidget.setUpdatesEnabled(False);
|
tableWidget.setUpdatesEnabled(False);
|
||||||
inventoryHashesToTrash = []
|
inventoryHashesToTrash = []
|
||||||
for row in tableWidget.selectedIndexes():
|
# ranges in reversed order
|
||||||
currentRow = row.row()
|
for r in sorted(tableWidget.selectedRanges(), key=lambda r: r.topRow())[::-1]:
|
||||||
|
for i in range(r.bottomRow()-r.topRow()+1):
|
||||||
inventoryHashToTrash = str(tableWidget.item(
|
inventoryHashToTrash = str(tableWidget.item(
|
||||||
currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
r.topRow()+i, 3).data(QtCore.Qt.UserRole).toPyObject())
|
||||||
if inventoryHashToTrash in inventoryHashesToTrash:
|
if inventoryHashToTrash in inventoryHashesToTrash:
|
||||||
continue
|
continue
|
||||||
inventoryHashesToTrash.append(inventoryHashToTrash)
|
inventoryHashesToTrash.append(inventoryHashToTrash)
|
||||||
tableWidget.removeRow(currentRow)
|
tableWidget.model().removeRows(r.topRow(), r.bottomRow()-r.topRow()+1)
|
||||||
idCount = len(inventoryHashesToTrash)
|
idCount = len(inventoryHashesToTrash)
|
||||||
if folder == "trash" or shifted:
|
if folder == "trash" or shifted:
|
||||||
sqlExecuteChunked('''DELETE FROM inbox WHERE msgid IN ({0})''',
|
sqlExecuteChunked('''DELETE FROM inbox WHERE msgid IN ({0})''',
|
||||||
|
@ -3019,14 +3020,15 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
currentRow = 0
|
currentRow = 0
|
||||||
tableWidget.setUpdatesEnabled(False)
|
tableWidget.setUpdatesEnabled(False)
|
||||||
inventoryHashesToTrash = []
|
inventoryHashesToTrash = []
|
||||||
for row in tableWidget.selectedIndexes():
|
# ranges in reversed order
|
||||||
currentRow = row.row()
|
for r in sorted(tableWidget.selectedRanges(), key=lambda r: r.topRow())[::-1]:
|
||||||
|
for i in range(r.bottomRow()-r.topRow()+1):
|
||||||
inventoryHashToTrash = str(tableWidget.item(
|
inventoryHashToTrash = str(tableWidget.item(
|
||||||
currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
r.topRow()+i, 3).data(QtCore.Qt.UserRole).toPyObject())
|
||||||
if inventoryHashToTrash in inventoryHashesToTrash:
|
if inventoryHashToTrash in inventoryHashesToTrash:
|
||||||
continue
|
continue
|
||||||
inventoryHashesToTrash.append(inventoryHashToTrash)
|
inventoryHashesToTrash.append(inventoryHashToTrash)
|
||||||
tableWidget.removeRow(currentRow)
|
tableWidget.model().removeRows(r.topRow(), r.bottomRow()-r.topRow()+1)
|
||||||
if currentRow == 0:
|
if currentRow == 0:
|
||||||
tableWidget.selectRow(currentRow)
|
tableWidget.selectRow(currentRow)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user