pylint fixes.

This commit is contained in:
George McCandless 2019-10-08 22:43:28 +00:00
parent 03fbadd3c4
commit 7db810d5af
No known key found for this signature in database
GPG Key ID: 62B9F5A4802A74BD
2 changed files with 7 additions and 4 deletions

View File

@ -1955,13 +1955,15 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.comboBoxSendFrom.setCurrentIndex(0)
def click_pushButtonAttach(self):
"""Launch a file picker and append to the current message the base64-encoded contents of the chosen file."""
filename = QtGui.QFileDialog.getOpenFileName(self, "Attach File")
if filename:
f = open(filename, 'rb')
data = f.read()
f.close()
data_b64 = base64.b64encode(data)
html_data = '<a href="data:application/octet-stream;base64,' + data_b64 + '">' + os.path.basename(unicode(filename)) + '</a>'
html_data = '<a href="data:application/octet-stream;base64,' + data_b64 + '">' \
+ os.path.basename(unicode(filename)) + '</a>'
if self.ui.tabWidgetSend.currentIndex() == self.ui.tabWidgetSend.indexOf(self.ui.sendDirect):
# send direct message
self.ui.textEditMessage.insertPlainText(html_data)

View File

@ -5,7 +5,8 @@ src/bitmessageqt/messageview.py
"""
from PyQt4 import QtCore, QtGui
import re, base64
import re
import base64
from safehtmlparser import SafeHTMLParser