This commit is contained in:
mailchuck 2015-09-30 10:22:41 +02:00 committed by Peter Surda
parent bde5bfc42e
commit 2b1222f970
3 changed files with 51 additions and 12 deletions

View File

@ -2028,9 +2028,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(
@ -2038,9 +2038,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())
@ -2098,6 +2098,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)))
@ -2262,6 +2263,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:
@ -2303,10 +2306,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(
@ -3535,16 +3540,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:

View File

@ -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():

View File

@ -81,8 +81,9 @@ def _doGPUPow(target, initialHash):
return [trialValue, nonce]
def run(target, initialHash):
if openclpow.has_opencl():
return _doGPUPow(target, initialHash)
target = int(target)
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: