Updated code quality long lines break, white spaces & binary operator code changes in bitmessageqt/__init__.py
This commit is contained in:
parent
6dffb1e470
commit
99b716781f
|
@ -477,7 +477,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
for toAddress in db:
|
for toAddress in db:
|
||||||
widget = Ui_SubscriptionWidget(treeWidget, i, toAddress, db[toAddress]["inbox"]['count'], db[toAddress]["inbox"]['label'], db[toAddress]["inbox"]['enabled'])
|
widget = Ui_SubscriptionWidget(treeWidget, i, toAddress, db[toAddress]["inbox"]['count'],
|
||||||
|
db[toAddress]["inbox"]['label'], db[toAddress]["inbox"]['enabled'])
|
||||||
j = 0
|
j = 0
|
||||||
unread = 0
|
unread = 0
|
||||||
for folder in folders:
|
for folder in folders:
|
||||||
|
@ -536,7 +537,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
# get number of (unread) messages
|
# get number of (unread) messages
|
||||||
total = 0
|
total = 0
|
||||||
queryreturn = sqlQuery('SELECT toaddress, folder, count(msgid) as cnt FROM inbox WHERE read = 0 GROUP BY toaddress, folder')
|
queryreturn = sqlQuery('SELECT toaddress, folder, count(msgid) as cnt FROM inbox'
|
||||||
|
' WHERE read = 0 GROUP BY toaddress, folder')
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
toaddress, folder, cnt = row
|
toaddress, folder, cnt = row
|
||||||
total += cnt
|
total += cnt
|
||||||
|
@ -632,8 +634,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
addressInKeysFile)
|
addressInKeysFile)
|
||||||
if addressVersionNumber == 1:
|
if addressVersionNumber == 1:
|
||||||
displayMsg = _translate(
|
displayMsg = _translate(
|
||||||
"MainWindow", "One of your addresses, %1, is an old version 1 address. Version 1 addresses are no longer supported. "
|
"MainWindow",
|
||||||
+ "May we delete it now?").arg(addressInKeysFile)
|
"One of your addresses, %1, is an old version 1 address. Version 1 addresses are"
|
||||||
|
" no longer supported. May we delete it now?"
|
||||||
|
).arg(addressInKeysFile)
|
||||||
reply = QtGui.QMessageBox.question(
|
reply = QtGui.QMessageBox.question(
|
||||||
self, 'Message', displayMsg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
self, 'Message', displayMsg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
||||||
if reply == QtGui.QMessageBox.Yes:
|
if reply == QtGui.QMessageBox.Yes:
|
||||||
|
@ -743,13 +747,13 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.unreadCount = 0
|
self.unreadCount = 0
|
||||||
|
|
||||||
# Set the icon sizes for the identicons
|
# Set the icon sizes for the identicons
|
||||||
identicon_size = 3*7
|
identicon_size = 3 * 7
|
||||||
self.ui.tableWidgetInbox.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.ui.tableWidgetInbox.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
||||||
self.ui.treeWidgetChans.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.ui.treeWidgetChans.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
||||||
self.ui.treeWidgetYourIdentities.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.ui.treeWidgetYourIdentities.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
||||||
self.ui.treeWidgetSubscriptions.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.ui.treeWidgetSubscriptions.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
||||||
self.ui.tableWidgetAddressBook.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.ui.tableWidgetAddressBook.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
||||||
|
|
||||||
self.UISignalThread = UISignaler.get()
|
self.UISignalThread = UISignaler.get()
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
"writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.writeNewAddressToTable)
|
"writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.writeNewAddressToTable)
|
||||||
|
@ -760,9 +764,12 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
"updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByAckdata)
|
"updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByAckdata)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
"displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewInboxMessage)
|
"displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"
|
||||||
|
), self.displayNewInboxMessage)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
"displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewSentMessage)
|
"displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,"
|
||||||
|
"PyQt_PyObject)"
|
||||||
|
), self.displayNewSentMessage)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
"setStatusIcon(PyQt_PyObject)"), self.setStatusIcon)
|
"setStatusIcon(PyQt_PyObject)"), self.setStatusIcon)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
|
@ -809,13 +816,13 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
# Put the TTL slider in the correct spot
|
# Put the TTL slider in the correct spot
|
||||||
TTL = BMConfigParser().getint('bitmessagesettings', 'ttl')
|
TTL = BMConfigParser().getint('bitmessagesettings', 'ttl')
|
||||||
if TTL < 3600: # an hour
|
if TTL < 3600: # an hour
|
||||||
TTL = 3600
|
TTL = 3600
|
||||||
elif TTL > 28*24*60*60: # 28 days
|
elif TTL > 28 * 24 * 60 * 60: # 28 days
|
||||||
TTL = 28*24*60*60
|
TTL = 28 * 24 * 60 * 60
|
||||||
self.ui.horizontalSliderTTL.setSliderPosition((TTL - 3600) ** (1/3.199))
|
self.ui.horizontalSliderTTL.setSliderPosition((TTL - 3600) ** (1 / 3.199))
|
||||||
self.updateHumanFriendlyTTLDescription(TTL)
|
self.updateHumanFriendlyTTLDescription(TTL)
|
||||||
|
|
||||||
QtCore.QObject.connect(self.ui.horizontalSliderTTL, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.ui.horizontalSliderTTL, QtCore.SIGNAL(
|
||||||
"valueChanged(int)"), self.updateTTL)
|
"valueChanged(int)"), self.updateTTL)
|
||||||
|
|
||||||
|
@ -873,21 +880,23 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
BMConfigParser().save()
|
BMConfigParser().save()
|
||||||
|
|
||||||
def updateHumanFriendlyTTLDescription(self, TTL):
|
def updateHumanFriendlyTTLDescription(self, TTL):
|
||||||
numberOfHours = int(round(TTL / (60*60)))
|
numberOfHours = int(round(TTL / (60 * 60)))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
stylesheet = ""
|
stylesheet = ""
|
||||||
|
|
||||||
if numberOfHours < 48:
|
if numberOfHours < 48:
|
||||||
self.ui.labelHumanFriendlyTTLDescription.setText(
|
self.ui.labelHumanFriendlyTTLDescription.setText(
|
||||||
_translate("MainWindow", "%n hour(s)", None, QtCore.QCoreApplication.CodecForTr, numberOfHours) +
|
_translate("MainWindow", "%n hour(s)", None, QtCore.QCoreApplication.CodecForTr, numberOfHours)
|
||||||
", " +
|
+ ", "
|
||||||
_translate("MainWindow", "not recommended for chans", None, QtCore.QCoreApplication.CodecForTr)
|
+ _translate("MainWindow", "not recommended for chans", None, QtCore.QCoreApplication.CodecForTr)
|
||||||
)
|
)
|
||||||
stylesheet = "QLabel { color : red; }"
|
stylesheet = "QLabel { color : red; }"
|
||||||
font.setBold(True)
|
font.setBold(True)
|
||||||
else:
|
else:
|
||||||
numberOfDays = int(round(TTL / (24*60*60)))
|
numberOfDays = int(round(TTL / (24 * 60 * 60)))
|
||||||
self.ui.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "%n day(s)", None, QtCore.QCoreApplication.CodecForTr, numberOfDays))
|
self.ui.labelHumanFriendlyTTLDescription.setText(
|
||||||
|
_translate("MainWindow", "%n day(s)", None, QtCore.QCoreApplication.CodecForTr, numberOfDays)
|
||||||
|
)
|
||||||
font.setBold(False)
|
font.setBold(False)
|
||||||
self.ui.labelHumanFriendlyTTLDescription.setStyleSheet(stylesheet)
|
self.ui.labelHumanFriendlyTTLDescription.setStyleSheet(stylesheet)
|
||||||
self.ui.labelHumanFriendlyTTLDescription.setFont(font)
|
self.ui.labelHumanFriendlyTTLDescription.setFont(font)
|
||||||
|
@ -1558,35 +1567,53 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# the same directory as this program. It is important that you
|
# the same directory as this program. It is important that you
|
||||||
# back up this file.', QMessageBox.Ok)
|
# back up this file.', QMessageBox.Ok)
|
||||||
reply = QtGui.QMessageBox.information(self, 'keys.dat?', _translate(
|
reply = QtGui.QMessageBox.information(self, 'keys.dat?', _translate(
|
||||||
"MainWindow", "You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file."), QtGui.QMessageBox.Ok)
|
"MainWindow",
|
||||||
|
"You may manage your keys by editing the keys.dat file stored in the same directory"
|
||||||
|
" as this program. It is important that you back up this file."), QtGui.QMessageBox.Ok)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.information(self, 'keys.dat?', _translate(
|
QtGui.QMessageBox.information(self, 'keys.dat?', _translate(
|
||||||
"MainWindow", "You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important that you back up this file.").arg(state.appdata), QtGui.QMessageBox.Ok)
|
"MainWindow",
|
||||||
|
"You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important"
|
||||||
|
" that you back up this file.").arg(state.appdata), QtGui.QMessageBox.Ok)
|
||||||
elif sys.platform == 'win32' or sys.platform == 'win64':
|
elif sys.platform == 'win32' or sys.platform == 'win64':
|
||||||
if state.appdata == '':
|
if state.appdata == '':
|
||||||
reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Open keys.dat?"), _translate(
|
reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Open keys.dat?"), _translate(
|
||||||
"MainWindow", "You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
"MainWindow",
|
||||||
|
"You may manage your keys by editing the keys.dat file stored in the same directory as"
|
||||||
|
" this program. It is important that you back up this file. Would you like to open the"
|
||||||
|
" file now? (Be sure to close Bitmessage before making any changes.)"),
|
||||||
|
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
||||||
else:
|
else:
|
||||||
reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Open keys.dat?"), _translate(
|
reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Open keys.dat?"), _translate(
|
||||||
"MainWindow", "You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)").arg(state.appdata), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
"MainWindow",
|
||||||
|
"You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important"
|
||||||
|
" that you back up this file. Would you like to open the file now? (Be sure to close"
|
||||||
|
" Bitmessage before making any changes.)").arg(state.appdata),
|
||||||
|
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
||||||
if reply == QtGui.QMessageBox.Yes:
|
if reply == QtGui.QMessageBox.Yes:
|
||||||
openKeysFile()
|
openKeysFile()
|
||||||
|
|
||||||
# menu button 'delete all treshed messages'
|
# menu button 'delete all treshed messages'
|
||||||
def click_actionDeleteAllTrashedMessages(self):
|
def click_actionDeleteAllTrashedMessages(self):
|
||||||
if QtGui.QMessageBox.question(self, _translate("MainWindow", "Delete trash?"), _translate("MainWindow", "Are you sure you want to delete all trashed messages?"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
|
if QtGui.QMessageBox.question(self, _translate("MainWindow", "Delete trash?"), _translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Are you sure you want to delete all trashed messages?"),
|
||||||
|
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
|
||||||
return
|
return
|
||||||
sqlStoredProcedure('deleteandvacuume')
|
sqlStoredProcedure('deleteandvacuume')
|
||||||
self.rerenderTabTreeMessages()
|
self.rerenderTabTreeMessages()
|
||||||
self.rerenderTabTreeSubscriptions()
|
self.rerenderTabTreeSubscriptions()
|
||||||
self.rerenderTabTreeChans()
|
self.rerenderTabTreeChans()
|
||||||
if self.getCurrentFolder(self.ui.treeWidgetYourIdentities) == "trash":
|
if self.getCurrentFolder(self.ui.treeWidgetYourIdentities) == "trash":
|
||||||
self.loadMessagelist(self.ui.tableWidgetInbox, self.getCurrentAccount(self.ui.treeWidgetYourIdentities), "trash")
|
self.loadMessagelist(self.ui.tableWidgetInbox,
|
||||||
|
self.getCurrentAccount(self.ui.treeWidgetYourIdentities), "trash")
|
||||||
elif self.getCurrentFolder(self.ui.treeWidgetSubscriptions) == "trash":
|
elif self.getCurrentFolder(self.ui.treeWidgetSubscriptions) == "trash":
|
||||||
self.loadMessagelist(self.ui.tableWidgetInboxSubscriptions, self.getCurrentAccount(self.ui.treeWidgetSubscriptions), "trash")
|
self.loadMessagelist(self.ui.tableWidgetInboxSubscriptions,
|
||||||
|
self.getCurrentAccount(self.ui.treeWidgetSubscriptions), "trash")
|
||||||
elif self.getCurrentFolder(self.ui.treeWidgetChans) == "trash":
|
elif self.getCurrentFolder(self.ui.treeWidgetChans) == "trash":
|
||||||
self.loadMessagelist(self.ui.tableWidgetInboxChans, self.getCurrentAccount(self.ui.treeWidgetChans), "trash")
|
self.loadMessagelist(self.ui.tableWidgetInboxChans,
|
||||||
|
self.getCurrentAccount(self.ui.treeWidgetChans), "trash")
|
||||||
|
|
||||||
# menu button 'regenerate deterministic addresses'
|
# menu button 'regenerate deterministic addresses'
|
||||||
def click_actionRegenerateDeterministicAddresses(self):
|
def click_actionRegenerateDeterministicAddresses(self):
|
||||||
|
@ -1672,7 +1699,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.blackwhitelist.init_blacklist_popup_menu(False)
|
self.ui.blackwhitelist.init_blacklist_popup_menu(False)
|
||||||
if event.type() == QtCore.QEvent.WindowStateChange:
|
if event.type() == QtCore.QEvent.WindowStateChange:
|
||||||
if self.windowState() & QtCore.Qt.WindowMinimized:
|
if self.windowState() & QtCore.Qt.WindowMinimized:
|
||||||
if BMConfigParser().getboolean('bitmessagesettings', 'minimizetotray') and not 'darwin' in sys.platform:
|
if BMConfigParser().getboolean('bitmessagesettings',
|
||||||
|
'minimizetotray') and 'darwin' not in sys.platform:
|
||||||
QtCore.QTimer.singleShot(0, self.appIndicatorHide)
|
QtCore.QTimer.singleShot(0, self.appIndicatorHide)
|
||||||
elif event.oldState() & QtCore.Qt.WindowMinimized:
|
elif event.oldState() & QtCore.Qt.WindowMinimized:
|
||||||
# The window state has just been changed to
|
# The window state has just been changed to
|
||||||
|
@ -1702,7 +1730,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
_translate("MainWindow", "Connection lost"),
|
_translate("MainWindow", "Connection lost"),
|
||||||
sound.SOUND_DISCONNECTED)
|
sound.SOUND_DISCONNECTED)
|
||||||
if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'upnp') and \
|
if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'upnp') and \
|
||||||
BMConfigParser().get('bitmessagesettings', 'socksproxytype') == "none":
|
BMConfigParser().get('bitmessagesettings', 'socksproxytype') == "none":
|
||||||
self.updateStatusBar(
|
self.updateStatusBar(
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -1715,8 +1743,11 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.actionStatus.setText(_translate(
|
self.actionStatus.setText(_translate(
|
||||||
"MainWindow", "Not Connected"))
|
"MainWindow", "Not Connected"))
|
||||||
self.setTrayIconFile("can-icon-24px-red.png")
|
self.setTrayIconFile("can-icon-24px-red.png")
|
||||||
|
|
||||||
|
expected_msg = 'Warning: You are currently not connected. Bitmessage will do'\
|
||||||
|
' the work necessary to send the message but it won\'t send until you connect.'
|
||||||
if color == 'yellow':
|
if color == 'yellow':
|
||||||
if self.statusbar.currentMessage() == 'Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.':
|
if self.statusbar.currentMessage() == expected_msg:
|
||||||
self.statusbar.clearMessage()
|
self.statusbar.clearMessage()
|
||||||
self.pushButtonStatusIcon.setIcon(
|
self.pushButtonStatusIcon.setIcon(
|
||||||
QtGui.QIcon(":/newPrefix/images/yellowicon.png"))
|
QtGui.QIcon(":/newPrefix/images/yellowicon.png"))
|
||||||
|
@ -1734,7 +1765,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
"MainWindow", "Connected"))
|
"MainWindow", "Connected"))
|
||||||
self.setTrayIconFile("can-icon-24px-yellow.png")
|
self.setTrayIconFile("can-icon-24px-yellow.png")
|
||||||
if color == 'green':
|
if color == 'green':
|
||||||
if self.statusbar.currentMessage() == 'Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.':
|
if self.statusbar.currentMessage() == expected_msg:
|
||||||
self.statusbar.clearMessage()
|
self.statusbar.clearMessage()
|
||||||
self.pushButtonStatusIcon.setIcon(
|
self.pushButtonStatusIcon.setIcon(
|
||||||
QtGui.QIcon(":/newPrefix/images/greenicon.png"))
|
QtGui.QIcon(":/newPrefix/images/greenicon.png"))
|
||||||
|
@ -1788,7 +1819,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
painter.setPen(
|
painter.setPen(
|
||||||
QtGui.QPen(QtGui.QColor(255, 0, 0), QtCore.Qt.SolidPattern))
|
QtGui.QPen(QtGui.QColor(255, 0, 0), QtCore.Qt.SolidPattern))
|
||||||
painter.setFont(font)
|
painter.setFont(font)
|
||||||
painter.drawText(24-rect.right()-marginX, -rect.top()+marginY, txt)
|
painter.drawText(24 - rect.right() - marginX, - rect.top() + marginY, txt)
|
||||||
painter.end()
|
painter.end()
|
||||||
return QtGui.QIcon(pixmap)
|
return QtGui.QIcon(pixmap)
|
||||||
|
|
||||||
|
@ -1833,8 +1864,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if toAddress == rowAddress:
|
if toAddress == rowAddress:
|
||||||
sent.item(i, 3).setToolTip(textToDisplay)
|
sent.item(i, 3).setToolTip(textToDisplay)
|
||||||
try:
|
try:
|
||||||
|
# If someone misses adding a "_translate" to a string before passing it to this function,
|
||||||
|
# this function won't receive a qstring which will cause an exception.
|
||||||
newlinePosition = textToDisplay.indexOf('\n')
|
newlinePosition = textToDisplay.indexOf('\n')
|
||||||
except: # If someone misses adding a "_translate" to a string before passing it to this function, this function won't receive a qstring which will cause an exception.
|
except:
|
||||||
newlinePosition = 0
|
newlinePosition = 0
|
||||||
if newlinePosition > 1:
|
if newlinePosition > 1:
|
||||||
sent.item(i, 3).setText(
|
sent.item(i, 3).setText(
|
||||||
|
@ -1861,8 +1894,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if ackdata == tableAckdata:
|
if ackdata == tableAckdata:
|
||||||
sent.item(i, 3).setToolTip(textToDisplay)
|
sent.item(i, 3).setToolTip(textToDisplay)
|
||||||
try:
|
try:
|
||||||
|
# If someone misses adding a "_translate" to a string before passing it to this function,
|
||||||
|
# this function won't receive a qstring which will cause an exception.
|
||||||
newlinePosition = textToDisplay.indexOf('\n')
|
newlinePosition = textToDisplay.indexOf('\n')
|
||||||
except: # If someone misses adding a "_translate" to a string before passing it to this function, this function won't receive a qstring which will cause an exception.
|
except:
|
||||||
newlinePosition = 0
|
newlinePosition = 0
|
||||||
if newlinePosition > 1:
|
if newlinePosition > 1:
|
||||||
sent.item(i, 3).setText(
|
sent.item(i, 3).setText(
|
||||||
|
@ -1897,8 +1932,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"New version of PyBitmessage is available: %1. Download it"
|
"New version of PyBitmessage is available: %1. Download it"
|
||||||
" from https://github.com/Bitmessage/PyBitmessage/releases/latest"
|
" from https://github.com/Bitmessage/PyBitmessage/releases/latest").arg(self.notifiedNewVersion)
|
||||||
).arg(self.notifiedNewVersion)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def displayAlert(self, title, text, exitAfterUserClicksOk):
|
def displayAlert(self, title, text, exitAfterUserClicksOk):
|
||||||
|
@ -1908,17 +1942,19 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
def rerenderMessagelistFromLabels(self):
|
def rerenderMessagelistFromLabels(self):
|
||||||
for messagelist in (self.ui.tableWidgetInbox, self.ui.tableWidgetInboxChans, self.ui.tableWidgetInboxSubscriptions):
|
for messagelist in (self.ui.tableWidgetInbox,
|
||||||
|
self.ui.tableWidgetInboxChans, self.ui.tableWidgetInboxSubscriptions):
|
||||||
for i in range(messagelist.rowCount()):
|
for i in range(messagelist.rowCount()):
|
||||||
messagelist.item(i, 1).setLabel()
|
messagelist.item(i, 1).setLabel()
|
||||||
|
|
||||||
def rerenderMessagelistToLabels(self):
|
def rerenderMessagelistToLabels(self):
|
||||||
for messagelist in (self.ui.tableWidgetInbox, self.ui.tableWidgetInboxChans, self.ui.tableWidgetInboxSubscriptions):
|
for messagelist in (self.ui.tableWidgetInbox,
|
||||||
|
self.ui.tableWidgetInboxChans, self.ui.tableWidgetInboxSubscriptions):
|
||||||
for i in range(messagelist.rowCount()):
|
for i in range(messagelist.rowCount()):
|
||||||
messagelist.item(i, 0).setLabel()
|
messagelist.item(i, 0).setLabel()
|
||||||
|
|
||||||
def rerenderAddressBook(self):
|
def rerenderAddressBook(self):
|
||||||
def addRow (address, label, type):
|
def addRow(address, label, type):
|
||||||
self.ui.tableWidgetAddressBook.insertRow(0)
|
self.ui.tableWidgetAddressBook.insertRow(0)
|
||||||
newItem = Ui_AddressBookWidgetItemLabel(address, unicode(label, 'utf-8'), type)
|
newItem = Ui_AddressBookWidgetItemLabel(address, unicode(label, 'utf-8'), type)
|
||||||
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
|
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
|
||||||
|
@ -1978,9 +2014,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
def click_pushButtonTTL(self):
|
def click_pushButtonTTL(self):
|
||||||
QtGui.QMessageBox.information(self, 'Time To Live', _translate(
|
QtGui.QMessageBox.information(self, 'Time To Live', _translate(
|
||||||
"MainWindow", """The TTL, or Time-To-Live is the length of time that the network will hold the message.
|
"MainWindow", """The TTL, or Time-To-Live is the length of time that the network will hold the message.
|
||||||
The recipient must get it during this time. If your Bitmessage client does not hear an acknowledgement, it
|
The recipient must get it during this time. If your Bitmessage client does not hear an acknowledgement, it
|
||||||
will resend the message automatically. The longer the Time-To-Live, the
|
will resend the message automatically. The longer the Time-To-Live, the more work your computer
|
||||||
more work your computer must do to send the message. A Time-To-Live of four or five days is often appropriate."""), QtGui.QMessageBox.Ok)
|
must do to send the message. A Time-To-Live of four or five days is often appropriate."""),
|
||||||
|
QtGui.QMessageBox.Ok)
|
||||||
|
|
||||||
def click_pushButtonClear(self):
|
def click_pushButtonClear(self):
|
||||||
self.ui.lineEditSubject.setText("")
|
self.ui.lineEditSubject.setText("")
|
||||||
|
@ -2053,14 +2090,17 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
subject = acct.subject
|
subject = acct.subject
|
||||||
toAddress = acct.toAddress
|
toAddress = acct.toAddress
|
||||||
else:
|
else:
|
||||||
if QtGui.QMessageBox.question(self, "Sending an email?", _translate("MainWindow",
|
if QtGui.QMessageBox.question(self, "Sending an email?", _translate(
|
||||||
"You are trying to send an email instead of a bitmessage. This requires registering with a gateway. Attempt to register?"),
|
"MainWindow",
|
||||||
QtGui.QMessageBox.Yes|QtGui.QMessageBox.No) != QtGui.QMessageBox.Yes:
|
"You are trying to send an email instead of a bitmessage. This requires"
|
||||||
|
" registering with a gateway. Attempt to register?"),
|
||||||
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) != QtGui.QMessageBox.Yes:
|
||||||
continue
|
continue
|
||||||
email = acct.getLabel()
|
email = acct.getLabel()
|
||||||
if email[-14:] != "@mailchuck.com": #attempt register
|
if email[-14:] != "@mailchuck.com": # attempt register
|
||||||
# 12 character random email address
|
# 12 character random email address
|
||||||
email = ''.join(random.SystemRandom().choice(string.ascii_lowercase) for _ in range(12)) + "@mailchuck.com"
|
email = ''.join(random.SystemRandom().choice(string.ascii_lowercase)
|
||||||
|
for _ in range(12)) + "@mailchuck.com"
|
||||||
acct = MailchuckAccount(fromAddress)
|
acct = MailchuckAccount(fromAddress)
|
||||||
acct.register(email)
|
acct.register(email)
|
||||||
BMConfigParser().set(fromAddress, 'label', email)
|
BMConfigParser().set(fromAddress, 'label', email)
|
||||||
|
@ -2072,8 +2112,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
" an email gateway. Sending registration"
|
" an email gateway. Sending registration"
|
||||||
" now as %1, please wait for the registration"
|
" now as %1, please wait for the registration"
|
||||||
" to be processed before retrying sending."
|
" to be processed before retrying sending."
|
||||||
).arg(email)
|
).arg(email))
|
||||||
)
|
|
||||||
return
|
return
|
||||||
status, addressVersionNumber, streamNumber = decodeAddress(toAddress)[:3]
|
status, addressVersionNumber, streamNumber = decodeAddress(toAddress)[:3]
|
||||||
if status != 'success':
|
if status != 'success':
|
||||||
|
@ -2087,58 +2126,50 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Bitmessage addresses start with"
|
"Error: Bitmessage addresses start with"
|
||||||
" BM- Please check the recipient address %1"
|
" BM- Please check the recipient address %1").arg(toAddress))
|
||||||
).arg(toAddress))
|
|
||||||
elif status == 'checksumfailed':
|
elif status == 'checksumfailed':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: The recipient address %1 is not"
|
"Error: The recipient address %1 is not"
|
||||||
" typed or copied correctly. Please check it."
|
" typed or copied correctly. Please check it.").arg(toAddress))
|
||||||
).arg(toAddress))
|
|
||||||
elif status == 'invalidcharacters':
|
elif status == 'invalidcharacters':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: The recipient address %1 contains"
|
"Error: The recipient address %1 contains"
|
||||||
" invalid characters. Please check it."
|
" invalid characters. Please check it.").arg(toAddress))
|
||||||
).arg(toAddress))
|
|
||||||
elif status == 'versiontoohigh':
|
elif status == 'versiontoohigh':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: The version of the recipient address"
|
"Error: The version of the recipient address"
|
||||||
" %1 is too high. Either you need to upgrade"
|
" %1 is too high. Either you need to upgrade"
|
||||||
" your Bitmessage software or your"
|
" your Bitmessage software or your"
|
||||||
" acquaintance is being clever."
|
" acquaintance is being clever.").arg(toAddress))
|
||||||
).arg(toAddress))
|
|
||||||
elif status == 'ripetooshort':
|
elif status == 'ripetooshort':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Some data encoded in the recipient"
|
"Error: Some data encoded in the recipient"
|
||||||
" address %1 is too short. There might be"
|
" address %1 is too short. There might be"
|
||||||
" something wrong with the software of"
|
" something wrong with the software of"
|
||||||
" your acquaintance."
|
" your acquaintance.").arg(toAddress))
|
||||||
).arg(toAddress))
|
|
||||||
elif status == 'ripetoolong':
|
elif status == 'ripetoolong':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Some data encoded in the recipient"
|
"Error: Some data encoded in the recipient"
|
||||||
" address %1 is too long. There might be"
|
" address %1 is too long. There might be"
|
||||||
" something wrong with the software of"
|
" something wrong with the software of"
|
||||||
" your acquaintance."
|
" your acquaintance.").arg(toAddress))
|
||||||
).arg(toAddress))
|
|
||||||
elif status == 'varintmalformed':
|
elif status == 'varintmalformed':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Some data encoded in the recipient"
|
"Error: Some data encoded in the recipient"
|
||||||
" address %1 is malformed. There might be"
|
" address %1 is malformed. There might be"
|
||||||
" something wrong with the software of"
|
" something wrong with the software of"
|
||||||
" your acquaintance."
|
" your acquaintance.").arg(toAddress))
|
||||||
).arg(toAddress))
|
|
||||||
else:
|
else:
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Something is wrong with the"
|
"Error: Something is wrong with the"
|
||||||
" recipient address %1."
|
" recipient address %1.").arg(toAddress))
|
||||||
).arg(toAddress))
|
|
||||||
elif fromAddress == '':
|
elif fromAddress == '':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -2150,12 +2181,21 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
toAddress = addBMIfNotPresent(toAddress)
|
toAddress = addBMIfNotPresent(toAddress)
|
||||||
|
|
||||||
if addressVersionNumber > 4 or addressVersionNumber <= 1:
|
if addressVersionNumber > 4 or addressVersionNumber <= 1:
|
||||||
QtGui.QMessageBox.about(self, _translate("MainWindow", "Address version number"), _translate(
|
QtGui.QMessageBox.about(self, _translate(
|
||||||
"MainWindow", "Concerning the address %1, Bitmessage cannot understand address version numbers of %2. Perhaps upgrade Bitmessage to the latest version.").arg(toAddress).arg(str(addressVersionNumber)))
|
"MainWindow",
|
||||||
|
"Address version number"
|
||||||
|
), _translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Concerning the address %1, Bitmessage cannot understand address"
|
||||||
|
" version numbers of %2. Perhaps upgrade Bitmessage to the latest version."
|
||||||
|
).arg(toAddress).arg(str(addressVersionNumber)))
|
||||||
continue
|
continue
|
||||||
if streamNumber > 1 or streamNumber == 0:
|
if streamNumber > 1 or streamNumber == 0:
|
||||||
QtGui.QMessageBox.about(self, _translate("MainWindow", "Stream number"), _translate(
|
QtGui.QMessageBox.about(self, _translate("MainWindow", "Stream number"), _translate(
|
||||||
"MainWindow", "Concerning the address %1, Bitmessage cannot handle stream numbers of %2. Perhaps upgrade Bitmessage to the latest version.").arg(toAddress).arg(str(streamNumber)))
|
"MainWindow",
|
||||||
|
"Concerning the address %1, Bitmessage cannot handle stream numbers of %2."
|
||||||
|
" Perhaps upgrade Bitmessage to the latest version."
|
||||||
|
).arg(toAddress).arg(str(streamNumber)))
|
||||||
continue
|
continue
|
||||||
self.statusbar.clearMessage()
|
self.statusbar.clearMessage()
|
||||||
if state.statusIconColor == 'red':
|
if state.statusIconColor == 'red':
|
||||||
|
@ -2264,8 +2304,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
def rerenderComboBoxSendFrom(self):
|
def rerenderComboBoxSendFrom(self):
|
||||||
self.ui.comboBoxSendFrom.clear()
|
self.ui.comboBoxSendFrom.clear()
|
||||||
for addressInKeysFile in getSortedAccounts():
|
for addressInKeysFile in getSortedAccounts():
|
||||||
|
# I realize that this is poor programming practice but I don't care. It's easier for others to read.
|
||||||
isEnabled = BMConfigParser().getboolean(
|
isEnabled = BMConfigParser().getboolean(
|
||||||
addressInKeysFile, 'enabled') # I realize that this is poor programming practice but I don't care. It's easier for others to read.
|
addressInKeysFile, 'enabled')
|
||||||
isMaillinglist = BMConfigParser().safeGetBoolean(addressInKeysFile, 'mailinglist')
|
isMaillinglist = BMConfigParser().safeGetBoolean(addressInKeysFile, 'mailinglist')
|
||||||
if isEnabled and not isMaillinglist:
|
if isEnabled and not isMaillinglist:
|
||||||
label = unicode(BMConfigParser().get(addressInKeysFile, 'label'), 'utf-8', 'ignore').strip()
|
label = unicode(BMConfigParser().get(addressInKeysFile, 'label'), 'utf-8', 'ignore').strip()
|
||||||
|
@ -2288,8 +2329,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
def rerenderComboBoxSendFromBroadcast(self):
|
def rerenderComboBoxSendFromBroadcast(self):
|
||||||
self.ui.comboBoxSendFromBroadcast.clear()
|
self.ui.comboBoxSendFromBroadcast.clear()
|
||||||
for addressInKeysFile in getSortedAccounts():
|
for addressInKeysFile in getSortedAccounts():
|
||||||
|
# I realize that this is poor programming practice but I don't care. It's easier for others to read.
|
||||||
isEnabled = BMConfigParser().getboolean(
|
isEnabled = BMConfigParser().getboolean(
|
||||||
addressInKeysFile, 'enabled') # I realize that this is poor programming practice but I don't care. It's easier for others to read.
|
addressInKeysFile, 'enabled')
|
||||||
isChan = BMConfigParser().safeGetBoolean(addressInKeysFile, 'chan')
|
isChan = BMConfigParser().safeGetBoolean(addressInKeysFile, 'chan')
|
||||||
if isEnabled and not isChan:
|
if isEnabled and not isChan:
|
||||||
label = unicode(BMConfigParser().get(addressInKeysFile, 'label'), 'utf-8', 'ignore').strip()
|
label = unicode(BMConfigParser().get(addressInKeysFile, 'label'), 'utf-8', 'ignore').strip()
|
||||||
|
@ -2633,13 +2675,13 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"%n object(s) pending proof of work", None,
|
"%n object(s) pending proof of work", None,
|
||||||
QtCore.QCoreApplication.CodecForTr, powQueueSize()
|
QtCore.QCoreApplication.CodecForTr, powQueueSize()
|
||||||
) + ", " +
|
) + ", "
|
||||||
_translate(
|
+ _translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"%n object(s) waiting to be distributed", None,
|
"%n object(s) waiting to be distributed", None,
|
||||||
QtCore.QCoreApplication.CodecForTr, pendingUpload()
|
QtCore.QCoreApplication.CodecForTr, pendingUpload()
|
||||||
) + "\n\n" +
|
) + "\n\n"
|
||||||
_translate(
|
+ _translate(
|
||||||
"MainWindow", "Wait until these tasks finish?"),
|
"MainWindow", "Wait until these tasks finish?"),
|
||||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
|
||||||
| QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel)
|
| QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel)
|
||||||
|
@ -2722,8 +2764,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if curWorkerQueue > 0:
|
if curWorkerQueue > 0:
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow", "Waiting for PoW to finish... %1%"
|
"MainWindow", "Waiting for PoW to finish... %1%"
|
||||||
).arg(50 * (maxWorkerQueue - curWorkerQueue) /
|
).arg(50 * (maxWorkerQueue - curWorkerQueue)
|
||||||
maxWorkerQueue))
|
/ maxWorkerQueue))
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
QtCore.QCoreApplication.processEvents(
|
QtCore.QCoreApplication.processEvents(
|
||||||
QtCore.QEventLoop.AllEvents, 1000
|
QtCore.QEventLoop.AllEvents, 1000
|
||||||
|
@ -2824,15 +2866,15 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
lines = messageText.split('\n')
|
lines = messageText.split('\n')
|
||||||
totalLines = len(lines)
|
totalLines = len(lines)
|
||||||
for i in xrange(totalLines):
|
for i in xrange(totalLines):
|
||||||
|
dash_line = '------------------------------------------------------'
|
||||||
if 'Message ostensibly from ' in lines[i]:
|
if 'Message ostensibly from ' in lines[i]:
|
||||||
lines[i] = '<p style="font-size: 12px; color: grey;">%s</span></p>' % (
|
lines[i] = '<p style="font-size: 12px; color: grey;">%s</span></p>' % (
|
||||||
lines[i])
|
lines[i])
|
||||||
elif lines[i] == '------------------------------------------------------':
|
elif lines[i] == dash_line:
|
||||||
lines[i] = '<hr>'
|
lines[i] = '<hr>'
|
||||||
elif lines[i] == '' and (i+1) < totalLines and \
|
elif lines[i] == '' and (i + 1) < totalLines and lines[i + 1] != dash_line:
|
||||||
lines[i+1] != '------------------------------------------------------':
|
|
||||||
lines[i] = '<br><br>'
|
lines[i] = '<br><br>'
|
||||||
content = ' '.join(lines) # To keep the whitespace between lines
|
content = ' '.join(lines) # To keep the whitespace between lines
|
||||||
content = shared.fixPotentiallyInvalidUTF8Data(content)
|
content = shared.fixPotentiallyInvalidUTF8Data(content)
|
||||||
content = unicode(content, 'utf-8)')
|
content = unicode(content, 'utf-8)')
|
||||||
textEdit.setHtml(QtCore.QString(content))
|
textEdit.setHtml(QtCore.QString(content))
|
||||||
|
@ -2889,7 +2931,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# Wrap and quote lines/paragraphs new to this message.
|
# Wrap and quote lines/paragraphs new to this message.
|
||||||
else:
|
else:
|
||||||
return quoteWrapper.fill(line)
|
return quoteWrapper.fill(line)
|
||||||
return '\n'.join([quote_line(l) for l in message.splitlines()]) + '\n\n'
|
return '\n'.join([quote_line(line) for line in message.splitlines()]) + '\n\n'
|
||||||
|
|
||||||
def setSendFromComboBox(self, address=None):
|
def setSendFromComboBox(self, address=None):
|
||||||
if address is None:
|
if address is None:
|
||||||
|
@ -2991,8 +3033,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
|
toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
|
||||||
if fromAddressAtCurrentInboxRow == \
|
if fromAddressAtCurrentInboxRow == \
|
||||||
tableWidget.item(currentInboxRow, column_from).label or (
|
tableWidget.item(currentInboxRow, column_from).label or (
|
||||||
isinstance(acct, GatewayAccount) and
|
isinstance(acct, GatewayAccount)
|
||||||
fromAddressAtCurrentInboxRow == acct.relayAddress):
|
and fromAddressAtCurrentInboxRow == acct.relayAddress):
|
||||||
self.ui.lineEditTo.setText(str(acct.fromAddress))
|
self.ui.lineEditTo.setText(str(acct.fromAddress))
|
||||||
else:
|
else:
|
||||||
self.ui.lineEditTo.setText(
|
self.ui.lineEditTo.setText(
|
||||||
|
@ -3056,7 +3098,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
queryreturn = sqlQuery('''select * from blacklist where address=?''',
|
queryreturn = sqlQuery('''select * from blacklist where address=?''',
|
||||||
addressAtCurrentInboxRow)
|
addressAtCurrentInboxRow)
|
||||||
if queryreturn == []:
|
if queryreturn == []:
|
||||||
label = "\"" + tableWidget.item(currentInboxRow, 2).subject + "\" in " + BMConfigParser().get(recipientAddress, "label")
|
label = "\"" + tableWidget.item(
|
||||||
|
currentInboxRow, 2).subject + "\" in " + BMConfigParser().get(recipientAddress, "label")
|
||||||
sqlExecute('''INSERT INTO blacklist VALUES (?,?, ?)''',
|
sqlExecute('''INSERT INTO blacklist VALUES (?,?, ?)''',
|
||||||
label,
|
label,
|
||||||
addressAtCurrentInboxRow, True)
|
addressAtCurrentInboxRow, True)
|
||||||
|
@ -3118,10 +3161,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
tableWidget.model().removeRows(
|
tableWidget.model().removeRows(
|
||||||
r.topRow(), r.bottomRow() - r.topRow() + 1)
|
r.topRow(), r.bottomRow() - r.topRow() + 1)
|
||||||
idCount = len(inventoryHashesToTrash)
|
idCount = len(inventoryHashesToTrash)
|
||||||
sqlExecuteChunked(
|
sqlExecuteChunked((
|
||||||
("DELETE FROM inbox" if folder == "trash" or shifted else
|
"DELETE FROM inbox" if folder == "trash" or shifted else
|
||||||
"UPDATE inbox SET folder='trash', read=1") +
|
"UPDATE inbox SET folder='trash', read=1"
|
||||||
" WHERE msgid IN ({0})", idCount, *inventoryHashesToTrash)
|
) + " WHERE msgid IN ({0})", idCount, *inventoryHashesToTrash)
|
||||||
tableWidget.selectRow(0 if currentRow == 0 else currentRow - 1)
|
tableWidget.selectRow(0 if currentRow == 0 else currentRow - 1)
|
||||||
tableWidget.setUpdatesEnabled(True)
|
tableWidget.setUpdatesEnabled(True)
|
||||||
self.propagateUnreadCount(folder)
|
self.propagateUnreadCount(folder)
|
||||||
|
@ -3175,7 +3218,11 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
message, = row
|
message, = row
|
||||||
|
|
||||||
defaultFilename = "".join(x for x in subjectAtCurrentInboxRow if x.isalnum()) + '.txt'
|
defaultFilename = "".join(x for x in subjectAtCurrentInboxRow if x.isalnum()) + '.txt'
|
||||||
filename = QtGui.QFileDialog.getSaveFileName(self, _translate("MainWindow","Save As..."), defaultFilename, "Text files (*.txt);;All files (*.*)")
|
filename = QtGui.QFileDialog.getSaveFileName(self, _translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Save As..."
|
||||||
|
), defaultFilename, "Text files (*.txt);;All files (*.*)")
|
||||||
|
|
||||||
if filename == '':
|
if filename == '':
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
@ -3632,8 +3679,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
otherAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole)
|
otherAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole)
|
||||||
account = accountClass(myAddress)
|
account = accountClass(myAddress)
|
||||||
if isinstance(account, GatewayAccount) and otherAddress == account.relayAddress and (
|
if isinstance(account, GatewayAccount) and otherAddress == account.relayAddress and (
|
||||||
(currentColumn in [0, 2] and self.getCurrentFolder() == "sent") or
|
(currentColumn in [0, 2] and self.getCurrentFolder() == "sent")
|
||||||
(currentColumn in [1, 2] and self.getCurrentFolder() != "sent")):
|
or (currentColumn in [1, 2] and self.getCurrentFolder() != "sent")):
|
||||||
text = str(tableWidget.item(currentRow, currentColumn).label)
|
text = str(tableWidget.item(currentRow, currentColumn).label)
|
||||||
else:
|
else:
|
||||||
text = tableWidget.item(currentRow, currentColumn).data(QtCore.Qt.UserRole)
|
text = tableWidget.item(currentRow, currentColumn).data(QtCore.Qt.UserRole)
|
||||||
|
@ -3965,7 +4012,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if column != 0:
|
if column != 0:
|
||||||
return
|
return
|
||||||
# only account names of normal addresses (no chans/mailinglists)
|
# only account names of normal addresses (no chans/mailinglists)
|
||||||
if (not isinstance(item, Ui_AddressWidget)) or (not self.getCurrentTreeWidget()) or self.getCurrentTreeWidget().currentItem() is None:
|
if (not isinstance(item, Ui_AddressWidget)) or (
|
||||||
|
not self.getCurrentTreeWidget()) or self.getCurrentTreeWidget().currentItem() is None:
|
||||||
return
|
return
|
||||||
# not visible
|
# not visible
|
||||||
if (not self.getCurrentItem()) or (not isinstance(self.getCurrentItem(), Ui_AddressWidget)):
|
if (not self.getCurrentItem()) or (not isinstance(self.getCurrentItem(), Ui_AddressWidget)):
|
||||||
|
|
Reference in New Issue
Block a user