Refactored some table items to remove the universal unreadable variable 'new_item'

This commit is contained in:
neko259 2013-11-05 23:36:15 +02:00
parent fcea02f889
commit c0f9531665

View File

@ -723,31 +723,30 @@ class MyForm(QtGui.QMainWindow):
toLabel = toAddress toLabel = toAddress
self.ui.tableWidgetSent.insertRow(0) self.ui.tableWidgetSent.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8')) toAddressItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8'))
newItem.setToolTip(unicode(toLabel, 'utf-8')) toAddressItem.setToolTip(unicode(toLabel, 'utf-8'))
newItem.setIcon(avatarize(toAddress)) toAddressItem.setIcon(avatarize(toAddress))
newItem.setData(Qt.UserRole, str(toAddress)) toAddressItem.setData(Qt.UserRole, str(toAddress))
newItem.setFlags( toAddressItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 0, newItem) self.ui.tableWidgetSent.setItem(0, 0, toAddressItem)
if fromLabel == '': if fromLabel == '':
newItem = QtGui.QTableWidgetItem( fromLabel = fromAddress
unicode(fromAddress, 'utf-8')) fromAddressItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
newItem.setToolTip(unicode(fromAddress, 'utf-8')) fromAddressItem.setToolTip(unicode(fromLabel, 'utf-8'))
else: fromAddressItem.setIcon(avatarize(fromAddress))
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8')) fromAddressItem.setData(Qt.UserRole, str(fromAddress))
newItem.setToolTip(unicode(fromLabel, 'utf-8')) fromAddressItem.setFlags(
newItem.setIcon(avatarize(fromAddress))
newItem.setData(Qt.UserRole, str(fromAddress))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 1, newItem) self.ui.tableWidgetSent.setItem(0, 1, fromAddressItem)
newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8'))
newItem.setToolTip(unicode(subject, 'utf-8')) subjectItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8'))
#newItem.setData(Qt.UserRole, unicode(message, 'utf-8)')) # No longer hold the message in the table; we'll use a SQL query to display it as needed. subjectItem.setToolTip(unicode(subject, 'utf-8'))
newItem.setFlags( subjectItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 2, newItem) self.ui.tableWidgetSent.setItem(0, 2, subjectItem)
if status == 'awaitingpubkey': if status == 'awaitingpubkey':
statusText = _translate( statusText = _translate(
"MainWindow", "Waiting on their encryption key. Will request it again soon.") "MainWindow", "Waiting on their encryption key. Will request it again soon.")