From 84a4044bef49a11a7b9b2ead0ac30243d9e3b221 Mon Sep 17 00:00:00 2001 From: bug Lady Date: Fri, 29 Nov 2019 17:15:51 +0000 Subject: [PATCH] send pictures , not binaries have 2. button later... --- src/bitmessageqt/__init__.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index c7fa6390..f67440c8 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -1953,7 +1953,7 @@ class MyForm(settingsmixin.SMainWindow): self.ui.lineEditTo.setText("") self.ui.textEditMessage.reset() 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") @@ -1970,7 +1970,36 @@ class MyForm(settingsmixin.SMainWindow): else: # send broadcast message self.ui.textEditMessageBroadcast.insertPlainText(html_data) + ''' + + + 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 PICTURE File (mod src for binary) ") + if filename: + f = open(filename, 'rb') + data = f.read() + f.close() + + data_b64 = base64.b64encode(data) + + html_data = '' + os.path.basename(unicode(filename)) + '' + pics_data = '' % ("jpg", base64.b64encode(data).replace('\n', '') ) + + if self.ui.tabWidgetSend.currentIndex() == self.ui.tabWidgetSend.indexOf(self.ui.sendDirect): + # send direct message + #self.ui.textEditMessage.insertPlainText( html_data) + self.ui.textEditMessage.insertPlainText( pics_data) # choose either + else: + # send broadcast message + self.ui.textEditMessageBroadcast.insertPlainText(html_data) + + + + + + def click_pushButtonSend(self): encoding = 3 if QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier else 2