various changes to Identicon code

This commit is contained in:
Jonathan Warren 2013-11-01 19:25:24 -04:00
parent 753155aa86
commit f7ef2b4e05
5 changed files with 288 additions and 448 deletions

View File

@ -29,6 +29,7 @@ import sys
from time import strftime, localtime, gmtime from time import strftime, localtime, gmtime
import time import time
import os import os
import hashlib
from pyelliptic.openssl import OpenSSL from pyelliptic.openssl import OpenSSL
import pickle import pickle
import platform import platform
@ -64,20 +65,19 @@ def identiconize(address):
# 3fd4bf901b9d4ea1394f0fb358725b28 # 3fd4bf901b9d4ea1394f0fb358725b28
try: try:
identicon_lib = shared.config.get('bitmessagesettings', 'identicon') identicon_lib = shared.config.get('bitmessagesettings', 'identiconlib')
except: except:
# default to no identicons # default to qidenticon_two_x
identicon_lib = False identicon_lib = 'qidenticon_two_x'
# As an 'identiconsuffix' you could put "@bitmessge.ch" or "@bm.addr" to make it compatible with other identicon generators. (Note however, that E-Mail programs might convert the BM-address to lowercase first.)
# It can be used as a pseudo-password to salt the generation of the identicons to decrease the risk
# of attacks where someone creates an address to mimic someone else's identicon.
identiconsuffix = shared.config.get('bitmessagesettings', 'identiconsuffix')
try: if not shared.config.getboolean('bitmessagesettings', 'useidenticons'):
# As an 'identiconsuffix' you could put "@bitmessge.ch" or "@bm.addr" to make it compatible with other identicon generators. (Note however, that E-Mail programs might convert the BM-address to lowercase first.) idcon = QtGui.QIcon()
# It can be used as a pseudo-password to salt the generation of the identicons to decrease the risk return idcon
# of attacks where someone creates an address to mimic someone else's identicon.
# If not set yet it will be filled by a random string.
# Another good idea would be to fill it with the private key of one of your addresses (because you don't need to memorize it then).
identiconsuffix = shared.config.get('bitmessagesettings', 'identiconsuffix')
except:
identiconsuffix = ''
if (identicon_lib[:len('qidenticon')] == 'qidenticon'): if (identicon_lib[:len('qidenticon')] == 'qidenticon'):
# print identicon_lib # print identicon_lib
@ -86,7 +86,6 @@ def identiconize(address):
# Licesensed under FreeBSD License. # Licesensed under FreeBSD License.
# stripped from PIL and uses QT instead (by sendiulo, same license) # stripped from PIL and uses QT instead (by sendiulo, same license)
import qidenticon import qidenticon
import hashlib
hash = hashlib.md5(addBMIfNotPresent(address)+identiconsuffix).hexdigest() hash = hashlib.md5(addBMIfNotPresent(address)+identiconsuffix).hexdigest()
use_two_colors = (identicon_lib[:len('qidenticon_two')] == 'qidenticon_two') use_two_colors = (identicon_lib[:len('qidenticon_two')] == 'qidenticon_two')
opacity = int(not((identicon_lib == 'qidenticon_x') | (identicon_lib == 'qidenticon_two_x') | (identicon_lib == 'qidenticon_b') | (identicon_lib == 'qidenticon_two_b')))*255 opacity = int(not((identicon_lib == 'qidenticon_x') | (identicon_lib == 'qidenticon_two_x') | (identicon_lib == 'qidenticon_b') | (identicon_lib == 'qidenticon_two_b')))*255
@ -113,66 +112,50 @@ def identiconize(address):
idcon = QtGui.QIcon() idcon = QtGui.QIcon()
idcon.addPixmap(pix, QtGui.QIcon.Normal, QtGui.QIcon.Off) idcon.addPixmap(pix, QtGui.QIcon.Normal, QtGui.QIcon.Off)
return idcon return idcon
elif identicon_lib in ['False', 'false', 'None', 'none']:
idcon = QtGui.QIcon()
return idcon
else:
# default to no identicons
idcon = QtGui.QIcon()
return idcon
def avatarize(address, fallBackToIdenticon = False): def avatarize(address):
""" """
loads a supported image for the given address' hash form 'avatars' folder loads a supported image for the given address' hash form 'avatars' folder
falls back to default avatar if 'default.*' file exists falls back to default avatar if 'default.*' file exists
falls back to identiconize(address) if second argument fallBackToIdenticon == True falls back to identiconize(address)
""" """
idcon = QtGui.QIcon() idcon = QtGui.QIcon()
if shared.safeConfigGetBoolean('bitmessagesettings', 'avatars'): hash = hashlib.md5(addBMIfNotPresent(address)).hexdigest()
import hashlib str_broadcast_subscribers = '[Broadcast subscribers]'
hash = hashlib.md5(addBMIfNotPresent(address)).hexdigest() if address == str_broadcast_subscribers:
str_broadcast_subscribers = '[Broadcast subscribers]' # don't hash [Broadcast subscribers]
if address == str_broadcast_subscribers: hash = address
# don't hash [Broadcast subscribers] # http://pyqt.sourceforge.net/Docs/PyQt4/qimagereader.html#supportedImageFormats
hash = address # print QImageReader.supportedImageFormats ()
# http://pyqt.sourceforge.net/Docs/PyQt4/qimagereader.html#supportedImageFormats # QImageReader.supportedImageFormats ()
# print QImageReader.supportedImageFormats () extensions = ['PNG', 'GIF', 'JPG', 'JPEG', 'SVG', 'BMP', 'MNG', 'PBM', 'PGM', 'PPM', 'TIFF', 'XBM', 'XPM', 'TGA']
# QImageReader.supportedImageFormats () # try to find a specific avatar
extensions = ['PNG', 'GIF', 'JPG', 'JPEG', 'SVG', 'BMP', 'MNG', 'PBM', 'PGM', 'PPM', 'TIFF', 'XBM', 'XPM', 'TGA'] for ext in extensions:
# try to find a specific avatar lower_hash = shared.appdata + 'avatars/' + hash + '.' + ext.lower()
for ext in extensions: upper_hash = shared.appdata + 'avatars/' + hash + '.' + ext.upper()
lower_hash = shared.appdata + 'avatars/' + hash + '.' + ext.lower() if os.path.isfile(lower_hash):
upper_hash = shared.appdata + 'avatars/' + hash + '.' + ext.upper() # print 'found avatar of ', address
if os.path.isfile(lower_hash): idcon.addFile(lower_hash)
# print 'found avatar of ', address return idcon
idcon.addFile(lower_hash) elif os.path.isfile(upper_hash):
return idcon # print 'found avatar of ', address
elif os.path.isfile(upper_hash): idcon.addFile(upper_hash)
# print 'found avatar of ', address return idcon
idcon.addFile(upper_hash) # if we haven't found any, try to find a default avatar
return idcon for ext in extensions:
# if we haven't found any, try to find a default avatar lower_default = shared.appdata + 'avatars/' + 'default.' + ext.lower()
for ext in extensions: upper_default = shared.appdata + 'avatars/' + 'default.' + ext.upper()
lower_default = shared.appdata + 'avatars/' + 'default.' + ext.lower() if os.path.isfile(lower_default):
upper_default = shared.appdata + 'avatars/' + 'default.' + ext.upper() default = lower_default
if os.path.isfile(lower_default): idcon.addFile(lower_default)
default = lower_default return idcon
idcon.addFile(lower_default) elif os.path.isfile(upper_default):
return idcon default = upper_default
elif os.path.isfile(upper_default): idcon.addFile(upper_default)
default = upper_default return idcon
idcon.addFile(upper_default) # If no avatar is found
return idcon return identiconize(address)
# if avatars are deactivated or none found
if fallBackToIdenticon:
return identiconize(address)
else:
try:
identicon_lib = shared.config.get('bitmessagesettings', 'identicon')
except:
# default to no identicons
identicon_lib = False
return idcon
class MyForm(QtGui.QMainWindow): class MyForm(QtGui.QMainWindow):
@ -462,7 +445,6 @@ class MyForm(QtGui.QMainWindow):
newItem.setTextColor(QtGui.QColor(128, 128, 128)) newItem.setTextColor(QtGui.QColor(128, 128, 128))
if shared.safeConfigGetBoolean(addressInKeysFile, 'mailinglist'): if shared.safeConfigGetBoolean(addressInKeysFile, 'mailinglist'):
newItem.setTextColor(QtGui.QColor(137, 04, 177)) # magenta newItem.setTextColor(QtGui.QColor(137, 04, 177)) # magenta
newItem.setIcon(identiconize(addressInKeysFile))
self.ui.tableWidgetYourIdentities.setItem(0, 1, newItem) self.ui.tableWidgetYourIdentities.setItem(0, 1, newItem)
newItem = QtGui.QTableWidgetItem(str( newItem = QtGui.QTableWidgetItem(str(
decodeAddress(addressInKeysFile)[2])) decodeAddress(addressInKeysFile)[2]))
@ -531,7 +513,6 @@ class MyForm(QtGui.QMainWindow):
self.ui.tableWidgetYourIdentities.setIconSize(QtCore.QSize(identicon_size, identicon_size)) self.ui.tableWidgetYourIdentities.setIconSize(QtCore.QSize(identicon_size, identicon_size))
self.ui.tableWidgetSubscriptions.setIconSize(QtCore.QSize(identicon_size, identicon_size)) self.ui.tableWidgetSubscriptions.setIconSize(QtCore.QSize(identicon_size, identicon_size))
self.ui.tableWidgetAddressBook.setIconSize(QtCore.QSize(identicon_size, identicon_size)) self.ui.tableWidgetAddressBook.setIconSize(QtCore.QSize(identicon_size, identicon_size))
#self.ui.tableWidgetWhitelist.setIconSize(QtCore.QSize(identicon_size, identicon_size))
self.ui.tableWidgetBlacklist.setIconSize(QtCore.QSize(identicon_size, identicon_size)) self.ui.tableWidgetBlacklist.setIconSize(QtCore.QSize(identicon_size, identicon_size))
self.UISignalThread = UISignaler() self.UISignalThread = UISignaler()
@ -713,30 +694,29 @@ class MyForm(QtGui.QMainWindow):
for row in queryreturn: for row in queryreturn:
toAddress, fromAddress, subject, status, ackdata, lastactiontime = row toAddress, fromAddress, subject, status, ackdata, lastactiontime = row
subject = shared.fixPotentiallyInvalidUTF8Data(subject) subject = shared.fixPotentiallyInvalidUTF8Data(subject)
#message = shared.fixPotentiallyInvalidUTF8Data(message)
try: if shared.config.has_section(fromAddress):
fromLabel = shared.config.get(fromAddress, 'label') fromLabel = shared.config.get(fromAddress, 'label')
except:
fromLabel = ''
if fromLabel == '': if fromLabel == '':
fromLabel = fromAddress fromLabel = fromAddress
toLabel = '' toLabel = ''
queryreturn = sqlQuery( queryreturn = sqlQuery(
'''select label from addressbook where address=?''', toAddress) '''select label from addressbook where address=?''', toAddress)
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
toLabel, = row toLabel, = row
if toLabel == '':
if shared.config.has_section(toAddress):
toLabel = shared.config.get(toAddress, 'label')
if toLabel == '':
toLabel = toAddress
self.ui.tableWidgetSent.insertRow(0) self.ui.tableWidgetSent.insertRow(0)
if toLabel == '': newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8'))
newItem = QtGui.QTableWidgetItem(unicode(toAddress, 'utf-8')) newItem.setToolTip(unicode(toLabel, 'utf-8'))
newItem.setToolTip(unicode(toAddress, 'utf-8')) newItem.setIcon(avatarize(toAddress))
else:
newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8'))
newItem.setToolTip(unicode(toLabel, 'utf-8'))
newItem.setIcon(avatarize(toAddress, True))
newItem.setData(Qt.UserRole, str(toAddress)) newItem.setData(Qt.UserRole, str(toAddress))
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
@ -748,7 +728,7 @@ class MyForm(QtGui.QMainWindow):
else: else:
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
newItem.setToolTip(unicode(fromLabel, 'utf-8')) newItem.setToolTip(unicode(fromLabel, 'utf-8'))
newItem.setIcon(avatarize(fromAddress, True)) newItem.setIcon(avatarize(fromAddress))
newItem.setData(Qt.UserRole, str(fromAddress)) newItem.setData(Qt.UserRole, str(fromAddress))
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
@ -837,7 +817,6 @@ class MyForm(QtGui.QMainWindow):
for row in queryreturn: for row in queryreturn:
msgid, toAddress, fromAddress, subject, received, read = row msgid, toAddress, fromAddress, subject, received, read = row
subject = shared.fixPotentiallyInvalidUTF8Data(subject) subject = shared.fixPotentiallyInvalidUTF8Data(subject)
#message = shared.fixPotentiallyInvalidUTF8Data(message)
try: try:
if toAddress == self.str_broadcast_subscribers: if toAddress == self.str_broadcast_subscribers:
toLabel = self.str_broadcast_subscribers toLabel = self.str_broadcast_subscribers
@ -848,17 +827,13 @@ class MyForm(QtGui.QMainWindow):
if toLabel == '': if toLabel == '':
toLabel = toAddress toLabel = toAddress
try: # try to get the from label fom YourIdentites (for chan messages) fromLabel = ''
if shared.config.has_section(fromAddress):
fromLabel = shared.config.get(fromAddress, 'label') fromLabel = shared.config.get(fromAddress, 'label')
checkIfChan = True
except:
fromLabel = ''
checkIfChan = False
if fromLabel == '': # If this address wasn't in our address book... if fromLabel == '': # If the fromAddress isn't one of our addresses
queryreturn = sqlQuery( queryreturn = sqlQuery(
'''select label from addressbook where address=?''', fromAddress) '''select label from addressbook where address=?''', fromAddress)
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
fromLabel, = row fromLabel, = row
@ -866,16 +841,17 @@ class MyForm(QtGui.QMainWindow):
if fromLabel == '': # If this address wasn't in our address book... if fromLabel == '': # If this address wasn't in our address book...
queryReturn = sqlQuery( queryReturn = sqlQuery(
'''select label from subscriptions where address=?''', fromAddress) '''select label from subscriptions where address=?''', fromAddress)
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
fromLabel, = row fromLabel, = row
if fromLabel == '':
fromLabel = fromAddress
# message row # message row
self.ui.tableWidgetInbox.insertRow(0) self.ui.tableWidgetInbox.insertRow(0)
# to
newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8'))
newItem.setToolTip(unicode(toLabel, 'utf-8')) newItem.setToolTip(unicode(toLabel, 'utf-8'))
# to
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read: if not read:
@ -885,24 +861,19 @@ class MyForm(QtGui.QMainWindow):
newItem.setTextColor(QtGui.QColor(137, 04, 177)) # magenta newItem.setTextColor(QtGui.QColor(137, 04, 177)) # magenta
if shared.safeConfigGetBoolean(str(toAddress), 'chan'): if shared.safeConfigGetBoolean(str(toAddress), 'chan'):
newItem.setTextColor(QtGui.QColor(216, 119, 0)) # orange newItem.setTextColor(QtGui.QColor(216, 119, 0)) # orange
newItem.setIcon(avatarize(toAddress, True)) newItem.setIcon(avatarize(toAddress))
self.ui.tableWidgetInbox.setItem(0, 0, newItem) self.ui.tableWidgetInbox.setItem(0, 0, newItem)
# from # from
if fromLabel == '': newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
newItem = QtGui.QTableWidgetItem( newItem.setToolTip(unicode(fromLabel, 'utf-8'))
unicode(fromAddress, 'utf-8'))
newItem.setToolTip(unicode(fromAddress, 'utf-8'))
else:
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
newItem.setToolTip(unicode(fromLabel, 'utf-8'))
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read: if not read:
newItem.setFont(font) newItem.setFont(font)
newItem.setData(Qt.UserRole, str(fromAddress)) newItem.setData(Qt.UserRole, str(fromAddress))
if checkIfChan & shared.safeConfigGetBoolean(str(toAddress), 'chan'): if shared.safeConfigGetBoolean(str(fromAddress), 'chan'):
newItem.setTextColor(QtGui.QColor(216, 119, 0)) # orange newItem.setTextColor(QtGui.QColor(216, 119, 0)) # orange
newItem.setIcon(avatarize(fromAddress, True)) newItem.setIcon(avatarize(fromAddress))
self.ui.tableWidgetInbox.setItem(0, 1, newItem) self.ui.tableWidgetInbox.setItem(0, 1, newItem)
# subject # subject
newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8'))
@ -1585,11 +1556,8 @@ class MyForm(QtGui.QMainWindow):
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
fromLabel, = row fromLabel, = row
self.ui.tableWidgetInbox.item(
i, 1).setText(unicode(fromLabel, 'utf-8')) if fromLabel == '':
self.ui.tableWidgetInbox.item(
i, 1).setIcon(avatarize(addressToLookup, True))
else:
# It might be a broadcast message. We should check for that # It might be a broadcast message. We should check for that
# label. # label.
queryreturn = sqlQuery( queryreturn = sqlQuery(
@ -1598,46 +1566,38 @@ class MyForm(QtGui.QMainWindow):
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
fromLabel, = row fromLabel, = row
self.ui.tableWidgetInbox.item( if fromLabel == '':
i, 1).setText(unicode(fromLabel, 'utf-8')) # Message might be from an address we own like a chan address. Let's look for that label.
self.ui.tableWidgetInbox.item( if shared.config.has_section(addressToLookup):
i, 1).setIcon(avatarize(addressToLookup, True)) fromLabel = shared.config.get(addressToLookup, 'label')
else: if fromLabel == '':
# It might be a chan message. We should check for that fromLabel = addressToLookup
# label. self.ui.tableWidgetInbox.item(
try: i, 1).setText(unicode(fromLabel, 'utf-8'))
fromLabel = shared.config.get(addressToLookup, 'label') self.ui.tableWidgetInbox.item(
except: i, 1).setIcon(avatarize(addressToLookup))
fromLabel = '' # Set the color according to whether it is the address of a mailing
if fromLabel == '': # list or not.
fromLabel = addressToLookup if shared.safeConfigGetBoolean(addressToLookup, 'chan'):
self.ui.tableWidgetInbox.item( self.ui.tableWidgetInbox.item(i, 1).setTextColor(QtGui.QColor(216, 119, 0)) # orange
i, 1).setText(unicode(fromLabel, 'utf-8')) else:
self.ui.tableWidgetInbox.item( self.ui.tableWidgetInbox.item(
i, 1).setIcon(avatarize(addressToLookup, True)) i, 1).setTextColor(QApplication.palette().text().color())
# Set the color according to whether it is the address of a mailing
# list or not.
if shared.safeConfigGetBoolean(addressToLookup, 'chan'):
self.ui.tableWidgetInbox.item(i, 1).setTextColor(QtGui.QColor(216, 119, 0)) # orange
else:
self.ui.tableWidgetInbox.item(
i, 1).setTextColor(QApplication.palette().text().color())
def rerenderInboxToLabels(self): def rerenderInboxToLabels(self):
for i in range(self.ui.tableWidgetInbox.rowCount()): for i in range(self.ui.tableWidgetInbox.rowCount()):
toAddress = str(self.ui.tableWidgetInbox.item( toAddress = str(self.ui.tableWidgetInbox.item(
i, 0).data(Qt.UserRole).toPyObject()) i, 0).data(Qt.UserRole).toPyObject())
try: # Message might be to an address we own like a chan address. Let's look for that label.
if shared.config.has_section(toAddress):
toLabel = shared.config.get(toAddress, 'label') toLabel = shared.config.get(toAddress, 'label')
except: else:
toLabel = ''
if toLabel == '':
toLabel = toAddress toLabel = toAddress
self.ui.tableWidgetInbox.item( self.ui.tableWidgetInbox.item(
i, 0).setText(unicode(toLabel, 'utf-8')) i, 0).setText(unicode(toLabel, 'utf-8'))
self.ui.tableWidgetInbox.item( self.ui.tableWidgetInbox.item(
i, 0).setIcon(avatarize(toAddress, True)) i, 0).setIcon(avatarize(toAddress))
# Set the color according to whether it is the address of a mailing # Set the color according to whether it is the address of a mailing
# list, a chan or neither. # list, a chan or neither.
if shared.safeConfigGetBoolean(toAddress, 'chan'): if shared.safeConfigGetBoolean(toAddress, 'chan'):
@ -1652,16 +1612,15 @@ class MyForm(QtGui.QMainWindow):
for i in range(self.ui.tableWidgetSent.rowCount()): for i in range(self.ui.tableWidgetSent.rowCount()):
fromAddress = str(self.ui.tableWidgetSent.item( fromAddress = str(self.ui.tableWidgetSent.item(
i, 1).data(Qt.UserRole).toPyObject()) i, 1).data(Qt.UserRole).toPyObject())
try: # Message might be from an address we own like a chan address. Let's look for that label.
if shared.config.has_section(fromAddress):
fromLabel = shared.config.get(fromAddress, 'label') fromLabel = shared.config.get(fromAddress, 'label')
except: else:
fromLabel = ''
if fromLabel == '':
fromLabel = fromAddress fromLabel = fromAddress
self.ui.tableWidgetSent.item( self.ui.tableWidgetSent.item(
i, 1).setText(unicode(fromLabel, 'utf-8')) i, 1).setText(unicode(fromLabel, 'utf-8'))
self.ui.tableWidgetSent.item( self.ui.tableWidgetSent.item(
i, 1).setIcon(avatarize(fromAddress, True)) i, 1).setIcon(avatarize(fromAddress))
def rerenderSentToLabels(self): def rerenderSentToLabels(self):
for i in range(self.ui.tableWidgetSent.rowCount()): for i in range(self.ui.tableWidgetSent.rowCount()):
@ -1670,12 +1629,17 @@ class MyForm(QtGui.QMainWindow):
toLabel = '' toLabel = ''
queryreturn = sqlQuery( queryreturn = sqlQuery(
'''select label from addressbook where address=?''', addressToLookup) '''select label from addressbook where address=?''', addressToLookup)
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
toLabel, = row toLabel, = row
self.ui.tableWidgetSent.item(
i, 0).setText(unicode(toLabel, 'utf-8')) if toLabel == '':
# Message might be to an address we own like a chan address. Let's look for that label.
if shared.config.has_section(addressToLookup):
toLabel = shared.config.get(addressToLookup, 'label')
toLabel = addressToLookup
self.ui.tableWidgetSent.item(
i, 0).setText(unicode(toLabel, 'utf-8'))
def rerenderAddressBook(self): def rerenderAddressBook(self):
self.ui.tableWidgetAddressBook.setRowCount(0) self.ui.tableWidgetAddressBook.setRowCount(0)
@ -1684,6 +1648,7 @@ class MyForm(QtGui.QMainWindow):
label, address = row label, address = row
self.ui.tableWidgetAddressBook.insertRow(0) self.ui.tableWidgetAddressBook.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(label, 'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(label, 'utf-8'))
newItem.setIcon(avatarize(address))
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem) self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address) newItem = QtGui.QTableWidgetItem(address)
newItem.setFlags( newItem.setFlags(
@ -1706,7 +1671,6 @@ class MyForm(QtGui.QMainWindow):
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not enabled: if not enabled:
newItem.setTextColor(QtGui.QColor(128, 128, 128)) newItem.setTextColor(QtGui.QColor(128, 128, 128))
newItem.setIcon(identiconize(address))
self.ui.tableWidgetSubscriptions.setItem(0, 1, newItem) self.ui.tableWidgetSubscriptions.setItem(0, 1, newItem)
def click_pushButtonSend(self): def click_pushButtonSend(self):
@ -1881,7 +1845,7 @@ class MyForm(QtGui.QMainWindow):
isEnabled = shared.config.getboolean( isEnabled = shared.config.getboolean(
addressInKeysFile, 'enabled') # I realize that this is poor programming practice but I don't care. It's easier for others to read. addressInKeysFile, 'enabled') # I realize that this is poor programming practice but I don't care. It's easier for others to read.
if isEnabled: if isEnabled:
self.ui.comboBoxSendFrom.insertItem(0, avatarize(addressInKeysFile, True), unicode(shared.config.get( self.ui.comboBoxSendFrom.insertItem(0, avatarize(addressInKeysFile), unicode(shared.config.get(
addressInKeysFile, 'label'), 'utf-8'), addressInKeysFile) addressInKeysFile, 'label'), 'utf-8'), addressInKeysFile)
self.ui.comboBoxSendFrom.insertItem(0, '', '') self.ui.comboBoxSendFrom.insertItem(0, '', '')
if(self.ui.comboBoxSendFrom.count() == 2): if(self.ui.comboBoxSendFrom.count() == 2):
@ -1913,7 +1877,7 @@ class MyForm(QtGui.QMainWindow):
newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8'))
newItem.setToolTip(unicode(toLabel, 'utf-8')) newItem.setToolTip(unicode(toLabel, 'utf-8'))
newItem.setData(Qt.UserRole, str(toAddress)) newItem.setData(Qt.UserRole, str(toAddress))
newItem.setIcon(avatarize(toAddress, True)) newItem.setIcon(avatarize(toAddress))
self.ui.tableWidgetSent.setItem(0, 0, newItem) self.ui.tableWidgetSent.setItem(0, 0, newItem)
if fromLabel == '': if fromLabel == '':
newItem = QtGui.QTableWidgetItem(unicode(fromAddress, 'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(fromAddress, 'utf-8'))
@ -1922,7 +1886,7 @@ class MyForm(QtGui.QMainWindow):
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8')) newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
newItem.setToolTip(unicode(fromLabel, 'utf-8')) newItem.setToolTip(unicode(fromLabel, 'utf-8'))
newItem.setData(Qt.UserRole, str(fromAddress)) newItem.setData(Qt.UserRole, str(fromAddress))
newItem.setIcon(avatarize(fromAddress, True)) newItem.setIcon(avatarize(fromAddress))
self.ui.tableWidgetSent.setItem(0, 1, newItem) self.ui.tableWidgetSent.setItem(0, 1, newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8)')) newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8)'))
newItem.setToolTip(unicode(subject, 'utf-8)')) newItem.setToolTip(unicode(subject, 'utf-8)'))
@ -1944,7 +1908,6 @@ class MyForm(QtGui.QMainWindow):
def displayNewInboxMessage(self, inventoryHash, toAddress, fromAddress, subject, message): def displayNewInboxMessage(self, inventoryHash, toAddress, fromAddress, subject, message):
subject = shared.fixPotentiallyInvalidUTF8Data(subject) subject = shared.fixPotentiallyInvalidUTF8Data(subject)
#message = shared.fixPotentiallyInvalidUTF8Data(message)
fromLabel = '' fromLabel = ''
queryreturn = sqlQuery( queryreturn = sqlQuery(
'''select label from addressbook where address=?''', fromAddress) '''select label from addressbook where address=?''', fromAddress)
@ -1981,7 +1944,7 @@ class MyForm(QtGui.QMainWindow):
if shared.safeConfigGetBoolean(str(toAddress), 'chan'): if shared.safeConfigGetBoolean(str(toAddress), 'chan'):
newItem.setTextColor(QtGui.QColor(216, 119, 0)) # orange newItem.setTextColor(QtGui.QColor(216, 119, 0)) # orange
self.ui.tableWidgetInbox.insertRow(0) self.ui.tableWidgetInbox.insertRow(0)
newItem.setIcon(avatarize(toAddress, True)) newItem.setIcon(avatarize(toAddress))
self.ui.tableWidgetInbox.setItem(0, 0, newItem) self.ui.tableWidgetInbox.setItem(0, 0, newItem)
if fromLabel == '': if fromLabel == '':
@ -1996,7 +1959,7 @@ class MyForm(QtGui.QMainWindow):
self.notifierShow(unicode(_translate("MainWindow",'New Message').toUtf8(),'utf-8'), unicode(_translate("MainWindow",'From ').toUtf8(),'utf-8') + unicode(fromLabel, 'utf-8'), self.SOUND_KNOWN, unicode(fromLabel, 'utf-8')) self.notifierShow(unicode(_translate("MainWindow",'New Message').toUtf8(),'utf-8'), unicode(_translate("MainWindow",'From ').toUtf8(),'utf-8') + unicode(fromLabel, 'utf-8'), self.SOUND_KNOWN, unicode(fromLabel, 'utf-8'))
newItem.setData(Qt.UserRole, str(fromAddress)) newItem.setData(Qt.UserRole, str(fromAddress))
newItem.setFont(font) newItem.setFont(font)
newItem.setIcon(avatarize(fromAddress, True)) newItem.setIcon(avatarize(fromAddress))
self.ui.tableWidgetInbox.setItem(0, 1, newItem) self.ui.tableWidgetInbox.setItem(0, 1, newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8)')) newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8)'))
newItem.setToolTip(unicode(subject, 'utf-8)')) newItem.setToolTip(unicode(subject, 'utf-8)'))
@ -2038,7 +2001,6 @@ class MyForm(QtGui.QMainWindow):
newItem.setIcon(avatarize(address)) newItem.setIcon(avatarize(address))
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem) self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address) newItem = QtGui.QTableWidgetItem(address)
newItem.setIcon(identiconize(address))
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetAddressBook.setItem(0, 1, newItem) self.ui.tableWidgetAddressBook.setItem(0, 1, newItem)
@ -2062,7 +2024,6 @@ class MyForm(QtGui.QMainWindow):
newItem.setIcon(avatarize(address)) newItem.setIcon(avatarize(address))
self.ui.tableWidgetSubscriptions.setItem(0,0,newItem) self.ui.tableWidgetSubscriptions.setItem(0,0,newItem)
newItem = QtGui.QTableWidgetItem(address) newItem = QtGui.QTableWidgetItem(address)
newItem.setIcon(identiconize(address))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled ) newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetSubscriptions.setItem(0,1,newItem) self.ui.tableWidgetSubscriptions.setItem(0,1,newItem)
self.ui.tableWidgetSubscriptions.setSortingEnabled(True) self.ui.tableWidgetSubscriptions.setSortingEnabled(True)
@ -2101,7 +2062,6 @@ class MyForm(QtGui.QMainWindow):
newItem.setIcon(avatarize(address)) newItem.setIcon(avatarize(address))
self.ui.tableWidgetBlacklist.setItem(0, 0, newItem) self.ui.tableWidgetBlacklist.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address) newItem = QtGui.QTableWidgetItem(address)
newItem.setIcon(identiconize(address))
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not enabled: if not enabled:
@ -2135,19 +2095,13 @@ class MyForm(QtGui.QMainWindow):
self.settingsDialogInstance.ui.checkBoxStartInTray.isChecked())) self.settingsDialogInstance.ui.checkBoxStartInTray.isChecked()))
shared.config.set('bitmessagesettings', 'willinglysendtomobile', str( shared.config.set('bitmessagesettings', 'willinglysendtomobile', str(
self.settingsDialogInstance.ui.checkBoxWillinglySendToMobile.isChecked())) self.settingsDialogInstance.ui.checkBoxWillinglySendToMobile.isChecked()))
shared.config.set('bitmessagesettings', 'useidenticons', str(
self.settingsDialogInstance.ui.checkBoxUseIdenticons.isChecked()))
lang_ind = int(self.settingsDialogInstance.ui.languageComboBox.currentIndex()) lang_ind = int(self.settingsDialogInstance.ui.languageComboBox.currentIndex())
if not languages[lang_ind] == 'other': if not languages[lang_ind] == 'other':
shared.config.set('bitmessagesettings', 'userlocale', languages[lang_ind]) shared.config.set('bitmessagesettings', 'userlocale', languages[lang_ind])
curr_index = self.settingsDialogInstance.ui.comboBoxIdenticonStyle.currentIndex()
shared.config.set('bitmessagesettings', 'identicon', str(self.settingsDialogInstance.ui.comboBoxIdenticonStyle.itemData(
curr_index , Qt.UserRole).toString()))
shared.config.set('bitmessagesettings', 'identiconsuffix', str(
self.settingsDialogInstance.ui.lineEditIdenticonSuffix.text()))
shared.config.set('bitmessagesettings', 'avatars', str(
self.settingsDialogInstance.ui.checkBoxLoadAvatars.isChecked()))
if int(shared.config.get('bitmessagesettings', 'port')) != int(self.settingsDialogInstance.ui.lineEditTCPPort.text()): if int(shared.config.get('bitmessagesettings', 'port')) != int(self.settingsDialogInstance.ui.lineEditTCPPort.text()):
if not shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'): if not shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'):
QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate( QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate(
@ -2297,11 +2251,12 @@ class MyForm(QtGui.QMainWindow):
self.NewBlacklistDialogInstance = NewSubscriptionDialog(self) self.NewBlacklistDialogInstance = NewSubscriptionDialog(self)
if self.NewBlacklistDialogInstance.exec_(): if self.NewBlacklistDialogInstance.exec_():
if self.NewBlacklistDialogInstance.ui.labelSubscriptionAddressCheck.text() == _translate("MainWindow", "Address is valid."): if self.NewBlacklistDialogInstance.ui.labelSubscriptionAddressCheck.text() == _translate("MainWindow", "Address is valid."):
address = addBMIfNotPresent(str(
self.NewBlacklistDialogInstance.ui.lineEditSubscriptionAddress.text()))
# First we must check to see if the address is already in the # First we must check to see if the address is already in the
# address book. The user cannot add it again or else it will # address book. The user cannot add it again or else it will
# cause problems when updating and deleting the entry. # cause problems when updating and deleting the entry.
t = (addBMIfNotPresent(str( t = (address,)
self.NewBlacklistDialogInstance.ui.lineEditSubscriptionAddress.text())),)
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black': if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sql = '''select * from blacklist where address=?''' sql = '''select * from blacklist where address=?'''
else: else:
@ -2312,15 +2267,14 @@ class MyForm(QtGui.QMainWindow):
self.ui.tableWidgetBlacklist.insertRow(0) self.ui.tableWidgetBlacklist.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode( newItem = QtGui.QTableWidgetItem(unicode(
self.NewBlacklistDialogInstance.ui.newsubscriptionlabel.text().toUtf8(), 'utf-8')) self.NewBlacklistDialogInstance.ui.newsubscriptionlabel.text().toUtf8(), 'utf-8'))
newItem.setIcon(avatarize(address))
self.ui.tableWidgetBlacklist.setItem(0, 0, newItem) self.ui.tableWidgetBlacklist.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(addBMIfNotPresent( newItem = QtGui.QTableWidgetItem(address)
self.NewBlacklistDialogInstance.ui.lineEditSubscriptionAddress.text()))
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetBlacklist.setItem(0, 1, newItem) self.ui.tableWidgetBlacklist.setItem(0, 1, newItem)
self.ui.tableWidgetBlacklist.setSortingEnabled(True) self.ui.tableWidgetBlacklist.setSortingEnabled(True)
t = (str(self.NewBlacklistDialogInstance.ui.newsubscriptionlabel.text().toUtf8()), addBMIfNotPresent( t = (str(self.NewBlacklistDialogInstance.ui.newsubscriptionlabel.text().toUtf8()), address, True)
str(self.NewBlacklistDialogInstance.ui.lineEditSubscriptionAddress.text())), True)
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black': if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sql = '''INSERT INTO blacklist VALUES (?,?,?)''' sql = '''INSERT INTO blacklist VALUES (?,?,?)'''
else: else:
@ -2529,6 +2483,7 @@ class MyForm(QtGui.QMainWindow):
newItem = QtGui.QTableWidgetItem( newItem = QtGui.QTableWidgetItem(
'--New entry. Change label in Address Book.--') '--New entry. Change label in Address Book.--')
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem) self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
newItem.setIcon(avatarize(addressAtCurrentInboxRow))
newItem = QtGui.QTableWidgetItem(addressAtCurrentInboxRow) newItem = QtGui.QTableWidgetItem(addressAtCurrentInboxRow)
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
@ -2880,10 +2835,11 @@ class MyForm(QtGui.QMainWindow):
def on_action_SetAvatar(self, thisTableWidget): def on_action_SetAvatar(self, thisTableWidget):
# thisTableWidget = self.ui.tableWidgetYourIdentities # thisTableWidget = self.ui.tableWidgetYourIdentities
if not os.path.exists(shared.appdata + 'avatars/'):
os.makedirs(shared.appdata + 'avatars/')
currentRow = thisTableWidget.currentRow() currentRow = thisTableWidget.currentRow()
addressAtCurrentRow = thisTableWidget.item( addressAtCurrentRow = thisTableWidget.item(
currentRow, 1).text() currentRow, 1).text()
import hashlib
hash = hashlib.md5(addBMIfNotPresent(addressAtCurrentRow)).hexdigest() hash = hashlib.md5(addBMIfNotPresent(addressAtCurrentRow)).hexdigest()
extensions = ['PNG', 'GIF', 'JPG', 'JPEG', 'SVG', 'BMP', 'MNG', 'PBM', 'PGM', 'PPM', 'TIFF', 'XBM', 'XPM', 'TGA'] extensions = ['PNG', 'GIF', 'JPG', 'JPEG', 'SVG', 'BMP', 'MNG', 'PBM', 'PGM', 'PPM', 'TIFF', 'XBM', 'XPM', 'TGA']
# http://pyqt.sourceforge.net/Docs/PyQt4/qimagereader.html#supportedImageFormats # http://pyqt.sourceforge.net/Docs/PyQt4/qimagereader.html#supportedImageFormats
@ -2938,7 +2894,6 @@ class MyForm(QtGui.QMainWindow):
# set the icon # set the icon
thisTableWidget.item( thisTableWidget.item(
currentRow, 0).setIcon(avatarize(addressAtCurrentRow)) currentRow, 0).setIcon(avatarize(addressAtCurrentRow))
shared.reloadBroadcastSendersForWhichImWatching()
self.rerenderSubscriptions() self.rerenderSubscriptions()
self.rerenderComboBoxSendFrom() self.rerenderComboBoxSendFrom()
self.rerenderInboxFromLabels() self.rerenderInboxFromLabels()
@ -3001,6 +2956,7 @@ class MyForm(QtGui.QMainWindow):
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
messageText, = row messageText, = row
messageText = shared.fixPotentiallyInvalidUTF8Data(messageText)
messageText = unicode(messageText, 'utf-8)') messageText = unicode(messageText, 'utf-8)')
if len(messageText) > 30000: if len(messageText) > 30000:
messageText = ( messageText = (
@ -3090,7 +3046,6 @@ class MyForm(QtGui.QMainWindow):
self.ui.tableWidgetYourIdentities.setItem( self.ui.tableWidgetYourIdentities.setItem(
0, 0, newItem) 0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address) newItem = QtGui.QTableWidgetItem(address)
newItem.setIcon(identiconize(address))
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if shared.safeConfigGetBoolean(address, 'chan'): if shared.safeConfigGetBoolean(address, 'chan'):
@ -3166,6 +3121,8 @@ class settingsDialog(QtGui.QDialog):
shared.config.getboolean('bitmessagesettings', 'startintray')) shared.config.getboolean('bitmessagesettings', 'startintray'))
self.ui.checkBoxWillinglySendToMobile.setChecked( self.ui.checkBoxWillinglySendToMobile.setChecked(
shared.safeConfigGetBoolean('bitmessagesettings', 'willinglysendtomobile')) shared.safeConfigGetBoolean('bitmessagesettings', 'willinglysendtomobile'))
self.ui.checkBoxUseIdenticons.setChecked(
shared.safeConfigGetBoolean('bitmessagesettings', 'useidenticons'))
global languages global languages
languages = ['system','en','eo','fr','de','es','ru','en_pirate','other'] languages = ['system','en','eo','fr','de','es','ru','en_pirate','other']
@ -3176,18 +3133,6 @@ class settingsDialog(QtGui.QDialog):
curr_index = languages.index('other') curr_index = languages.index('other')
self.ui.languageComboBox.setCurrentIndex(curr_index) self.ui.languageComboBox.setCurrentIndex(curr_index)
self.ui.comboBoxIdenticonStyle.addItem(_translate("settingsDialog", "None"), "none")
self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon.png"), _translate("settingsDialog", "QIdenticon"), "qidenticon")
self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon_x.png"), _translate("settingsDialog", "QIdenticon (transparent)"), "qidenticon_x")
self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon_two.png"), _translate("settingsDialog", "QIdenticon bicolored"), "qidenticon_two")
self.ui.comboBoxIdenticonStyle.addItem(QIcon(":/newPrefix/images/qidenticon_two_x.png"), _translate("settingsDialog", "QIdenticon bicolored (transparent)"), "qidenticon_two_x")
curr_index = self.ui.comboBoxIdenticonStyle.findData(str(shared.config.get('bitmessagesettings', 'identicon')), Qt.UserRole)
self.ui.comboBoxIdenticonStyle.setCurrentIndex(curr_index)
self.ui.lineEditIdenticonSuffix.setText(
str(shared.config.get('bitmessagesettings', 'identiconsuffix')))
self.ui.checkBoxLoadAvatars.setChecked(
shared.safeConfigGetBoolean('bitmessagesettings', 'avatars'))
if shared.appdata == '': if shared.appdata == '':
self.ui.checkBoxPortableMode.setChecked(True) self.ui.checkBoxPortableMode.setChecked(True)
if 'darwin' in sys.platform: if 'darwin' in sys.platform:
@ -3199,8 +3144,6 @@ class settingsDialog(QtGui.QDialog):
elif 'linux' in sys.platform: elif 'linux' in sys.platform:
self.ui.checkBoxStartOnLogon.setDisabled(True) self.ui.checkBoxStartOnLogon.setDisabled(True)
self.ui.checkBoxMinimizeToTray.setDisabled(True) self.ui.checkBoxMinimizeToTray.setDisabled(True)
self.ui.labelSettingsNote.setText(_translate(
"MainWindow", "Options have been disabled because they either aren\'t applicable or because they haven\'t yet been implemented for your operating system."))
# On the Network settings tab: # On the Network settings tab:
self.ui.lineEditTCPPort.setText(str( self.ui.lineEditTCPPort.setText(str(
shared.config.get('bitmessagesettings', 'port'))) shared.config.get('bitmessagesettings', 'port')))

View File

@ -2,8 +2,8 @@
# Form implementation generated from reading ui file 'settings.ui' # Form implementation generated from reading ui file 'settings.ui'
# #
# Created: Sat Sep 21 16:16:22 2013 # Created: Fri Nov 1 19:14:45 2013
# by: PyQt4 UI code generator 4.10.2 # by: PyQt4 UI code generator 4.10
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -26,7 +26,7 @@ except AttributeError:
class Ui_settingsDialog(object): class Ui_settingsDialog(object):
def setupUi(self, settingsDialog): def setupUi(self, settingsDialog):
settingsDialog.setObjectName(_fromUtf8("settingsDialog")) settingsDialog.setObjectName(_fromUtf8("settingsDialog"))
settingsDialog.resize(600, 407) settingsDialog.resize(646, 473)
self.gridLayout = QtGui.QGridLayout(settingsDialog) self.gridLayout = QtGui.QGridLayout(settingsDialog)
self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
self.buttonBox = QtGui.QDialogButtonBox(settingsDialog) self.buttonBox = QtGui.QDialogButtonBox(settingsDialog)
@ -39,12 +39,43 @@ class Ui_settingsDialog(object):
self.tabUserInterface = QtGui.QWidget() self.tabUserInterface = QtGui.QWidget()
self.tabUserInterface.setEnabled(True) self.tabUserInterface.setEnabled(True)
self.tabUserInterface.setObjectName(_fromUtf8("tabUserInterface")) self.tabUserInterface.setObjectName(_fromUtf8("tabUserInterface"))
self.gridLayout_5 = QtGui.QGridLayout(self.tabUserInterface) self.formLayout = QtGui.QFormLayout(self.tabUserInterface)
self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5")) self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.checkBoxStartOnLogon = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxStartOnLogon.setObjectName(_fromUtf8("checkBoxStartOnLogon"))
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.checkBoxStartOnLogon)
self.checkBoxStartInTray = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxStartInTray.setObjectName(_fromUtf8("checkBoxStartInTray"))
self.formLayout.setWidget(1, QtGui.QFormLayout.SpanningRole, self.checkBoxStartInTray)
self.checkBoxMinimizeToTray = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxMinimizeToTray.setChecked(True)
self.checkBoxMinimizeToTray.setObjectName(_fromUtf8("checkBoxMinimizeToTray"))
self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.checkBoxMinimizeToTray)
self.checkBoxShowTrayNotifications = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxShowTrayNotifications.setObjectName(_fromUtf8("checkBoxShowTrayNotifications"))
self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.checkBoxShowTrayNotifications)
self.checkBoxPortableMode = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxPortableMode.setObjectName(_fromUtf8("checkBoxPortableMode"))
self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.checkBoxPortableMode)
self.PortableModeDescription = QtGui.QLabel(self.tabUserInterface)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.PortableModeDescription.sizePolicy().hasHeightForWidth())
self.PortableModeDescription.setSizePolicy(sizePolicy)
self.PortableModeDescription.setWordWrap(True)
self.PortableModeDescription.setObjectName(_fromUtf8("PortableModeDescription"))
self.formLayout.setWidget(5, QtGui.QFormLayout.SpanningRole, self.PortableModeDescription)
self.checkBoxWillinglySendToMobile = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxWillinglySendToMobile.setObjectName(_fromUtf8("checkBoxWillinglySendToMobile"))
self.formLayout.setWidget(6, QtGui.QFormLayout.SpanningRole, self.checkBoxWillinglySendToMobile)
self.checkBoxUseIdenticons = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxUseIdenticons.setObjectName(_fromUtf8("checkBoxUseIdenticons"))
self.formLayout.setWidget(7, QtGui.QFormLayout.LabelRole, self.checkBoxUseIdenticons)
self.groupBox = QtGui.QGroupBox(self.tabUserInterface) self.groupBox = QtGui.QGroupBox(self.tabUserInterface)
self.groupBox.setObjectName(_fromUtf8("groupBox")) self.groupBox.setObjectName(_fromUtf8("groupBox"))
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.groupBox) self.formLayout_2 = QtGui.QFormLayout(self.groupBox)
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.formLayout_2.setObjectName(_fromUtf8("formLayout_2"))
self.languageComboBox = QtGui.QComboBox(self.groupBox) self.languageComboBox = QtGui.QComboBox(self.groupBox)
self.languageComboBox.setMinimumSize(QtCore.QSize(100, 0)) self.languageComboBox.setMinimumSize(QtCore.QSize(100, 0))
self.languageComboBox.setObjectName(_fromUtf8("languageComboBox")) self.languageComboBox.setObjectName(_fromUtf8("languageComboBox"))
@ -57,63 +88,8 @@ class Ui_settingsDialog(object):
self.languageComboBox.addItem(_fromUtf8("")) self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8("")) self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8("")) self.languageComboBox.addItem(_fromUtf8(""))
self.horizontalLayout_2.addWidget(self.languageComboBox) self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.languageComboBox)
self.gridLayout_5.addWidget(self.groupBox, 7, 1, 4, 1) self.formLayout.setWidget(8, QtGui.QFormLayout.FieldRole, self.groupBox)
self.checkBoxMinimizeToTray = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxMinimizeToTray.setChecked(True)
self.checkBoxMinimizeToTray.setObjectName(_fromUtf8("checkBoxMinimizeToTray"))
self.gridLayout_5.addWidget(self.checkBoxMinimizeToTray, 2, 0, 1, 1)
self.checkBoxStartOnLogon = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxStartOnLogon.setObjectName(_fromUtf8("checkBoxStartOnLogon"))
self.gridLayout_5.addWidget(self.checkBoxStartOnLogon, 0, 0, 1, 1)
self.checkBoxShowTrayNotifications = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxShowTrayNotifications.setObjectName(_fromUtf8("checkBoxShowTrayNotifications"))
self.gridLayout_5.addWidget(self.checkBoxShowTrayNotifications, 3, 0, 1, 1)
self.checkBoxPortableMode = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxPortableMode.setObjectName(_fromUtf8("checkBoxPortableMode"))
self.gridLayout_5.addWidget(self.checkBoxPortableMode, 4, 0, 1, 1)
self.checkBoxStartInTray = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxStartInTray.setObjectName(_fromUtf8("checkBoxStartInTray"))
self.gridLayout_5.addWidget(self.checkBoxStartInTray, 1, 0, 1, 1)
self.PortableModeDescription = QtGui.QLabel(self.tabUserInterface)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.PortableModeDescription.sizePolicy().hasHeightForWidth())
self.PortableModeDescription.setSizePolicy(sizePolicy)
self.PortableModeDescription.setWordWrap(True)
self.PortableModeDescription.setObjectName(_fromUtf8("PortableModeDescription"))
self.gridLayout_5.addWidget(self.PortableModeDescription, 5, 0, 1, 2)
self.checkBoxWillinglySendToMobile = QtGui.QCheckBox(self.tabUserInterface)
self.checkBoxWillinglySendToMobile.setObjectName(_fromUtf8("checkBoxWillinglySendToMobile"))
self.gridLayout_5.addWidget(self.checkBoxWillinglySendToMobile, 6, 0, 1, 2)
self.groupBox_3 = QtGui.QGroupBox(self.tabUserInterface)
self.groupBox_3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.groupBox_3.setFlat(False)
self.groupBox_3.setCheckable(False)
self.groupBox_3.setObjectName(_fromUtf8("groupBox_3"))
self.gridLayout_9 = QtGui.QGridLayout(self.groupBox_3)
self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9"))
self.checkBoxLoadAvatars = QtGui.QCheckBox(self.groupBox_3)
self.checkBoxLoadAvatars.setObjectName(_fromUtf8("checkBoxLoadAvatars"))
self.gridLayout_9.addWidget(self.checkBoxLoadAvatars, 1, 0, 1, 1)
self.lineEditIdenticonSuffix = QtGui.QLineEdit(self.groupBox_3)
self.lineEditIdenticonSuffix.setObjectName(_fromUtf8("lineEditIdenticonSuffix"))
self.gridLayout_9.addWidget(self.lineEditIdenticonSuffix, 1, 1, 1, 1)
self.comboBoxIdenticonStyle = QtGui.QComboBox(self.groupBox_3)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.comboBoxIdenticonStyle.sizePolicy().hasHeightForWidth())
self.comboBoxIdenticonStyle.setSizePolicy(sizePolicy)
self.comboBoxIdenticonStyle.setIconSize(QtCore.QSize(24, 24))
self.comboBoxIdenticonStyle.setObjectName(_fromUtf8("comboBoxIdenticonStyle"))
self.gridLayout_9.addWidget(self.comboBoxIdenticonStyle, 0, 0, 1, 2)
self.gridLayout_5.addWidget(self.groupBox_3, 7, 0, 5, 1)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout_5.addItem(spacerItem, 12, 0, 1, 1)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout_5.addItem(spacerItem1, 11, 1, 2, 1)
self.tabWidgetSettings.addTab(self.tabUserInterface, _fromUtf8("")) self.tabWidgetSettings.addTab(self.tabUserInterface, _fromUtf8(""))
self.tabNetworkSettings = QtGui.QWidget() self.tabNetworkSettings = QtGui.QWidget()
self.tabNetworkSettings.setObjectName(_fromUtf8("tabNetworkSettings")) self.tabNetworkSettings.setObjectName(_fromUtf8("tabNetworkSettings"))
@ -123,8 +99,8 @@ class Ui_settingsDialog(object):
self.groupBox1.setObjectName(_fromUtf8("groupBox1")) self.groupBox1.setObjectName(_fromUtf8("groupBox1"))
self.gridLayout_3 = QtGui.QGridLayout(self.groupBox1) self.gridLayout_3 = QtGui.QGridLayout(self.groupBox1)
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3")) self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
spacerItem2 = QtGui.QSpacerItem(125, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem = QtGui.QSpacerItem(125, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_3.addItem(spacerItem2, 0, 0, 1, 1) self.gridLayout_3.addItem(spacerItem, 0, 0, 1, 1)
self.label = QtGui.QLabel(self.groupBox1) self.label = QtGui.QLabel(self.groupBox1)
self.label.setObjectName(_fromUtf8("label")) self.label.setObjectName(_fromUtf8("label"))
self.gridLayout_3.addWidget(self.label, 0, 1, 1, 1) self.gridLayout_3.addWidget(self.label, 0, 1, 1, 1)
@ -181,8 +157,8 @@ class Ui_settingsDialog(object):
self.comboBoxProxyType.addItem(_fromUtf8("")) self.comboBoxProxyType.addItem(_fromUtf8(""))
self.gridLayout_2.addWidget(self.comboBoxProxyType, 0, 1, 1, 1) self.gridLayout_2.addWidget(self.comboBoxProxyType, 0, 1, 1, 1)
self.gridLayout_4.addWidget(self.groupBox_2, 1, 0, 1, 1) self.gridLayout_4.addWidget(self.groupBox_2, 1, 0, 1, 1)
spacerItem3 = QtGui.QSpacerItem(20, 70, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) spacerItem1 = QtGui.QSpacerItem(20, 70, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout_4.addItem(spacerItem3, 2, 0, 1, 1) self.gridLayout_4.addItem(spacerItem1, 2, 0, 1, 1)
self.tabWidgetSettings.addTab(self.tabNetworkSettings, _fromUtf8("")) self.tabWidgetSettings.addTab(self.tabNetworkSettings, _fromUtf8(""))
self.tab = QtGui.QWidget() self.tab = QtGui.QWidget()
self.tab.setObjectName(_fromUtf8("tab")) self.tab.setObjectName(_fromUtf8("tab"))
@ -192,8 +168,8 @@ class Ui_settingsDialog(object):
self.label_8.setWordWrap(True) self.label_8.setWordWrap(True)
self.label_8.setObjectName(_fromUtf8("label_8")) self.label_8.setObjectName(_fromUtf8("label_8"))
self.gridLayout_6.addWidget(self.label_8, 0, 0, 1, 3) self.gridLayout_6.addWidget(self.label_8, 0, 0, 1, 3)
spacerItem4 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem2 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_6.addItem(spacerItem4, 1, 0, 1, 1) self.gridLayout_6.addItem(spacerItem2, 1, 0, 1, 1)
self.label_9 = QtGui.QLabel(self.tab) self.label_9 = QtGui.QLabel(self.tab)
self.label_9.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_9.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label_9.setObjectName(_fromUtf8("label_9")) self.label_9.setObjectName(_fromUtf8("label_9"))
@ -207,8 +183,8 @@ class Ui_settingsDialog(object):
self.lineEditTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215)) self.lineEditTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
self.lineEditTotalDifficulty.setObjectName(_fromUtf8("lineEditTotalDifficulty")) self.lineEditTotalDifficulty.setObjectName(_fromUtf8("lineEditTotalDifficulty"))
self.gridLayout_6.addWidget(self.lineEditTotalDifficulty, 1, 2, 1, 1) self.gridLayout_6.addWidget(self.lineEditTotalDifficulty, 1, 2, 1, 1)
spacerItem5 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem3 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_6.addItem(spacerItem5, 3, 0, 1, 1) self.gridLayout_6.addItem(spacerItem3, 3, 0, 1, 1)
self.label_11 = QtGui.QLabel(self.tab) self.label_11 = QtGui.QLabel(self.tab)
self.label_11.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_11.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label_11.setObjectName(_fromUtf8("label_11")) self.label_11.setObjectName(_fromUtf8("label_11"))
@ -239,8 +215,8 @@ class Ui_settingsDialog(object):
self.label_15.setWordWrap(True) self.label_15.setWordWrap(True)
self.label_15.setObjectName(_fromUtf8("label_15")) self.label_15.setObjectName(_fromUtf8("label_15"))
self.gridLayout_7.addWidget(self.label_15, 0, 0, 1, 3) self.gridLayout_7.addWidget(self.label_15, 0, 0, 1, 3)
spacerItem6 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem4 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_7.addItem(spacerItem6, 1, 0, 1, 1) self.gridLayout_7.addItem(spacerItem4, 1, 0, 1, 1)
self.label_13 = QtGui.QLabel(self.tab_2) self.label_13 = QtGui.QLabel(self.tab_2)
self.label_13.setLayoutDirection(QtCore.Qt.LeftToRight) self.label_13.setLayoutDirection(QtCore.Qt.LeftToRight)
self.label_13.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_13.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
@ -255,8 +231,8 @@ class Ui_settingsDialog(object):
self.lineEditMaxAcceptableTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215)) self.lineEditMaxAcceptableTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
self.lineEditMaxAcceptableTotalDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableTotalDifficulty")) self.lineEditMaxAcceptableTotalDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableTotalDifficulty"))
self.gridLayout_7.addWidget(self.lineEditMaxAcceptableTotalDifficulty, 1, 2, 1, 1) self.gridLayout_7.addWidget(self.lineEditMaxAcceptableTotalDifficulty, 1, 2, 1, 1)
spacerItem7 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem5 = QtGui.QSpacerItem(102, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_7.addItem(spacerItem7, 2, 0, 1, 1) self.gridLayout_7.addItem(spacerItem5, 2, 0, 1, 1)
self.label_14 = QtGui.QLabel(self.tab_2) self.label_14 = QtGui.QLabel(self.tab_2)
self.label_14.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_14.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label_14.setObjectName(_fromUtf8("label_14")) self.label_14.setObjectName(_fromUtf8("label_14"))
@ -270,15 +246,15 @@ class Ui_settingsDialog(object):
self.lineEditMaxAcceptableSmallMessageDifficulty.setMaximumSize(QtCore.QSize(70, 16777215)) self.lineEditMaxAcceptableSmallMessageDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
self.lineEditMaxAcceptableSmallMessageDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableSmallMessageDifficulty")) self.lineEditMaxAcceptableSmallMessageDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableSmallMessageDifficulty"))
self.gridLayout_7.addWidget(self.lineEditMaxAcceptableSmallMessageDifficulty, 2, 2, 1, 1) self.gridLayout_7.addWidget(self.lineEditMaxAcceptableSmallMessageDifficulty, 2, 2, 1, 1)
spacerItem8 = QtGui.QSpacerItem(20, 147, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) spacerItem6 = QtGui.QSpacerItem(20, 147, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout_7.addItem(spacerItem8, 3, 1, 1, 1) self.gridLayout_7.addItem(spacerItem6, 3, 1, 1, 1)
self.tabWidgetSettings.addTab(self.tab_2, _fromUtf8("")) self.tabWidgetSettings.addTab(self.tab_2, _fromUtf8(""))
self.tabNamecoin = QtGui.QWidget() self.tabNamecoin = QtGui.QWidget()
self.tabNamecoin.setObjectName(_fromUtf8("tabNamecoin")) self.tabNamecoin.setObjectName(_fromUtf8("tabNamecoin"))
self.gridLayout_8 = QtGui.QGridLayout(self.tabNamecoin) self.gridLayout_8 = QtGui.QGridLayout(self.tabNamecoin)
self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8")) self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8"))
spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem7 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_8.addItem(spacerItem9, 2, 0, 1, 1) self.gridLayout_8.addItem(spacerItem7, 2, 0, 1, 1)
self.label_16 = QtGui.QLabel(self.tabNamecoin) self.label_16 = QtGui.QLabel(self.tabNamecoin)
self.label_16.setWordWrap(True) self.label_16.setWordWrap(True)
self.label_16.setObjectName(_fromUtf8("label_16")) self.label_16.setObjectName(_fromUtf8("label_16"))
@ -290,10 +266,10 @@ class Ui_settingsDialog(object):
self.lineEditNamecoinHost = QtGui.QLineEdit(self.tabNamecoin) self.lineEditNamecoinHost = QtGui.QLineEdit(self.tabNamecoin)
self.lineEditNamecoinHost.setObjectName(_fromUtf8("lineEditNamecoinHost")) self.lineEditNamecoinHost.setObjectName(_fromUtf8("lineEditNamecoinHost"))
self.gridLayout_8.addWidget(self.lineEditNamecoinHost, 2, 2, 1, 1) self.gridLayout_8.addWidget(self.lineEditNamecoinHost, 2, 2, 1, 1)
spacerItem10 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_8.addItem(spacerItem10, 3, 0, 1, 1) self.gridLayout_8.addItem(spacerItem8, 3, 0, 1, 1)
spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_8.addItem(spacerItem11, 4, 0, 1, 1) self.gridLayout_8.addItem(spacerItem9, 4, 0, 1, 1)
self.label_18 = QtGui.QLabel(self.tabNamecoin) self.label_18 = QtGui.QLabel(self.tabNamecoin)
self.label_18.setEnabled(True) self.label_18.setEnabled(True)
self.label_18.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.label_18.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
@ -302,8 +278,8 @@ class Ui_settingsDialog(object):
self.lineEditNamecoinPort = QtGui.QLineEdit(self.tabNamecoin) self.lineEditNamecoinPort = QtGui.QLineEdit(self.tabNamecoin)
self.lineEditNamecoinPort.setObjectName(_fromUtf8("lineEditNamecoinPort")) self.lineEditNamecoinPort.setObjectName(_fromUtf8("lineEditNamecoinPort"))
self.gridLayout_8.addWidget(self.lineEditNamecoinPort, 3, 2, 1, 1) self.gridLayout_8.addWidget(self.lineEditNamecoinPort, 3, 2, 1, 1)
spacerItem12 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) spacerItem10 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout_8.addItem(spacerItem12, 8, 1, 1, 1) self.gridLayout_8.addItem(spacerItem10, 8, 1, 1, 1)
self.labelNamecoinUser = QtGui.QLabel(self.tabNamecoin) self.labelNamecoinUser = QtGui.QLabel(self.tabNamecoin)
self.labelNamecoinUser.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelNamecoinUser.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.labelNamecoinUser.setObjectName(_fromUtf8("labelNamecoinUser")) self.labelNamecoinUser.setObjectName(_fromUtf8("labelNamecoinUser"))
@ -311,8 +287,8 @@ class Ui_settingsDialog(object):
self.lineEditNamecoinUser = QtGui.QLineEdit(self.tabNamecoin) self.lineEditNamecoinUser = QtGui.QLineEdit(self.tabNamecoin)
self.lineEditNamecoinUser.setObjectName(_fromUtf8("lineEditNamecoinUser")) self.lineEditNamecoinUser.setObjectName(_fromUtf8("lineEditNamecoinUser"))
self.gridLayout_8.addWidget(self.lineEditNamecoinUser, 4, 2, 1, 1) self.gridLayout_8.addWidget(self.lineEditNamecoinUser, 4, 2, 1, 1)
spacerItem13 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_8.addItem(spacerItem13, 5, 0, 1, 1) self.gridLayout_8.addItem(spacerItem11, 5, 0, 1, 1)
self.labelNamecoinPassword = QtGui.QLabel(self.tabNamecoin) self.labelNamecoinPassword = QtGui.QLabel(self.tabNamecoin)
self.labelNamecoinPassword.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.labelNamecoinPassword.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.labelNamecoinPassword.setObjectName(_fromUtf8("labelNamecoinPassword")) self.labelNamecoinPassword.setObjectName(_fromUtf8("labelNamecoinPassword"))
@ -354,8 +330,7 @@ class Ui_settingsDialog(object):
settingsDialog.setTabOrder(self.tabWidgetSettings, self.checkBoxStartOnLogon) settingsDialog.setTabOrder(self.tabWidgetSettings, self.checkBoxStartOnLogon)
settingsDialog.setTabOrder(self.checkBoxStartOnLogon, self.checkBoxStartInTray) settingsDialog.setTabOrder(self.checkBoxStartOnLogon, self.checkBoxStartInTray)
settingsDialog.setTabOrder(self.checkBoxStartInTray, self.checkBoxMinimizeToTray) settingsDialog.setTabOrder(self.checkBoxStartInTray, self.checkBoxMinimizeToTray)
settingsDialog.setTabOrder(self.checkBoxMinimizeToTray, self.checkBoxShowTrayNotifications) settingsDialog.setTabOrder(self.checkBoxMinimizeToTray, self.lineEditTCPPort)
settingsDialog.setTabOrder(self.checkBoxShowTrayNotifications, self.lineEditTCPPort)
settingsDialog.setTabOrder(self.lineEditTCPPort, self.comboBoxProxyType) settingsDialog.setTabOrder(self.lineEditTCPPort, self.comboBoxProxyType)
settingsDialog.setTabOrder(self.comboBoxProxyType, self.lineEditSocksHostname) settingsDialog.setTabOrder(self.comboBoxProxyType, self.lineEditSocksHostname)
settingsDialog.setTabOrder(self.lineEditSocksHostname, self.lineEditSocksPort) settingsDialog.setTabOrder(self.lineEditSocksHostname, self.lineEditSocksPort)
@ -367,6 +342,14 @@ class Ui_settingsDialog(object):
def retranslateUi(self, settingsDialog): def retranslateUi(self, settingsDialog):
settingsDialog.setWindowTitle(_translate("settingsDialog", "Settings", None)) settingsDialog.setWindowTitle(_translate("settingsDialog", "Settings", None))
self.checkBoxStartOnLogon.setText(_translate("settingsDialog", "Start Bitmessage on user login", None))
self.checkBoxStartInTray.setText(_translate("settingsDialog", "Start Bitmessage in the tray (don\'t show main window)", None))
self.checkBoxMinimizeToTray.setText(_translate("settingsDialog", "Minimize to tray", None))
self.checkBoxShowTrayNotifications.setText(_translate("settingsDialog", "Show notification when message received", None))
self.checkBoxPortableMode.setText(_translate("settingsDialog", "Run in Portable Mode", None))
self.PortableModeDescription.setText(_translate("settingsDialog", "In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.", None))
self.checkBoxWillinglySendToMobile.setText(_translate("settingsDialog", "Willingly include unencrypted destination address when sending to a mobile device", None))
self.checkBoxUseIdenticons.setText(_translate("settingsDialog", "Use Identicons", None))
self.groupBox.setTitle(_translate("settingsDialog", "Interface Language", None)) self.groupBox.setTitle(_translate("settingsDialog", "Interface Language", None))
self.languageComboBox.setItemText(0, _translate("settingsDialog", "System Settings", "system")) self.languageComboBox.setItemText(0, _translate("settingsDialog", "System Settings", "system"))
self.languageComboBox.setItemText(1, _translate("settingsDialog", "English", "en")) self.languageComboBox.setItemText(1, _translate("settingsDialog", "English", "en"))
@ -377,16 +360,6 @@ class Ui_settingsDialog(object):
self.languageComboBox.setItemText(6, _translate("settingsDialog", "русский язык", "ru")) self.languageComboBox.setItemText(6, _translate("settingsDialog", "русский язык", "ru"))
self.languageComboBox.setItemText(7, _translate("settingsDialog", "Pirate English", "en_pirate")) self.languageComboBox.setItemText(7, _translate("settingsDialog", "Pirate English", "en_pirate"))
self.languageComboBox.setItemText(8, _translate("settingsDialog", "Other (set in keys.dat)", "other")) self.languageComboBox.setItemText(8, _translate("settingsDialog", "Other (set in keys.dat)", "other"))
self.checkBoxMinimizeToTray.setText(_translate("settingsDialog", "Minimize to tray", None))
self.checkBoxStartOnLogon.setText(_translate("settingsDialog", "Start Bitmessage on user login", None))
self.checkBoxShowTrayNotifications.setText(_translate("settingsDialog", "Show notification when message received", None))
self.checkBoxPortableMode.setText(_translate("settingsDialog", "Run in Portable Mode", None))
self.checkBoxStartInTray.setText(_translate("settingsDialog", "Start Bitmessage in the tray (don\'t show main window)", None))
self.PortableModeDescription.setText(_translate("settingsDialog", "In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.", None))
self.checkBoxWillinglySendToMobile.setText(_translate("settingsDialog", "Willingly include unencrypted destination address when sending to a mobile device", None))
self.groupBox_3.setTitle(_translate("settingsDialog", "Identicons (with example image)", None))
self.checkBoxLoadAvatars.setText(_translate("settingsDialog", "Load avatar images", None))
self.lineEditIdenticonSuffix.setToolTip(_translate("settingsDialog", "<html><head/><body><p>The content of this text field will be appended to the BM-address before creating the hash for the identicons. By default it is filled with a random string to make the identicons in your client unique, otherwise the identicon could be an attack vector if an adversary creates an address resulting in a similar identicon. If you keep this string (or any other random or non-random string) you will be able to keep the same identicons.</p></body></html>", None))
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabUserInterface), _translate("settingsDialog", "User Interface", None)) self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabUserInterface), _translate("settingsDialog", "User Interface", None))
self.groupBox1.setTitle(_translate("settingsDialog", "Listening port", None)) self.groupBox1.setTitle(_translate("settingsDialog", "Listening port", None))
self.label.setText(_translate("settingsDialog", "Listen for connections on port:", None)) self.label.setText(_translate("settingsDialog", "Listen for connections on port:", None))
@ -424,13 +397,3 @@ class Ui_settingsDialog(object):
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabNamecoin), _translate("settingsDialog", "Namecoin integration", None)) self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabNamecoin), _translate("settingsDialog", "Namecoin integration", None))
import bitmessage_icons_rc import bitmessage_icons_rc
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
settingsDialog = QtGui.QDialog()
ui = Ui_settingsDialog()
ui.setupUi(settingsDialog)
settingsDialog.show()
sys.exit(app.exec_())

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>600</width> <width>646</width>
<height>407</height> <height>473</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -36,14 +36,82 @@
<attribute name="title"> <attribute name="title">
<string>User Interface</string> <string>User Interface</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QFormLayout" name="formLayout">
<item row="7" column="1" rowspan="4"> <item row="0" column="0">
<widget class="QCheckBox" name="checkBoxStartOnLogon">
<property name="text">
<string>Start Bitmessage on user login</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxStartInTray">
<property name="text">
<string>Start Bitmessage in the tray (don't show main window)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxMinimizeToTray">
<property name="text">
<string>Minimize to tray</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxShowTrayNotifications">
<property name="text">
<string>Show notification when message received</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxPortableMode">
<property name="text">
<string>Run in Portable Mode</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="PortableModeDescription">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxWillinglySendToMobile">
<property name="text">
<string>Willingly include unencrypted destination address when sending to a mobile device</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="checkBoxUseIdenticons">
<property name="text">
<string>Use Identicons</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>Interface Language</string> <string>Interface Language</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QFormLayout" name="formLayout_2">
<item> <item row="0" column="0">
<widget class="QComboBox" name="languageComboBox"> <widget class="QComboBox" name="languageComboBox">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -101,141 +169,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxMinimizeToTray">
<property name="text">
<string>Minimize to tray</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBoxStartOnLogon">
<property name="text">
<string>Start Bitmessage on user login</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxShowTrayNotifications">
<property name="text">
<string>Show notification when message received</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxPortableMode">
<property name="text">
<string>Run in Portable Mode</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxStartInTray">
<property name="text">
<string>Start Bitmessage in the tray (don't show main window)</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="PortableModeDescription">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>In Portable Mode, messages and config files are stored in the same directory as the program rather than the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxWillinglySendToMobile">
<property name="text">
<string>Willingly include unencrypted destination address when sending to a mobile device</string>
</property>
</widget>
</item>
<item row="7" column="0" rowspan="5">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Identicons (with example image)</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_9">
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxLoadAvatars">
<property name="text">
<string>Load avatar images</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditIdenticonSuffix">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The content of this text field will be appended to the BM-address before creating the hash for the identicons. By default it is filled with a random string to make the identicons in your client unique, otherwise the identicon could be an attack vector if an adversary creates an address resulting in a similar identicon. If you keep this string (or any other random or non-random string) you will be able to keep the same identicons.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QComboBox" name="comboBoxIdenticonStyle">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="12" column="0">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="1" rowspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tabNetworkSettings"> <widget class="QWidget" name="tabNetworkSettings">
@ -818,7 +751,6 @@
<tabstop>checkBoxStartOnLogon</tabstop> <tabstop>checkBoxStartOnLogon</tabstop>
<tabstop>checkBoxStartInTray</tabstop> <tabstop>checkBoxStartInTray</tabstop>
<tabstop>checkBoxMinimizeToTray</tabstop> <tabstop>checkBoxMinimizeToTray</tabstop>
<tabstop>checkBoxShowTrayNotifications</tabstop>
<tabstop>lineEditTCPPort</tabstop> <tabstop>lineEditTCPPort</tabstop>
<tabstop>comboBoxProxyType</tabstop> <tabstop>comboBoxProxyType</tabstop>
<tabstop>lineEditSocksHostname</tabstop> <tabstop>lineEditSocksHostname</tabstop>

View File

@ -7,6 +7,8 @@ import sys
import os import os
from debug import logger from debug import logger
from namecoin import ensureNamecoinOptions from namecoin import ensureNamecoinOptions
import random
import string
import tr#anslate import tr#anslate
# This thread exists because SQLITE3 is so un-threadsafe that we must # This thread exists because SQLITE3 is so un-threadsafe that we must
@ -242,13 +244,6 @@ class sqlThread(threading.Thread):
if not shared.config.has_option('bitmessagesettings', 'userlocale'): if not shared.config.has_option('bitmessagesettings', 'userlocale'):
shared.config.set('bitmessagesettings', 'userlocale', 'system') shared.config.set('bitmessagesettings', 'userlocale', 'system')
if not shared.config.has_option('bitmessagesettings', 'identicon'):
shared.config.set('bitmessagesettings', 'identicon', 'None')
if not shared.config.has_option('bitmessagesettings', 'identiconsuffix'):
import random, string
shared.config.set('bitmessagesettings', 'identiconsuffix', ''.join(random.choice("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") for x in range(12))) # a twelve character pseudo-password to salt the identicons
if not shared.config.has_option('bitmessagesettings', 'avatars'):
shared.config.set('bitmessagesettings', 'avatars', 'false')
if not shared.config.has_option('bitmessagesettings', 'sendoutgoingconnections'): if not shared.config.has_option('bitmessagesettings', 'sendoutgoingconnections'):
shared.config.set('bitmessagesettings', 'sendoutgoingconnections', 'True') shared.config.set('bitmessagesettings', 'sendoutgoingconnections', 'True')
@ -275,6 +270,13 @@ class sqlThread(threading.Thread):
item = '''update settings set value=? WHERE key='version';''' item = '''update settings set value=? WHERE key='version';'''
parameters = (5,) parameters = (5,)
self.cur.execute(item, parameters) self.cur.execute(item, parameters)
if not shared.config.has_option('bitmessagesettings', 'useidenticons'):
shared.config.set('bitmessagesettings', 'useidenticons', 'True')
if not shared.config.has_option('bitmessagesettings', 'identiconsuffix'): # acts as a salt
shared.config.set('bitmessagesettings', 'identiconsuffix', ''.join(random.choice("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") for x in range(12))) # a twelve character pseudo-password to salt the identicons
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile)
# Are you hoping to add a new option to the keys.dat file of existing # Are you hoping to add a new option to the keys.dat file of existing
# Bitmessage users? Add it right above this line! # Bitmessage users? Add it right above this line!

View File

@ -3,6 +3,8 @@ import ConfigParser
import sys import sys
import os import os
import locale import locale
import random
import string
from namecoin import ensureNamecoinOptions from namecoin import ensureNamecoinOptions
@ -84,10 +86,8 @@ def loadConfig():
'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', '0') 'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', '0')
shared.config.set('bitmessagesettings', 'dontconnect', 'true') shared.config.set('bitmessagesettings', 'dontconnect', 'true')
shared.config.set('bitmessagesettings', 'userlocale', 'system') shared.config.set('bitmessagesettings', 'userlocale', 'system')
shared.config.set('bitmessagesettings', 'identicon', 'None') shared.config.set('bitmessagesettings', 'useidenticons', 'True')
import random, string
shared.config.set('bitmessagesettings', 'identiconsuffix', ''.join(random.choice("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") for x in range(12))) # a twelve character pseudo-password to salt the identicons shared.config.set('bitmessagesettings', 'identiconsuffix', ''.join(random.choice("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") for x in range(12))) # a twelve character pseudo-password to salt the identicons
shared.config.set('bitmessagesettings', 'avatars', 'false')
# Are you hoping to add a new option to the keys.dat file? You're in # Are you hoping to add a new option to the keys.dat file? You're in
# the right place for adding it to users who install the software for # the right place for adding it to users who install the software for