diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 6382d73f..184cd28c 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2026,9 +2026,9 @@ more work your computer must do to send the message. A Time-To-Live of four or f if self.ui.tabWidgetSend.currentIndex() == 0: # message to specific people sendMessageToPeople = True - fromAddress = self.ui.comboBoxSendFrom.itemData( + fromAddress = str(self.ui.comboBoxSendFrom.itemData( self.ui.comboBoxSendFrom.currentIndex(), - Qt.UserRole).toString() + Qt.UserRole).toString()) toAddresses = str(self.ui.lineEditTo.text()) subject = str(self.ui.lineEditSubject.text().toUtf8()) message = str( @@ -2036,9 +2036,9 @@ more work your computer must do to send the message. A Time-To-Live of four or f else: # broadcast message sendMessageToPeople = False - fromAddress = self.ui.comboBoxSendFromBroadcast.itemData( + fromAddress = str(self.ui.comboBoxSendFromBroadcast.itemData( self.ui.comboBoxSendFromBroadcast.currentIndex(), - Qt.UserRole).toString() + Qt.UserRole).toString()) subject = str(self.ui.lineEditSubjectBroadcast.text().toUtf8()) message = str( self.ui.textEditMessageBroadcast.document().toPlainText().toUtf8()) @@ -2096,6 +2096,7 @@ more work your computer must do to send the message. A Time-To-Live of four or f "MainWindow", "Error: You must specify a From address. If you don\'t have one, go to the \'Your Identities\' tab.")) else: toAddress = addBMIfNotPresent(toAddress) + if addressVersionNumber > 4 or addressVersionNumber <= 1: QMessageBox.about(self, _translate("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))) @@ -2260,6 +2261,8 @@ more work your computer must do to send the message. A Time-To-Live of four or f # pseudo-mailing-list. The message will be broadcast out. This function # puts the message on the 'Sent' tab. def displayNewSentMessage(self, toAddress, toLabel, fromAddress, subject, message, ackdata): + if self.getCurrentFolder() != "sent": + return subject = shared.fixPotentiallyInvalidUTF8Data(subject) message = shared.fixPotentiallyInvalidUTF8Data(message) try: @@ -2301,10 +2304,12 @@ more work your computer must do to send the message. A Time-To-Live of four or f newItem.setData(Qt.UserRole, QByteArray(ackdata)) newItem.setData(33, int(time.time())) self.ui.tableWidgetInbox.setItem(0, 3, newItem) - self.ui.textEditSentMessage.setPlainText(unicode(message, 'utf-8)')) + self.ui.textEditInboxMessage.setPlainText(unicode(message, 'utf-8)')) self.ui.tableWidgetInbox.setSortingEnabled(True) def displayNewInboxMessage(self, inventoryHash, toAddress, fromAddress, subject, message): + if self.getCurrentFolder() != "inbox": + return subject = shared.fixPotentiallyInvalidUTF8Data(subject) fromLabel = '' queryreturn = sqlQuery( @@ -3533,16 +3538,43 @@ more work your computer must do to send the message. A Time-To-Live of four or f ackdata = self.getCurrentMessageId() if ackdata and messageTextedit: queryreturn = sqlQuery( - '''select message from sent where ackdata=?''', ackdata) + '''select message, 1 from sent where ackdata=?''', ackdata) else: msgid = self.getCurrentMessageId() if msgid and messageTextedit: queryreturn = sqlQuery( - '''select message from inbox where msgid=?''', msgid) + '''select message, read from inbox where msgid=?''', msgid) if queryreturn != []: + refresh = False for row in queryreturn: - message, = row + message, read = row + if folder == 'inbox' and read == 0: + markread = sqlQuery( + '''UPDATE inbox SET read = 1 WHERE msgid = ?''', msgid) + refresh = True + if refresh: + tableWidget = self.getCurrentMessagelist() + if not tableWidget: + return + font = QFont() + font.setBold(False) +# inventoryHashesToMarkRead = [] + currentRow = self.getCurrentMessagelist().currentRow() +# inventoryHashToMarkRead = str(tableWidget.item( +# currentRow, 3).data(Qt.UserRole).toPyObject()) +# inventoryHashesToMarkRead.append(inventoryHashToMarkRead) + tableWidget.item(currentRow, 0).setFont(font) + tableWidget.item(currentRow, 1).setFont(font) + tableWidget.item(currentRow, 2).setFont(font) + tableWidget.item(currentRow, 3).setFont(font) + self.changedInboxUnread() +# if self.ui.tabWidget.currentIndex() == 0: +# self.rerenderTabTreeMessages() +# elif self.ui.tabWidget.currentIndex() == 2: +# self.rerenderTabTreeSubscriptions() +# elif self.ui.tabWidget.currentIndex() == 3: +# self.rerenderTabTreeChans() else: data = self.getCurrentMessageId() if data != False: diff --git a/src/openclpow.py b/src/openclpow.py index 83d7513f..65449b85 100644 --- a/src/openclpow.py +++ b/src/openclpow.py @@ -15,10 +15,16 @@ try: ctx = cl.create_some_context() queue = cl.CommandQueue(ctx) - f = open('/usr/src/PyBitmessage/src/kernel.cl', 'r') + #f = open('/usr/src/PyBitmessage/src/kernel.cl', 'r') + import os + print "working directory: " + os.getcwd() +# time.sleep(5) + f = open('kernel.cl', 'r') fstr = ''.join(f.readlines()) program = cl.Program(ctx, fstr).build() -except: +except Exception as e: + print "opencl fail:" + str(e) +# time.sleep(5) ctx = False def has_opencl(): diff --git a/src/proofofwork.py b/src/proofofwork.py index f2e8096f..85f79430 100644 --- a/src/proofofwork.py +++ b/src/proofofwork.py @@ -82,8 +82,8 @@ def _doGPUPow(target, initialHash): def run(target, initialHash): target = int(target) - if openclpow.has_opencl(): - return _doGPUPow(target, initialHash) + if shared.safeConfigGetBoolean('bitmessagesettings', 'opencl') and openclpow.has_opencl(): + return _doGPUPow(target, initialHash) elif frozen == "macosx_app" or not frozen: return _doFastPoW(target, initialHash) else: