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]:
|
||||||
inventoryHashToTrash = str(tableWidget.item(
|
for i in range(r.bottomRow()-r.topRow()+1):
|
||||||
currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
inventoryHashToTrash = str(tableWidget.item(
|
||||||
if inventoryHashToTrash in inventoryHashesToTrash:
|
r.topRow()+i, 3).data(QtCore.Qt.UserRole).toPyObject())
|
||||||
continue
|
if inventoryHashToTrash in inventoryHashesToTrash:
|
||||||
inventoryHashesToTrash.append(inventoryHashToTrash)
|
continue
|
||||||
tableWidget.removeRow(currentRow)
|
inventoryHashesToTrash.append(inventoryHashToTrash)
|
||||||
|
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]:
|
||||||
inventoryHashToTrash = str(tableWidget.item(
|
for i in range(r.bottomRow()-r.topRow()+1):
|
||||||
currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
inventoryHashToTrash = str(tableWidget.item(
|
||||||
if inventoryHashToTrash in inventoryHashesToTrash:
|
r.topRow()+i, 3).data(QtCore.Qt.UserRole).toPyObject())
|
||||||
continue
|
if inventoryHashToTrash in inventoryHashesToTrash:
|
||||||
inventoryHashesToTrash.append(inventoryHashToTrash)
|
continue
|
||||||
tableWidget.removeRow(currentRow)
|
inventoryHashesToTrash.append(inventoryHashToTrash)
|
||||||
|
tableWidget.model().removeRows(r.topRow(), r.bottomRow()-r.topRow()+1)
|
||||||
if currentRow == 0:
|
if currentRow == 0:
|
||||||
tableWidget.selectRow(currentRow)
|
tableWidget.selectRow(currentRow)
|
||||||
else:
|
else:
|
||||||
|
|
Reference in New Issue
Block a user