This commit is contained in:
mailchuck 2015-09-30 10:22:41 +02:00
parent 2e6f5c70ec
commit 42b63da7a2
3 changed files with 50 additions and 12 deletions

View File

@ -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: if self.ui.tabWidgetSend.currentIndex() == 0:
# message to specific people # message to specific people
sendMessageToPeople = True sendMessageToPeople = True
fromAddress = self.ui.comboBoxSendFrom.itemData( fromAddress = str(self.ui.comboBoxSendFrom.itemData(
self.ui.comboBoxSendFrom.currentIndex(), self.ui.comboBoxSendFrom.currentIndex(),
Qt.UserRole).toString() Qt.UserRole).toString())
toAddresses = str(self.ui.lineEditTo.text()) toAddresses = str(self.ui.lineEditTo.text())
subject = str(self.ui.lineEditSubject.text().toUtf8()) subject = str(self.ui.lineEditSubject.text().toUtf8())
message = str( 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: else:
# broadcast message # broadcast message
sendMessageToPeople = False sendMessageToPeople = False
fromAddress = self.ui.comboBoxSendFromBroadcast.itemData( fromAddress = str(self.ui.comboBoxSendFromBroadcast.itemData(
self.ui.comboBoxSendFromBroadcast.currentIndex(), self.ui.comboBoxSendFromBroadcast.currentIndex(),
Qt.UserRole).toString() Qt.UserRole).toString())
subject = str(self.ui.lineEditSubjectBroadcast.text().toUtf8()) subject = str(self.ui.lineEditSubjectBroadcast.text().toUtf8())
message = str( message = str(
self.ui.textEditMessageBroadcast.document().toPlainText().toUtf8()) 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.")) "MainWindow", "Error: You must specify a From address. If you don\'t have one, go to the \'Your Identities\' tab."))
else: else:
toAddress = addBMIfNotPresent(toAddress) toAddress = addBMIfNotPresent(toAddress)
if addressVersionNumber > 4 or addressVersionNumber <= 1: if addressVersionNumber > 4 or addressVersionNumber <= 1:
QMessageBox.about(self, _translate("MainWindow", "Address version number"), _translate( 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))) "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 # pseudo-mailing-list. The message will be broadcast out. This function
# puts the message on the 'Sent' tab. # puts the message on the 'Sent' tab.
def displayNewSentMessage(self, toAddress, toLabel, fromAddress, subject, message, ackdata): def displayNewSentMessage(self, toAddress, toLabel, fromAddress, subject, message, ackdata):
if self.getCurrentFolder() != "sent":
return
subject = shared.fixPotentiallyInvalidUTF8Data(subject) subject = shared.fixPotentiallyInvalidUTF8Data(subject)
message = shared.fixPotentiallyInvalidUTF8Data(message) message = shared.fixPotentiallyInvalidUTF8Data(message)
try: 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(Qt.UserRole, QByteArray(ackdata))
newItem.setData(33, int(time.time())) newItem.setData(33, int(time.time()))
self.ui.tableWidgetInbox.setItem(0, 3, newItem) 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) self.ui.tableWidgetInbox.setSortingEnabled(True)
def displayNewInboxMessage(self, inventoryHash, toAddress, fromAddress, subject, message): def displayNewInboxMessage(self, inventoryHash, toAddress, fromAddress, subject, message):
if self.getCurrentFolder() != "inbox":
return
subject = shared.fixPotentiallyInvalidUTF8Data(subject) subject = shared.fixPotentiallyInvalidUTF8Data(subject)
fromLabel = '' fromLabel = ''
queryreturn = sqlQuery( 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() ackdata = self.getCurrentMessageId()
if ackdata and messageTextedit: if ackdata and messageTextedit:
queryreturn = sqlQuery( queryreturn = sqlQuery(
'''select message from sent where ackdata=?''', ackdata) '''select message, 1 from sent where ackdata=?''', ackdata)
else: else:
msgid = self.getCurrentMessageId() msgid = self.getCurrentMessageId()
if msgid and messageTextedit: if msgid and messageTextedit:
queryreturn = sqlQuery( queryreturn = sqlQuery(
'''select message from inbox where msgid=?''', msgid) '''select message, read from inbox where msgid=?''', msgid)
if queryreturn != []: if queryreturn != []:
refresh = False
for row in queryreturn: 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: else:
data = self.getCurrentMessageId() data = self.getCurrentMessageId()
if data != False: if data != False:

View File

@ -15,10 +15,16 @@ try:
ctx = cl.create_some_context() ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx) 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()) fstr = ''.join(f.readlines())
program = cl.Program(ctx, fstr).build() program = cl.Program(ctx, fstr).build()
except: except Exception as e:
print "opencl fail:" + str(e)
# time.sleep(5)
ctx = False ctx = False
def has_opencl(): def has_opencl():

View File

@ -82,8 +82,8 @@ def _doGPUPow(target, initialHash):
def run(target, initialHash): def run(target, initialHash):
target = int(target) target = int(target)
if openclpow.has_opencl(): if shared.safeConfigGetBoolean('bitmessagesettings', 'opencl') and openclpow.has_opencl():
return _doGPUPow(target, initialHash) return _doGPUPow(target, initialHash)
elif frozen == "macosx_app" or not frozen: elif frozen == "macosx_app" or not frozen:
return _doFastPoW(target, initialHash) return _doFastPoW(target, initialHash)
else: else: