(why mark unread so slow?)

This commit is contained in:
sendiulo 2013-09-07 19:04:20 +02:00
parent da65d8e62c
commit 3fd4ad0efe

View File

@ -2538,25 +2538,33 @@ class MyForm(QtGui.QMainWindow):
self.on_action_InboxMarkReadUnread(thisTableWidget, read) self.on_action_InboxMarkReadUnread(thisTableWidget, read)
def on_action_InboxMarkReadUnread(self, thisTableWidget, read): def on_action_InboxMarkReadUnread(self, thisTableWidget, read):
thisTableWidget = self.ui.tableWidgetInbox
font = QFont() font = QFont()
font.setBold(read==False) font.setBold(read==False)
for row in thisTableWidget.selectedIndexes(): for row in thisTableWidget.selectedIndexes():
currentRow = row.row() currentRow = row.row()
inventoryHashToMarkUnread = str(thisTableWidget.item( inventoryHashToMarkUnread = str(thisTableWidget.item(
currentRow, 3).data(Qt.UserRole).toPyObject()) currentRow, 3).data(Qt.UserRole).toPyObject())
t = (inventoryHashToMarkUnread,) sqlExecute('''UPDATE inbox SET read=0 WHERE msgid=?''', inventoryHashToMarkUnread)
shared.sqlLock.acquire() self.ui.tableWidgetInbox.item(currentRow, 0).setFont(font)
shared.sqlSubmitQueue.put( self.ui.tableWidgetInbox.item(currentRow, 1).setFont(font)
'''UPDATE inbox SET read='''+ str(int(read)) +''' WthisTableWidget msgid=?''') self.ui.tableWidgetInbox.item(currentRow, 2).setFont(font)
shared.sqlSubmitQueue.put(t) self.ui.tableWidgetInbox.item(currentRow, 3).setFont(font)
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit') # currentRow = row.row()
shared.sqlLock.release() # inventoryHashToMarkUnread = str(thisTableWidget.item(
thisTableWidget.item(currentRow, 0).setFont(font) # currentRow, 3).data(Qt.UserRole).toPyObject())
thisTableWidget.item(currentRow, 1).setFont(font) # t = (inventoryHashToMarkUnread,)
thisTableWidget.item(currentRow, 2).setFont(font) # shared.sqlLock.acquire()
thisTableWidget.item(currentRow, 3).setFont(font) # shared.sqlSubmitQueue.put(
# '''UPDATE inbox SET read='''+ str(int(read)) +''' WHERE msgid=?''')
# shared.sqlSubmitQueue.put(t)
# shared.sqlReturnQueue.get()
# thisTableWidget.item(currentRow, 0).setFont(font)
# thisTableWidget.item(currentRow, 1).setFont(font)
# thisTableWidget.item(currentRow, 2).setFont(font)
# thisTableWidget.item(currentRow, 3).setFont(font)
# shared.sqlSubmitQueue.put('commit')
# shared.sqlLock.release()
# thisTableWidget.selectRow(currentRow + 1) # thisTableWidget.selectRow(currentRow + 1)
# This doesn't de-select the last message if you try to mark it unread, but that doesn't interfere. Might not be necessary. # This doesn't de-select the last message if you try to mark it unread, but that doesn't interfere. Might not be necessary.
# We could also select upwards, but then our problem would be with the topmost message. # We could also select upwards, but then our problem would be with the topmost message.