Initial support for PyQt5 (main window shown) using QtPy package
This commit is contained in:
parent
73ebad4a4e
commit
4b49a2f41e
7
setup.py
7
setup.py
|
@ -1,13 +1,13 @@
|
||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python2.7
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import shutil
|
import shutil
|
||||||
from setuptools import setup, Extension
|
from setuptools import setup, Extension
|
||||||
from setuptools.command.install import install
|
from setuptools.command.install import install
|
||||||
|
|
||||||
from src.version import softwareVersion
|
from src.version import softwareVersion
|
||||||
|
|
||||||
|
|
||||||
class InstallCmd(install):
|
class InstallCmd(install):
|
||||||
def run(self):
|
def run(self):
|
||||||
# prepare icons directories
|
# prepare icons directories
|
||||||
|
@ -38,7 +38,7 @@ if __name__ == "__main__":
|
||||||
libraries=['pthread', 'crypto'],
|
libraries=['pthread', 'crypto'],
|
||||||
)
|
)
|
||||||
|
|
||||||
installRequires = []
|
installRequires = [] # QtPy
|
||||||
packages = [
|
packages = [
|
||||||
'pybitmessage',
|
'pybitmessage',
|
||||||
'pybitmessage.bitmessageqt',
|
'pybitmessage.bitmessageqt',
|
||||||
|
@ -62,7 +62,8 @@ if __name__ == "__main__":
|
||||||
import umsgpack
|
import umsgpack
|
||||||
installRequires.append("umsgpack")
|
installRequires.append("umsgpack")
|
||||||
except ImportError:
|
except ImportError:
|
||||||
packages += ['pybitmessage.fallback', 'pybitmessage.fallback.umsgpack']
|
packages += [
|
||||||
|
'pybitmessage.fallback', 'pybitmessage.fallback.umsgpack']
|
||||||
|
|
||||||
dist = setup(
|
dist = setup(
|
||||||
name='pybitmessage',
|
name='pybitmessage',
|
||||||
|
|
|
@ -19,7 +19,8 @@ sys.path.insert(0, app_dir)
|
||||||
import depends
|
import depends
|
||||||
depends.check_dependencies()
|
depends.check_dependencies()
|
||||||
|
|
||||||
import signal # Used to capture a Ctrl-C keypress so that Bitmessage can shutdown gracefully.
|
# Used to capture a Ctrl-C keypress so that Bitmessage can shutdown gracefully.
|
||||||
|
import signal
|
||||||
# The next 3 are used for the API
|
# The next 3 are used for the API
|
||||||
from singleinstance import singleinstance
|
from singleinstance import singleinstance
|
||||||
import errno
|
import errno
|
||||||
|
@ -73,17 +74,19 @@ def connectToStream(streamNumber):
|
||||||
selfInitiatedConnections[streamNumber] = {}
|
selfInitiatedConnections[streamNumber] = {}
|
||||||
|
|
||||||
if isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections():
|
if isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections():
|
||||||
# Some XP and Vista systems can only have 10 outgoing connections at a time.
|
# Some XP and Vista systems can only have 10 outgoing connections
|
||||||
|
# at a time.
|
||||||
state.maximumNumberOfHalfOpenConnections = 9
|
state.maximumNumberOfHalfOpenConnections = 9
|
||||||
else:
|
else:
|
||||||
state.maximumNumberOfHalfOpenConnections = 64
|
state.maximumNumberOfHalfOpenConnections = 64
|
||||||
try:
|
try:
|
||||||
# don't overload Tor
|
# don't overload Tor
|
||||||
if BMConfigParser().get('bitmessagesettings', 'socksproxytype') != 'none':
|
if BMConfigParser().get(
|
||||||
|
'bitmessagesettings', 'socksproxytype') != 'none':
|
||||||
state.maximumNumberOfHalfOpenConnections = 4
|
state.maximumNumberOfHalfOpenConnections = 4
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
with knownnodes.knownNodesLock:
|
with knownnodes.knownNodesLock:
|
||||||
if streamNumber not in knownnodes.knownNodes:
|
if streamNumber not in knownnodes.knownNodes:
|
||||||
knownnodes.knownNodes[streamNumber] = {}
|
knownnodes.knownNodes[streamNumber] = {}
|
||||||
|
@ -94,6 +97,7 @@ def connectToStream(streamNumber):
|
||||||
|
|
||||||
BMConnectionPool().connectToStream(streamNumber)
|
BMConnectionPool().connectToStream(streamNumber)
|
||||||
|
|
||||||
|
|
||||||
def _fixSocket():
|
def _fixSocket():
|
||||||
if sys.platform.startswith('linux'):
|
if sys.platform.startswith('linux'):
|
||||||
socket.SO_BINDTODEVICE = 25
|
socket.SO_BINDTODEVICE = 25
|
||||||
|
@ -105,6 +109,7 @@ def _fixSocket():
|
||||||
# socket.inet_ntop but we can make one ourselves using ctypes
|
# socket.inet_ntop but we can make one ourselves using ctypes
|
||||||
if not hasattr(socket, 'inet_ntop'):
|
if not hasattr(socket, 'inet_ntop'):
|
||||||
addressToString = ctypes.windll.ws2_32.WSAAddressToStringA
|
addressToString = ctypes.windll.ws2_32.WSAAddressToStringA
|
||||||
|
|
||||||
def inet_ntop(family, host):
|
def inet_ntop(family, host):
|
||||||
if family == socket.AF_INET:
|
if family == socket.AF_INET:
|
||||||
if len(host) != 4:
|
if len(host) != 4:
|
||||||
|
@ -125,6 +130,7 @@ def _fixSocket():
|
||||||
# Same for inet_pton
|
# Same for inet_pton
|
||||||
if not hasattr(socket, 'inet_pton'):
|
if not hasattr(socket, 'inet_pton'):
|
||||||
stringToAddress = ctypes.windll.ws2_32.WSAStringToAddressA
|
stringToAddress = ctypes.windll.ws2_32.WSAStringToAddressA
|
||||||
|
|
||||||
def inet_pton(family, host):
|
def inet_pton(family, host):
|
||||||
buf = "\0" * 28
|
buf = "\0" * 28
|
||||||
lengthBuf = pack("I", len(buf))
|
lengthBuf = pack("I", len(buf))
|
||||||
|
@ -148,18 +154,21 @@ def _fixSocket():
|
||||||
if not hasattr(socket, 'IPV6_V6ONLY'):
|
if not hasattr(socket, 'IPV6_V6ONLY'):
|
||||||
socket.IPV6_V6ONLY = 27
|
socket.IPV6_V6ONLY = 27
|
||||||
|
|
||||||
|
|
||||||
# This thread, of which there is only one, runs the API.
|
# This thread, of which there is only one, runs the API.
|
||||||
class singleAPI(threading.Thread, helper_threading.StoppableThread):
|
class singleAPI(threading.Thread, helper_threading.StoppableThread):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
threading.Thread.__init__(self, name="singleAPI")
|
threading.Thread.__init__(self, name="singleAPI")
|
||||||
self.initStop()
|
self.initStop()
|
||||||
|
|
||||||
def stopThread(self):
|
def stopThread(self):
|
||||||
super(singleAPI, self).stopThread()
|
super(singleAPI, self).stopThread()
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
try:
|
try:
|
||||||
s.connect((BMConfigParser().get('bitmessagesettings', 'apiinterface'), BMConfigParser().getint(
|
s.connect((
|
||||||
'bitmessagesettings', 'apiport')))
|
BMConfigParser().get('bitmessagesettings', 'apiinterface'),
|
||||||
|
BMConfigParser().getint('bitmessagesettings', 'apiport')
|
||||||
|
))
|
||||||
s.shutdown(socket.SHUT_RDWR)
|
s.shutdown(socket.SHUT_RDWR)
|
||||||
s.close()
|
s.close()
|
||||||
except:
|
except:
|
||||||
|
@ -175,19 +184,23 @@ class singleAPI(threading.Thread, helper_threading.StoppableThread):
|
||||||
try:
|
try:
|
||||||
if attempt > 0:
|
if attempt > 0:
|
||||||
port = randint(32767, 65535)
|
port = randint(32767, 65535)
|
||||||
se = StoppableXMLRPCServer((BMConfigParser().get('bitmessagesettings', 'apiinterface'), port),
|
se = StoppableXMLRPCServer((
|
||||||
|
BMConfigParser().get('bitmessagesettings', 'apiinterface'),
|
||||||
|
port),
|
||||||
MySimpleXMLRPCRequestHandler, True, True)
|
MySimpleXMLRPCRequestHandler, True, True)
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
if e.errno in (errno.EADDRINUSE, errno.WSAEADDRINUSE):
|
if e.errno in (errno.EADDRINUSE, errno.WSAEADDRINUSE):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
if attempt > 0:
|
if attempt > 0:
|
||||||
BMConfigParser().set("bitmessagesettings", "apiport", str(port))
|
BMConfigParser().set(
|
||||||
|
"bitmessagesettings", "apiport", str(port))
|
||||||
BMConfigParser().save()
|
BMConfigParser().save()
|
||||||
break
|
break
|
||||||
se.register_introspection_functions()
|
se.register_introspection_functions()
|
||||||
se.serve_forever()
|
se.serve_forever()
|
||||||
|
|
||||||
|
|
||||||
# This is a list of current connections (the thread pointers at least)
|
# This is a list of current connections (the thread pointers at least)
|
||||||
selfInitiatedConnections = {}
|
selfInitiatedConnections = {}
|
||||||
|
|
||||||
|
@ -197,15 +210,17 @@ if shared.useVeryEasyProofOfWorkForTesting:
|
||||||
defaults.networkDefaultPayloadLengthExtraBytes = int(
|
defaults.networkDefaultPayloadLengthExtraBytes = int(
|
||||||
defaults.networkDefaultPayloadLengthExtraBytes / 100)
|
defaults.networkDefaultPayloadLengthExtraBytes / 100)
|
||||||
|
|
||||||
|
|
||||||
class Main:
|
class Main:
|
||||||
def start(self):
|
def start(self):
|
||||||
_fixSocket()
|
_fixSocket()
|
||||||
|
|
||||||
daemon = BMConfigParser().safeGetBoolean('bitmessagesettings', 'daemon')
|
daemon = BMConfigParser().safeGetBoolean(
|
||||||
|
'bitmessagesettings', 'daemon')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], "hcd",
|
opts, args = getopt.getopt(
|
||||||
["help", "curses", "daemon"])
|
sys.argv[1:], "hcd", ["help", "curses", "daemon"])
|
||||||
|
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
self.usage()
|
self.usage()
|
||||||
|
@ -233,65 +248,76 @@ class Main:
|
||||||
helper_threading.set_thread_name("PyBitmessage")
|
helper_threading.set_thread_name("PyBitmessage")
|
||||||
|
|
||||||
state.dandelion = BMConfigParser().safeGetInt('network', 'dandelion')
|
state.dandelion = BMConfigParser().safeGetInt('network', 'dandelion')
|
||||||
# dandelion requires outbound connections, without them, stem objects will get stuck forever
|
# dandelion requires outbound connections, without them,
|
||||||
if state.dandelion and not BMConfigParser().safeGetBoolean('bitmessagesettings', 'sendoutgoingconnections'):
|
# stem objects will get stuck forever
|
||||||
|
if state.dandelion and not BMConfigParser().safeGetBoolean(
|
||||||
|
'bitmessagesettings', 'sendoutgoingconnections'):
|
||||||
state.dandelion = 0
|
state.dandelion = 0
|
||||||
|
|
||||||
helper_bootstrap.knownNodes()
|
helper_bootstrap.knownNodes()
|
||||||
# Start the address generation thread
|
# Start the address generation thread
|
||||||
addressGeneratorThread = addressGenerator()
|
addressGeneratorThread = addressGenerator()
|
||||||
addressGeneratorThread.daemon = True # close the main program even if there are threads left
|
# close the main program even if there are threads left
|
||||||
|
addressGeneratorThread.daemon = True
|
||||||
addressGeneratorThread.start()
|
addressGeneratorThread.start()
|
||||||
|
|
||||||
# Start the thread that calculates POWs
|
# Start the thread that calculates POWs
|
||||||
singleWorkerThread = singleWorker()
|
singleWorkerThread = singleWorker()
|
||||||
singleWorkerThread.daemon = True # close the main program even if there are threads left
|
# close the main program even if there are threads left
|
||||||
|
singleWorkerThread.daemon = True
|
||||||
singleWorkerThread.start()
|
singleWorkerThread.start()
|
||||||
|
|
||||||
# Start the SQL thread
|
# Start the SQL thread
|
||||||
sqlLookup = sqlThread()
|
sqlLookup = sqlThread()
|
||||||
sqlLookup.daemon = False # DON'T close the main program even if there are threads left. The closeEvent should command this thread to exit gracefully.
|
# DON'T close the main program even if there are threads left.
|
||||||
|
# The closeEvent should command this thread to exit gracefully.
|
||||||
|
sqlLookup.daemon = False
|
||||||
sqlLookup.start()
|
sqlLookup.start()
|
||||||
|
|
||||||
Inventory() # init
|
Inventory() # init
|
||||||
Dandelion() # init, needs to be early because other thread may access it early
|
# init, needs to be early because other thread may access it early
|
||||||
|
Dandelion()
|
||||||
|
|
||||||
# SMTP delivery thread
|
# SMTP delivery thread
|
||||||
if daemon and BMConfigParser().safeGet("bitmessagesettings", "smtpdeliver", '') != '':
|
if daemon and BMConfigParser().safeGet(
|
||||||
|
"bitmessagesettings", "smtpdeliver", '') != '':
|
||||||
smtpDeliveryThread = smtpDeliver()
|
smtpDeliveryThread = smtpDeliver()
|
||||||
smtpDeliveryThread.start()
|
smtpDeliveryThread.start()
|
||||||
|
|
||||||
# SMTP daemon thread
|
# SMTP daemon thread
|
||||||
if daemon and BMConfigParser().safeGetBoolean("bitmessagesettings", "smtpd"):
|
if daemon and BMConfigParser().safeGetBoolean(
|
||||||
|
"bitmessagesettings", "smtpd"):
|
||||||
smtpServerThread = smtpServer()
|
smtpServerThread = smtpServer()
|
||||||
smtpServerThread.start()
|
smtpServerThread.start()
|
||||||
|
|
||||||
# Start the thread that calculates POWs
|
# Start the thread that calculates POWs
|
||||||
objectProcessorThread = objectProcessor()
|
objectProcessorThread = objectProcessor()
|
||||||
objectProcessorThread.daemon = False # DON'T close the main program even the thread remains. This thread checks the shutdown variable after processing each object.
|
# DON'T close the main program even the thread remains. This
|
||||||
|
# thread checks the shutdown variable after processing each object.
|
||||||
|
objectProcessorThread.daemon = False
|
||||||
objectProcessorThread.start()
|
objectProcessorThread.start()
|
||||||
|
|
||||||
# Start the cleanerThread
|
# Start the cleanerThread
|
||||||
singleCleanerThread = singleCleaner()
|
singleCleanerThread = singleCleaner()
|
||||||
singleCleanerThread.daemon = True # close the main program even if there are threads left
|
# close the main program even if there are threads left
|
||||||
|
singleCleanerThread.daemon = True
|
||||||
singleCleanerThread.start()
|
singleCleanerThread.start()
|
||||||
|
|
||||||
shared.reloadMyAddressHashes()
|
shared.reloadMyAddressHashes()
|
||||||
shared.reloadBroadcastSendersForWhichImWatching()
|
shared.reloadBroadcastSendersForWhichImWatching()
|
||||||
|
|
||||||
if BMConfigParser().safeGetBoolean('bitmessagesettings', 'apienabled'):
|
if BMConfigParser().safeGetBoolean('bitmessagesettings', 'apienabled'):
|
||||||
try:
|
apiNotifyPath = BMConfigParser().safeGet(
|
||||||
apiNotifyPath = BMConfigParser().get(
|
'bitmessagesettings', 'apinotifypath', ''
|
||||||
'bitmessagesettings', 'apinotifypath')
|
)
|
||||||
except:
|
if apiNotifyPath:
|
||||||
apiNotifyPath = ''
|
|
||||||
if apiNotifyPath != '':
|
|
||||||
with shared.printLock:
|
with shared.printLock:
|
||||||
print('Trying to call', apiNotifyPath)
|
print('Trying to call', apiNotifyPath)
|
||||||
|
|
||||||
call([apiNotifyPath, "startingUp"])
|
call([apiNotifyPath, "startingUp"])
|
||||||
singleAPIThread = singleAPI()
|
singleAPIThread = singleAPI()
|
||||||
singleAPIThread.daemon = True # close the main program even if there are threads left
|
# close the main program even if there are threads left
|
||||||
|
singleAPIThread.daemon = True
|
||||||
singleAPIThread.start()
|
singleAPIThread.start()
|
||||||
|
|
||||||
BMConnectionPool()
|
BMConnectionPool()
|
||||||
|
@ -317,13 +343,14 @@ class Main:
|
||||||
|
|
||||||
connectToStream(1)
|
connectToStream(1)
|
||||||
|
|
||||||
if BMConfigParser().safeGetBoolean('bitmessagesettings','upnp'):
|
if BMConfigParser().safeGetBoolean('bitmessagesettings', 'upnp'):
|
||||||
import upnp
|
import upnp
|
||||||
upnpThread = upnp.uPnPThread()
|
upnpThread = upnp.uPnPThread()
|
||||||
upnpThread.start()
|
upnpThread.start()
|
||||||
|
|
||||||
if daemon == False and BMConfigParser().safeGetBoolean('bitmessagesettings', 'daemon') == False:
|
if daemon is False and BMConfigParser().safeGetBoolean(
|
||||||
if state.curses == False:
|
'bitmessagesettings', 'daemon') is False:
|
||||||
|
if state.curses is False:
|
||||||
if not depends.check_pyqt():
|
if not depends.check_pyqt():
|
||||||
print('PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon')
|
print('PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon')
|
||||||
print('You can also run PyBitmessage with the new curses interface by providing \'-c\' as a commandline argument.')
|
print('You can also run PyBitmessage with the new curses interface by providing \'-c\' as a commandline argument.')
|
||||||
|
@ -333,7 +360,7 @@ class Main:
|
||||||
bitmessageqt.run()
|
bitmessageqt.run()
|
||||||
else:
|
else:
|
||||||
if True:
|
if True:
|
||||||
# if depends.check_curses():
|
# if depends.check_curses():
|
||||||
print('Running with curses')
|
print('Running with curses')
|
||||||
import bitmessagecurses
|
import bitmessagecurses
|
||||||
bitmessagecurses.runwrapper()
|
bitmessagecurses.runwrapper()
|
||||||
|
@ -360,7 +387,7 @@ class Main:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
parentPid = os.getpid()
|
parentPid = os.getpid()
|
||||||
shared.thisapp.lock() # relock
|
shared.thisapp.lock() # relock
|
||||||
os.umask(0)
|
os.umask(0)
|
||||||
try:
|
try:
|
||||||
os.setsid()
|
os.setsid()
|
||||||
|
@ -379,8 +406,8 @@ class Main:
|
||||||
# fork not implemented
|
# fork not implemented
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
shared.thisapp.lock() # relock
|
shared.thisapp.lock() # relock
|
||||||
shared.thisapp.lockPid = None # indicate we're the final child
|
shared.thisapp.lockPid = None # indicate we're the final child
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
if not sys.platform.startswith('win'):
|
if not sys.platform.startswith('win'):
|
||||||
|
@ -416,20 +443,21 @@ All parameters are optional.
|
||||||
print('Stopping Bitmessage Deamon.')
|
print('Stopping Bitmessage Deamon.')
|
||||||
shutdown.doCleanShutdown()
|
shutdown.doCleanShutdown()
|
||||||
|
|
||||||
|
# TODO: nice function but no one is using this
|
||||||
#TODO: nice function but no one is using this
|
|
||||||
def getApiAddress(self):
|
def getApiAddress(self):
|
||||||
if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'apienabled'):
|
if not BMConfigParser().safeGetBoolean(
|
||||||
return None
|
'bitmessagesettings', 'apienabled'):
|
||||||
|
return
|
||||||
address = BMConfigParser().get('bitmessagesettings', 'apiinterface')
|
address = BMConfigParser().get('bitmessagesettings', 'apiinterface')
|
||||||
port = BMConfigParser().getint('bitmessagesettings', 'apiport')
|
port = BMConfigParser().getint('bitmessagesettings', 'apiport')
|
||||||
return {'address':address,'port':port}
|
return {'address': address, 'port': port}
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
mainprogram = Main()
|
mainprogram = Main()
|
||||||
mainprogram.start()
|
mainprogram.start()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
from debug import logger
|
from debug import logger
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
try:
|
from qtpy import QtCore, QtGui, QtWidgets, QtNetwork
|
||||||
from PyQt4 import QtCore, QtGui
|
|
||||||
from PyQt4.QtNetwork import QLocalSocket, QLocalServer
|
|
||||||
except Exception as err:
|
|
||||||
logmsg = 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download it from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\' (without quotes).'
|
|
||||||
logger.critical(logmsg, exc_info=True)
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
from tr import _translate
|
from tr import _translate
|
||||||
from addresses import decodeAddress, addBMIfNotPresent
|
from addresses import decodeAddress, addBMIfNotPresent
|
||||||
|
@ -70,27 +64,33 @@ def change_translation(newlocale):
|
||||||
global qmytranslator, qsystranslator
|
global qmytranslator, qsystranslator
|
||||||
try:
|
try:
|
||||||
if not qmytranslator.isEmpty():
|
if not qmytranslator.isEmpty():
|
||||||
QtGui.QApplication.removeTranslator(qmytranslator)
|
QtWidgets.QApplication.removeTranslator(qmytranslator)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
if not qsystranslator.isEmpty():
|
if not qsystranslator.isEmpty():
|
||||||
QtGui.QApplication.removeTranslator(qsystranslator)
|
QtWidgets.QApplication.removeTranslator(qsystranslator)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
qmytranslator = QtCore.QTranslator()
|
qmytranslator = QtCore.QTranslator()
|
||||||
translationpath = os.path.join (paths.codePath(), 'translations', 'bitmessage_' + newlocale)
|
translationpath = os.path.join(
|
||||||
|
paths.codePath(), 'translations', 'bitmessage_' + newlocale)
|
||||||
qmytranslator.load(translationpath)
|
qmytranslator.load(translationpath)
|
||||||
QtGui.QApplication.installTranslator(qmytranslator)
|
QtWidgets.QApplication.installTranslator(qmytranslator)
|
||||||
|
|
||||||
qsystranslator = QtCore.QTranslator()
|
qsystranslator = QtCore.QTranslator()
|
||||||
if paths.frozen:
|
if paths.frozen:
|
||||||
translationpath = os.path.join (paths.codePath(), 'translations', 'qt_' + newlocale)
|
translationpath = os.path.join(
|
||||||
|
paths.codePath(), 'translations', 'qt_' + newlocale)
|
||||||
else:
|
else:
|
||||||
translationpath = os.path.join (str(QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)), 'qt_' + newlocale)
|
translationpath = os.path.join(
|
||||||
|
str(QtCore.QLibraryInfo.location(
|
||||||
|
QtCore.QLibraryInfo.TranslationsPath
|
||||||
|
)), 'qt_' + newlocale
|
||||||
|
)
|
||||||
qsystranslator.load(translationpath)
|
qsystranslator.load(translationpath)
|
||||||
QtGui.QApplication.installTranslator(qsystranslator)
|
QtWidgets.QApplication.installTranslator(qsystranslator)
|
||||||
|
|
||||||
lang = locale.normalize(l10n.getTranslationLanguage())
|
lang = locale.normalize(l10n.getTranslationLanguage())
|
||||||
langs = [lang.split(".")[0] + "." + l10n.encoding, lang.split(".")[0] + "." + 'UTF-8', lang]
|
langs = [lang.split(".")[0] + "." + l10n.encoding, lang.split(".")[0] + "." + 'UTF-8', lang]
|
||||||
|
@ -121,49 +121,35 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
REPLY_TYPE_CHAN = 1
|
REPLY_TYPE_CHAN = 1
|
||||||
|
|
||||||
def init_file_menu(self):
|
def init_file_menu(self):
|
||||||
QtCore.QObject.connect(self.ui.actionExit, QtCore.SIGNAL(
|
self.ui.actionExit.triggered.connect(self.quit)
|
||||||
"triggered()"), self.quit)
|
self.ui.actionNetworkSwitch.triggered.connect(self.network_switch)
|
||||||
QtCore.QObject.connect(self.ui.actionNetworkSwitch, QtCore.SIGNAL(
|
self.ui.actionManageKeys.triggered.connect(self.click_actionManageKeys)
|
||||||
"triggered()"), self.network_switch)
|
self.ui.actionDeleteAllTrashedMessages.triggered.connect(
|
||||||
QtCore.QObject.connect(self.ui.actionManageKeys, QtCore.SIGNAL(
|
self.click_actionDeleteAllTrashedMessages)
|
||||||
"triggered()"), self.click_actionManageKeys)
|
self.ui.actionRegenerateDeterministicAddresses.triggered.connect(
|
||||||
QtCore.QObject.connect(self.ui.actionDeleteAllTrashedMessages,
|
self.click_actionRegenerateDeterministicAddresses)
|
||||||
QtCore.SIGNAL(
|
self.ui.actionSettings.triggered.connect(self.click_actionSettings)
|
||||||
"triggered()"),
|
self.ui.actionAbout.triggered.connect(self.click_actionAbout)
|
||||||
self.click_actionDeleteAllTrashedMessages)
|
self.ui.actionSupport.triggered.connect(self.click_actionSupport)
|
||||||
QtCore.QObject.connect(self.ui.actionRegenerateDeterministicAddresses,
|
self.ui.actionHelp.triggered.connect(self.click_actionHelp)
|
||||||
QtCore.SIGNAL(
|
|
||||||
"triggered()"),
|
# also used for creating chans.
|
||||||
self.click_actionRegenerateDeterministicAddresses)
|
self.ui.pushButtonAddChan.clicked.connect(self.click_actionJoinChan)
|
||||||
QtCore.QObject.connect(self.ui.pushButtonAddChan, QtCore.SIGNAL(
|
self.ui.pushButtonNewAddress.clicked.connect(
|
||||||
"clicked()"),
|
self.click_NewAddressDialog)
|
||||||
self.click_actionJoinChan) # also used for creating chans.
|
self.ui.pushButtonAddAddressBook.clicked.connect(
|
||||||
QtCore.QObject.connect(self.ui.pushButtonNewAddress, QtCore.SIGNAL(
|
self.click_pushButtonAddAddressBook)
|
||||||
"clicked()"), self.click_NewAddressDialog)
|
self.ui.pushButtonAddSubscription.clicked.connect(
|
||||||
QtCore.QObject.connect(self.ui.pushButtonAddAddressBook, QtCore.SIGNAL(
|
self.click_pushButtonAddAddressBook)
|
||||||
"clicked()"), self.click_pushButtonAddAddressBook)
|
self.ui.pushButtonTTL.clicked.connect(self.click_pushButtonTTL)
|
||||||
QtCore.QObject.connect(self.ui.pushButtonAddSubscription, QtCore.SIGNAL(
|
self.ui.pushButtonClear.clicked.connect(self.click_pushButtonClear)
|
||||||
"clicked()"), self.click_pushButtonAddSubscription)
|
self.ui.pushButtonSend.clicked.connect(self.click_pushButtonSend)
|
||||||
QtCore.QObject.connect(self.ui.pushButtonTTL, QtCore.SIGNAL(
|
self.ui.pushButtonFetchNamecoinID.clicked.connect(
|
||||||
"clicked()"), self.click_pushButtonTTL)
|
self.click_pushButtonFetchNamecoinID)
|
||||||
QtCore.QObject.connect(self.ui.pushButtonClear, QtCore.SIGNAL(
|
|
||||||
"clicked()"), self.click_pushButtonClear)
|
|
||||||
QtCore.QObject.connect(self.ui.pushButtonSend, QtCore.SIGNAL(
|
|
||||||
"clicked()"), self.click_pushButtonSend)
|
|
||||||
QtCore.QObject.connect(self.ui.pushButtonFetchNamecoinID, QtCore.SIGNAL(
|
|
||||||
"clicked()"), self.click_pushButtonFetchNamecoinID)
|
|
||||||
QtCore.QObject.connect(self.ui.actionSettings, QtCore.SIGNAL(
|
|
||||||
"triggered()"), self.click_actionSettings)
|
|
||||||
QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL(
|
|
||||||
"triggered()"), self.click_actionAbout)
|
|
||||||
QtCore.QObject.connect(self.ui.actionSupport, QtCore.SIGNAL(
|
|
||||||
"triggered()"), self.click_actionSupport)
|
|
||||||
QtCore.QObject.connect(self.ui.actionHelp, QtCore.SIGNAL(
|
|
||||||
"triggered()"), self.click_actionHelp)
|
|
||||||
|
|
||||||
def init_inbox_popup_menu(self, connectSignal=True):
|
def init_inbox_popup_menu(self, connectSignal=True):
|
||||||
# Popup menu for the Inbox tab
|
# Popup menu for the Inbox tab
|
||||||
self.ui.inboxContextMenuToolbar = QtGui.QToolBar()
|
self.ui.inboxContextMenuToolbar = QtWidgets.QToolBar()
|
||||||
# Actions
|
# Actions
|
||||||
self.actionReply = self.ui.inboxContextMenuToolbar.addAction(_translate(
|
self.actionReply = self.ui.inboxContextMenuToolbar.addAction(_translate(
|
||||||
"MainWindow", "Reply to sender"), self.on_action_InboxReply)
|
"MainWindow", "Reply to sender"), self.on_action_InboxReply)
|
||||||
|
@ -199,25 +185,22 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.tableWidgetInbox.setContextMenuPolicy(
|
self.ui.tableWidgetInbox.setContextMenuPolicy(
|
||||||
QtCore.Qt.CustomContextMenu)
|
QtCore.Qt.CustomContextMenu)
|
||||||
if connectSignal:
|
if connectSignal:
|
||||||
self.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL(
|
self.ui.tableWidgetInbox.customContextMenuRequested.connect(
|
||||||
'customContextMenuRequested(const QPoint&)'),
|
self.on_context_menuInbox)
|
||||||
self.on_context_menuInbox)
|
|
||||||
self.ui.tableWidgetInboxSubscriptions.setContextMenuPolicy(
|
self.ui.tableWidgetInboxSubscriptions.setContextMenuPolicy(
|
||||||
QtCore.Qt.CustomContextMenu)
|
QtCore.Qt.CustomContextMenu)
|
||||||
if connectSignal:
|
if connectSignal:
|
||||||
self.connect(self.ui.tableWidgetInboxSubscriptions, QtCore.SIGNAL(
|
self.ui.tableWidgetInboxSubscriptions.customContextMenuRequested.connect(
|
||||||
'customContextMenuRequested(const QPoint&)'),
|
self.on_context_menuInbox)
|
||||||
self.on_context_menuInbox)
|
|
||||||
self.ui.tableWidgetInboxChans.setContextMenuPolicy(
|
self.ui.tableWidgetInboxChans.setContextMenuPolicy(
|
||||||
QtCore.Qt.CustomContextMenu)
|
QtCore.Qt.CustomContextMenu)
|
||||||
if connectSignal:
|
if connectSignal:
|
||||||
self.connect(self.ui.tableWidgetInboxChans, QtCore.SIGNAL(
|
self.ui.tableWidgetInboxChans.customContextMenuRequested.connect(
|
||||||
'customContextMenuRequested(const QPoint&)'),
|
self.on_context_menuInbox)
|
||||||
self.on_context_menuInbox)
|
|
||||||
|
|
||||||
def init_identities_popup_menu(self, connectSignal=True):
|
def init_identities_popup_menu(self, connectSignal=True):
|
||||||
# Popup menu for the Your Identities tab
|
# Popup menu for the Your Identities tab
|
||||||
self.ui.addressContextMenuToolbarYourIdentities = QtGui.QToolBar()
|
self.ui.addressContextMenuToolbarYourIdentities = QtWidgets.QToolBar()
|
||||||
# Actions
|
# Actions
|
||||||
self.actionNewYourIdentities = self.ui.addressContextMenuToolbarYourIdentities.addAction(_translate(
|
self.actionNewYourIdentities = self.ui.addressContextMenuToolbarYourIdentities.addAction(_translate(
|
||||||
"MainWindow", "New"), self.on_action_YourIdentitiesNew)
|
"MainWindow", "New"), self.on_action_YourIdentitiesNew)
|
||||||
|
@ -251,9 +234,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.treeWidgetYourIdentities.setContextMenuPolicy(
|
self.ui.treeWidgetYourIdentities.setContextMenuPolicy(
|
||||||
QtCore.Qt.CustomContextMenu)
|
QtCore.Qt.CustomContextMenu)
|
||||||
if connectSignal:
|
if connectSignal:
|
||||||
self.connect(self.ui.treeWidgetYourIdentities, QtCore.SIGNAL(
|
self.ui.treeWidgetYourIdentities.customContextMenuRequested.connect(
|
||||||
'customContextMenuRequested(const QPoint&)'),
|
self.on_context_menuYourIdentities)
|
||||||
self.on_context_menuYourIdentities)
|
|
||||||
|
|
||||||
# load all gui.menu plugins with prefix 'address'
|
# load all gui.menu plugins with prefix 'address'
|
||||||
self.menu_plugins = {'address': []}
|
self.menu_plugins = {'address': []}
|
||||||
|
@ -269,7 +251,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
def init_chan_popup_menu(self, connectSignal=True):
|
def init_chan_popup_menu(self, connectSignal=True):
|
||||||
# Popup menu for the Channels tab
|
# Popup menu for the Channels tab
|
||||||
self.ui.addressContextMenuToolbar = QtGui.QToolBar()
|
self.ui.addressContextMenuToolbar = QtWidgets.QToolBar()
|
||||||
# Actions
|
# Actions
|
||||||
self.actionNew = self.ui.addressContextMenuToolbar.addAction(_translate(
|
self.actionNew = self.ui.addressContextMenuToolbar.addAction(_translate(
|
||||||
"MainWindow", "New"), self.on_action_YourIdentitiesNew)
|
"MainWindow", "New"), self.on_action_YourIdentitiesNew)
|
||||||
|
@ -298,13 +280,12 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.treeWidgetChans.setContextMenuPolicy(
|
self.ui.treeWidgetChans.setContextMenuPolicy(
|
||||||
QtCore.Qt.CustomContextMenu)
|
QtCore.Qt.CustomContextMenu)
|
||||||
if connectSignal:
|
if connectSignal:
|
||||||
self.connect(self.ui.treeWidgetChans, QtCore.SIGNAL(
|
self.ui.treeWidgetChans.customContextMenuRequested.connect(
|
||||||
'customContextMenuRequested(const QPoint&)'),
|
self.on_context_menuChan)
|
||||||
self.on_context_menuChan)
|
|
||||||
|
|
||||||
def init_addressbook_popup_menu(self, connectSignal=True):
|
def init_addressbook_popup_menu(self, connectSignal=True):
|
||||||
# Popup menu for the Address Book page
|
# Popup menu for the Address Book page
|
||||||
self.ui.addressBookContextMenuToolbar = QtGui.QToolBar()
|
self.ui.addressBookContextMenuToolbar = QtWidgets.QToolBar()
|
||||||
# Actions
|
# Actions
|
||||||
self.actionAddressBookSend = self.ui.addressBookContextMenuToolbar.addAction(
|
self.actionAddressBookSend = self.ui.addressBookContextMenuToolbar.addAction(
|
||||||
_translate(
|
_translate(
|
||||||
|
@ -335,13 +316,12 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.tableWidgetAddressBook.setContextMenuPolicy(
|
self.ui.tableWidgetAddressBook.setContextMenuPolicy(
|
||||||
QtCore.Qt.CustomContextMenu)
|
QtCore.Qt.CustomContextMenu)
|
||||||
if connectSignal:
|
if connectSignal:
|
||||||
self.connect(self.ui.tableWidgetAddressBook, QtCore.SIGNAL(
|
self.ui.tableWidgetAddressBook.customContextMenuRequested.connect(
|
||||||
'customContextMenuRequested(const QPoint&)'),
|
self.on_context_menuAddressBook)
|
||||||
self.on_context_menuAddressBook)
|
|
||||||
|
|
||||||
def init_subscriptions_popup_menu(self, connectSignal=True):
|
def init_subscriptions_popup_menu(self, connectSignal=True):
|
||||||
# Popup menu for the Subscriptions page
|
# Popup menu for the Subscriptions page
|
||||||
self.ui.subscriptionsContextMenuToolbar = QtGui.QToolBar()
|
self.ui.subscriptionsContextMenuToolbar = QtWidgets.QToolBar()
|
||||||
# Actions
|
# Actions
|
||||||
self.actionsubscriptionsNew = self.ui.subscriptionsContextMenuToolbar.addAction(
|
self.actionsubscriptionsNew = self.ui.subscriptionsContextMenuToolbar.addAction(
|
||||||
_translate("MainWindow", "New"), self.on_action_SubscriptionsNew)
|
_translate("MainWindow", "New"), self.on_action_SubscriptionsNew)
|
||||||
|
@ -363,13 +343,12 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.treeWidgetSubscriptions.setContextMenuPolicy(
|
self.ui.treeWidgetSubscriptions.setContextMenuPolicy(
|
||||||
QtCore.Qt.CustomContextMenu)
|
QtCore.Qt.CustomContextMenu)
|
||||||
if connectSignal:
|
if connectSignal:
|
||||||
self.connect(self.ui.treeWidgetSubscriptions, QtCore.SIGNAL(
|
self.ui.treeWidgetSubscriptions.customContextMenuRequested.connect(
|
||||||
'customContextMenuRequested(const QPoint&)'),
|
self.on_context_menuSubscriptions)
|
||||||
self.on_context_menuSubscriptions)
|
|
||||||
|
|
||||||
def init_sent_popup_menu(self, connectSignal=True):
|
def init_sent_popup_menu(self, connectSignal=True):
|
||||||
# Popup menu for the Sent page
|
# Popup menu for the Sent page
|
||||||
self.ui.sentContextMenuToolbar = QtGui.QToolBar()
|
self.ui.sentContextMenuToolbar = QtWidgets.QToolBar()
|
||||||
# Actions
|
# Actions
|
||||||
self.actionTrashSentMessage = self.ui.sentContextMenuToolbar.addAction(
|
self.actionTrashSentMessage = self.ui.sentContextMenuToolbar.addAction(
|
||||||
_translate(
|
_translate(
|
||||||
|
@ -381,7 +360,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.actionForceSend = self.ui.sentContextMenuToolbar.addAction(
|
self.actionForceSend = self.ui.sentContextMenuToolbar.addAction(
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow", "Force send"), self.on_action_ForceSend)
|
"MainWindow", "Force send"), self.on_action_ForceSend)
|
||||||
# self.popMenuSent = QtGui.QMenu( self )
|
# self.popMenuSent = QtWidgets.QMenu( self )
|
||||||
# self.popMenuSent.addAction( self.actionSentClipboard )
|
# self.popMenuSent.addAction( self.actionSentClipboard )
|
||||||
# self.popMenuSent.addAction( self.actionTrashSentMessage )
|
# self.popMenuSent.addAction( self.actionTrashSentMessage )
|
||||||
|
|
||||||
|
@ -395,17 +374,16 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
treeWidget.header().setSortIndicator(
|
treeWidget.header().setSortIndicator(
|
||||||
0, QtCore.Qt.AscendingOrder)
|
0, QtCore.Qt.AscendingOrder)
|
||||||
# init dictionary
|
# init dictionary
|
||||||
|
|
||||||
db = getSortedSubscriptions(True)
|
db = getSortedSubscriptions(True)
|
||||||
for address in db:
|
for address in db:
|
||||||
for folder in folders:
|
for folder in folders:
|
||||||
if not folder in db[address]:
|
if folder not in db[address]:
|
||||||
db[address][folder] = {}
|
db[address][folder] = {}
|
||||||
|
|
||||||
if treeWidget.isSortingEnabled():
|
if treeWidget.isSortingEnabled():
|
||||||
treeWidget.setSortingEnabled(False)
|
treeWidget.setSortingEnabled(False)
|
||||||
|
|
||||||
widgets = {}
|
|
||||||
i = 0
|
i = 0
|
||||||
while i < treeWidget.topLevelItemCount():
|
while i < treeWidget.topLevelItemCount():
|
||||||
widget = treeWidget.topLevelItem(i)
|
widget = treeWidget.topLevelItem(i)
|
||||||
|
@ -413,8 +391,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
toAddress = widget.address
|
toAddress = widget.address
|
||||||
else:
|
else:
|
||||||
toAddress = None
|
toAddress = None
|
||||||
|
|
||||||
if not toAddress in db:
|
if toAddress not in db:
|
||||||
treeWidget.takeTopLevelItem(i)
|
treeWidget.takeTopLevelItem(i)
|
||||||
# no increment
|
# no increment
|
||||||
continue
|
continue
|
||||||
|
@ -423,7 +401,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
while j < widget.childCount():
|
while j < widget.childCount():
|
||||||
subwidget = widget.child(j)
|
subwidget = widget.child(j)
|
||||||
try:
|
try:
|
||||||
subwidget.setUnreadCount(db[toAddress][subwidget.folderName]['count'])
|
subwidget.setUnreadCount(
|
||||||
|
db[toAddress][subwidget.folderName]['count'])
|
||||||
unread += db[toAddress][subwidget.folderName]['count']
|
unread += db[toAddress][subwidget.folderName]['count']
|
||||||
db[toAddress].pop(subwidget.folderName, None)
|
db[toAddress].pop(subwidget.folderName, None)
|
||||||
except:
|
except:
|
||||||
|
@ -437,45 +416,51 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
j = 0
|
j = 0
|
||||||
for f, c in db[toAddress].iteritems():
|
for f, c in db[toAddress].iteritems():
|
||||||
try:
|
try:
|
||||||
subwidget = Ui_FolderWidget(widget, j, toAddress, f, c['count'])
|
subwidget = Ui_FolderWidget(
|
||||||
|
widget, j, toAddress, f, c['count'])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
subwidget = Ui_FolderWidget(widget, j, toAddress, f, 0)
|
subwidget = Ui_FolderWidget(widget, j, toAddress, f, 0)
|
||||||
j += 1
|
j += 1
|
||||||
widget.setUnreadCount(unread)
|
widget.setUnreadCount(unread)
|
||||||
db.pop(toAddress, None)
|
db.pop(toAddress, None)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
for toAddress in db:
|
for toAddress in db:
|
||||||
widget = Ui_SubscriptionWidget(treeWidget, i, toAddress, db[toAddress]["inbox"]['count'], db[toAddress]["inbox"]['label'], db[toAddress]["inbox"]['enabled'])
|
widget = Ui_SubscriptionWidget(
|
||||||
|
treeWidget, i, toAddress, db[toAddress]["inbox"]['count'],
|
||||||
|
db[toAddress]["inbox"]['label'],
|
||||||
|
db[toAddress]["inbox"]['enabled'])
|
||||||
j = 0
|
j = 0
|
||||||
unread = 0
|
unread = 0
|
||||||
for folder in folders:
|
for folder in folders:
|
||||||
try:
|
try:
|
||||||
subwidget = Ui_FolderWidget(widget, j, toAddress, folder, db[toAddress][folder]['count'])
|
subwidget = Ui_FolderWidget(
|
||||||
|
widget, j, toAddress, folder,
|
||||||
|
db[toAddress][folder]['count'])
|
||||||
unread += db[toAddress][folder]['count']
|
unread += db[toAddress][folder]['count']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
subwidget = Ui_FolderWidget(widget, j, toAddress, folder, 0)
|
subwidget = Ui_FolderWidget(
|
||||||
|
widget, j, toAddress, folder, 0)
|
||||||
j += 1
|
j += 1
|
||||||
widget.setUnreadCount(unread)
|
widget.setUnreadCount(unread)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
treeWidget.setSortingEnabled(True)
|
|
||||||
|
|
||||||
|
treeWidget.setSortingEnabled(True)
|
||||||
|
|
||||||
def rerenderTabTreeMessages(self):
|
def rerenderTabTreeMessages(self):
|
||||||
self.rerenderTabTree('messages')
|
self.rerenderTabTree('messages')
|
||||||
|
|
||||||
def rerenderTabTreeChans(self):
|
def rerenderTabTreeChans(self):
|
||||||
self.rerenderTabTree('chan')
|
self.rerenderTabTree('chan')
|
||||||
|
|
||||||
def rerenderTabTree(self, tab):
|
def rerenderTabTree(self, tab):
|
||||||
if tab == 'messages':
|
if tab == 'messages':
|
||||||
treeWidget = self.ui.treeWidgetYourIdentities
|
treeWidget = self.ui.treeWidgetYourIdentities
|
||||||
elif tab == 'chan':
|
elif tab == 'chan':
|
||||||
treeWidget = self.ui.treeWidgetChans
|
treeWidget = self.ui.treeWidgetChans
|
||||||
folders = Ui_FolderWidget.folderWeight.keys()
|
folders = Ui_FolderWidget.folderWeight.keys()
|
||||||
|
|
||||||
# sort ascending when creating
|
# sort ascending when creating
|
||||||
if treeWidget.topLevelItemCount() == 0:
|
if treeWidget.topLevelItemCount() == 0:
|
||||||
treeWidget.header().setSortIndicator(
|
treeWidget.header().setSortIndicator(
|
||||||
|
@ -483,14 +468,14 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# init dictionary
|
# init dictionary
|
||||||
db = {}
|
db = {}
|
||||||
enabled = {}
|
enabled = {}
|
||||||
|
|
||||||
for toAddress in getSortedAccounts():
|
for toAddress in getSortedAccounts():
|
||||||
isEnabled = BMConfigParser().getboolean(
|
isEnabled = BMConfigParser().getboolean(
|
||||||
toAddress, 'enabled')
|
toAddress, 'enabled')
|
||||||
isChan = BMConfigParser().safeGetBoolean(
|
isChan = BMConfigParser().safeGetBoolean(
|
||||||
toAddress, 'chan')
|
toAddress, 'chan')
|
||||||
isMaillinglist = BMConfigParser().safeGetBoolean(
|
# isMaillinglist = BMConfigParser().safeGetBoolean(
|
||||||
toAddress, 'mailinglist')
|
# toAddress, 'mailinglist')
|
||||||
|
|
||||||
if treeWidget == self.ui.treeWidgetYourIdentities:
|
if treeWidget == self.ui.treeWidgetYourIdentities:
|
||||||
if isChan:
|
if isChan:
|
||||||
|
@ -502,7 +487,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
db[toAddress] = {}
|
db[toAddress] = {}
|
||||||
for folder in folders:
|
for folder in folders:
|
||||||
db[toAddress][folder] = 0
|
db[toAddress][folder] = 0
|
||||||
|
|
||||||
enabled[toAddress] = isEnabled
|
enabled[toAddress] = isEnabled
|
||||||
|
|
||||||
# get number of (unread) messages
|
# get number of (unread) messages
|
||||||
|
@ -520,11 +505,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
db[None]["sent"] = 0
|
db[None]["sent"] = 0
|
||||||
db[None]["trash"] = 0
|
db[None]["trash"] = 0
|
||||||
enabled[None] = True
|
enabled[None] = True
|
||||||
|
|
||||||
if treeWidget.isSortingEnabled():
|
if treeWidget.isSortingEnabled():
|
||||||
treeWidget.setSortingEnabled(False)
|
treeWidget.setSortingEnabled(False)
|
||||||
|
|
||||||
widgets = {}
|
|
||||||
i = 0
|
i = 0
|
||||||
while i < treeWidget.topLevelItemCount():
|
while i < treeWidget.topLevelItemCount():
|
||||||
widget = treeWidget.topLevelItem(i)
|
widget = treeWidget.topLevelItem(i)
|
||||||
|
@ -532,8 +516,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
toAddress = widget.address
|
toAddress = widget.address
|
||||||
else:
|
else:
|
||||||
toAddress = None
|
toAddress = None
|
||||||
|
|
||||||
if not toAddress in db:
|
if toAddress not in db:
|
||||||
treeWidget.takeTopLevelItem(i)
|
treeWidget.takeTopLevelItem(i)
|
||||||
# no increment
|
# no increment
|
||||||
continue
|
continue
|
||||||
|
@ -542,7 +526,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
while j < widget.childCount():
|
while j < widget.childCount():
|
||||||
subwidget = widget.child(j)
|
subwidget = widget.child(j)
|
||||||
try:
|
try:
|
||||||
subwidget.setUnreadCount(db[toAddress][subwidget.folderName])
|
subwidget.setUnreadCount(
|
||||||
|
db[toAddress][subwidget.folderName])
|
||||||
if subwidget.folderName not in ["new", "trash", "sent"]:
|
if subwidget.folderName not in ["new", "trash", "sent"]:
|
||||||
unread += db[toAddress][subwidget.folderName]
|
unread += db[toAddress][subwidget.folderName]
|
||||||
db[toAddress].pop(subwidget.folderName, None)
|
db[toAddress].pop(subwidget.folderName, None)
|
||||||
|
@ -565,7 +550,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
widget.setUnreadCount(unread)
|
widget.setUnreadCount(unread)
|
||||||
db.pop(toAddress, None)
|
db.pop(toAddress, None)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
for toAddress in db:
|
for toAddress in db:
|
||||||
widget = Ui_AddressWidget(treeWidget, i, toAddress, db[toAddress]["inbox"], enabled[toAddress])
|
widget = Ui_AddressWidget(treeWidget, i, toAddress, db[toAddress]["inbox"], enabled[toAddress])
|
||||||
|
@ -580,11 +565,11 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
j += 1
|
j += 1
|
||||||
widget.setUnreadCount(unread)
|
widget.setUnreadCount(unread)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
treeWidget.setSortingEnabled(True)
|
treeWidget.setSortingEnabled(True)
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
QtGui.QWidget.__init__(self, parent)
|
super(MyForm, self).__init__(parent)
|
||||||
self.ui = Ui_MainWindow()
|
self.ui = Ui_MainWindow()
|
||||||
self.ui.setupUi(self)
|
self.ui.setupUi(self)
|
||||||
|
|
||||||
|
@ -595,11 +580,13 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
addressInKeysFile)
|
addressInKeysFile)
|
||||||
if addressVersionNumber == 1:
|
if addressVersionNumber == 1:
|
||||||
displayMsg = _translate(
|
displayMsg = _translate(
|
||||||
"MainWindow", "One of your addresses, %1, is an old version 1 address. Version 1 addresses are no longer supported. "
|
"MainWindow",
|
||||||
+ "May we delete it now?").arg(addressInKeysFile)
|
"One of your addresses, {0}, is an old version 1"
|
||||||
reply = QtGui.QMessageBox.question(
|
" address. Version 1 addresses are no longer supported."
|
||||||
self, 'Message', displayMsg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
" May we delete it now?").format(addressInKeysFile)
|
||||||
if reply == QtGui.QMessageBox.Yes:
|
reply = QtWidgets.QMessageBox.question(
|
||||||
|
self, 'Message', displayMsg, QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)
|
||||||
|
if reply == QtWidgets.QMessageBox.Yes:
|
||||||
BMConfigParser().remove_section(addressInKeysFile)
|
BMConfigParser().remove_section(addressInKeysFile)
|
||||||
BMConfigParser().save()
|
BMConfigParser().save()
|
||||||
|
|
||||||
|
@ -622,13 +609,13 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
# e.g. for editing labels
|
# e.g. for editing labels
|
||||||
self.recurDepth = 0
|
self.recurDepth = 0
|
||||||
|
|
||||||
# switch back to this when replying
|
# switch back to this when replying
|
||||||
self.replyFromTab = None
|
self.replyFromTab = None
|
||||||
|
|
||||||
# so that quit won't loop
|
# so that quit won't loop
|
||||||
self.quitAccepted = False
|
self.quitAccepted = False
|
||||||
|
|
||||||
self.init_file_menu()
|
self.init_file_menu()
|
||||||
self.init_inbox_popup_menu()
|
self.init_inbox_popup_menu()
|
||||||
self.init_identities_popup_menu()
|
self.init_identities_popup_menu()
|
||||||
|
@ -658,65 +645,58 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.rerenderSubscriptions()
|
self.rerenderSubscriptions()
|
||||||
|
|
||||||
# Initialize the inbox search
|
# Initialize the inbox search
|
||||||
QtCore.QObject.connect(self.ui.inboxSearchLineEdit, QtCore.SIGNAL(
|
for line_edit in (
|
||||||
"returnPressed()"), self.inboxSearchLineEditReturnPressed)
|
self.ui.inboxSearchLineEdit,
|
||||||
QtCore.QObject.connect(self.ui.inboxSearchLineEditSubscriptions, QtCore.SIGNAL(
|
self.ui.inboxSearchLineEditSubscriptions,
|
||||||
"returnPressed()"), self.inboxSearchLineEditReturnPressed)
|
self.ui.inboxSearchLineEditChans,
|
||||||
QtCore.QObject.connect(self.ui.inboxSearchLineEditChans, QtCore.SIGNAL(
|
):
|
||||||
"returnPressed()"), self.inboxSearchLineEditReturnPressed)
|
line_edit.returnPressed.connect(
|
||||||
QtCore.QObject.connect(self.ui.inboxSearchLineEdit, QtCore.SIGNAL(
|
self.inboxSearchLineEditReturnPressed)
|
||||||
"textChanged(QString)"), self.inboxSearchLineEditUpdated)
|
line_edit.textChanged.connect(
|
||||||
QtCore.QObject.connect(self.ui.inboxSearchLineEditSubscriptions, QtCore.SIGNAL(
|
self.inboxSearchLineEditUpdated)
|
||||||
"textChanged(QString)"), self.inboxSearchLineEditUpdated)
|
|
||||||
QtCore.QObject.connect(self.ui.inboxSearchLineEditChans, QtCore.SIGNAL(
|
|
||||||
"textChanged(QString)"), self.inboxSearchLineEditUpdated)
|
|
||||||
|
|
||||||
# Initialize addressbook
|
# Initialize addressbook
|
||||||
QtCore.QObject.connect(self.ui.tableWidgetAddressBook, QtCore.SIGNAL(
|
self.ui.tableWidgetAddressBook.itemChanged.connect(
|
||||||
"itemChanged(QTableWidgetItem *)"), self.tableWidgetAddressBookItemChanged)
|
self.tableWidgetAddressBookItemChanged)
|
||||||
|
|
||||||
# This is necessary for the completer to work if multiple recipients
|
# This is necessary for the completer to work if multiple recipients
|
||||||
QtCore.QObject.connect(self.ui.lineEditTo, QtCore.SIGNAL(
|
self.ui.lineEditTo.cursorPositionChanged.connect(
|
||||||
"cursorPositionChanged(int, int)"), self.ui.lineEditTo.completer().onCursorPositionChanged)
|
self.ui.lineEditTo.completer().onCursorPositionChanged)
|
||||||
|
|
||||||
# show messages from message list
|
# show messages from message list
|
||||||
QtCore.QObject.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL(
|
for table_widget in (
|
||||||
"itemSelectionChanged ()"), self.tableWidgetInboxItemClicked)
|
self.ui.tableWidgetInbox,
|
||||||
QtCore.QObject.connect(self.ui.tableWidgetInboxSubscriptions, QtCore.SIGNAL(
|
self.ui.tableWidgetInboxSubscriptions,
|
||||||
"itemSelectionChanged ()"), self.tableWidgetInboxItemClicked)
|
self.ui.tableWidgetInboxChans
|
||||||
QtCore.QObject.connect(self.ui.tableWidgetInboxChans, QtCore.SIGNAL(
|
):
|
||||||
"itemSelectionChanged ()"), self.tableWidgetInboxItemClicked)
|
table_widget.itemSelectionChanged.connect(
|
||||||
|
self.tableWidgetInboxItemClicked)
|
||||||
|
|
||||||
# tree address lists
|
# tree address lists
|
||||||
QtCore.QObject.connect(self.ui.treeWidgetYourIdentities, QtCore.SIGNAL(
|
for tree_widget in (
|
||||||
"itemSelectionChanged ()"), self.treeWidgetItemClicked)
|
self.ui.treeWidgetYourIdentities,
|
||||||
QtCore.QObject.connect(self.ui.treeWidgetYourIdentities, QtCore.SIGNAL(
|
self.ui.treeWidgetSubscriptions,
|
||||||
"itemChanged (QTreeWidgetItem *, int)"), self.treeWidgetItemChanged)
|
self.ui.treeWidgetChans
|
||||||
QtCore.QObject.connect(self.ui.treeWidgetSubscriptions, QtCore.SIGNAL(
|
):
|
||||||
"itemSelectionChanged ()"), self.treeWidgetItemClicked)
|
tree_widget.itemSelectionChanged.connect(
|
||||||
QtCore.QObject.connect(self.ui.treeWidgetSubscriptions, QtCore.SIGNAL(
|
self.treeWidgetItemClicked)
|
||||||
"itemChanged (QTreeWidgetItem *, int)"), self.treeWidgetItemChanged)
|
tree_widget.itemChanged.connect(self.treeWidgetItemChanged)
|
||||||
QtCore.QObject.connect(self.ui.treeWidgetChans, QtCore.SIGNAL(
|
|
||||||
"itemSelectionChanged ()"), self.treeWidgetItemClicked)
|
self.ui.tabWidget.currentChanged.connect(self.tabWidgetCurrentChanged)
|
||||||
QtCore.QObject.connect(self.ui.treeWidgetChans, QtCore.SIGNAL(
|
|
||||||
"itemChanged (QTreeWidgetItem *, int)"), self.treeWidgetItemChanged)
|
|
||||||
QtCore.QObject.connect(
|
|
||||||
self.ui.tabWidget, QtCore.SIGNAL("currentChanged(int)"),
|
|
||||||
self.tabWidgetCurrentChanged
|
|
||||||
)
|
|
||||||
|
|
||||||
# Put the colored icon on the status bar
|
# Put the colored icon on the status bar
|
||||||
# self.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png"))
|
# self.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png"))
|
||||||
self.setStatusBar(BMStatusBar())
|
self.setStatusBar(BMStatusBar())
|
||||||
self.statusbar = self.statusBar()
|
self.statusbar = self.statusBar()
|
||||||
|
|
||||||
self.pushButtonStatusIcon = QtGui.QPushButton(self)
|
self.pushButtonStatusIcon = QtWidgets.QPushButton(self)
|
||||||
self.pushButtonStatusIcon.setText('')
|
self.pushButtonStatusIcon.setText('')
|
||||||
self.pushButtonStatusIcon.setIcon(
|
self.pushButtonStatusIcon.setIcon(
|
||||||
QtGui.QIcon(':/newPrefix/images/redicon.png'))
|
QtGui.QIcon(':/newPrefix/images/redicon.png'))
|
||||||
self.pushButtonStatusIcon.setFlat(True)
|
self.pushButtonStatusIcon.setFlat(True)
|
||||||
self.statusbar.insertPermanentWidget(0, self.pushButtonStatusIcon)
|
self.statusbar.insertPermanentWidget(0, self.pushButtonStatusIcon)
|
||||||
QtCore.QObject.connect(self.pushButtonStatusIcon, QtCore.SIGNAL(
|
self.pushButtonStatusIcon.clicked.connect(
|
||||||
"clicked()"), self.click_pushButtonStatusIcon)
|
self.click_pushButtonStatusIcon)
|
||||||
|
|
||||||
self.numberOfMessagesProcessed = 0
|
self.numberOfMessagesProcessed = 0
|
||||||
self.numberOfBroadcastsProcessed = 0
|
self.numberOfBroadcastsProcessed = 0
|
||||||
|
@ -725,43 +705,40 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
# Set the icon sizes for the identicons
|
# Set the icon sizes for the identicons
|
||||||
identicon_size = 3*7
|
identicon_size = 3*7
|
||||||
self.ui.tableWidgetInbox.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
for widget in (
|
||||||
self.ui.treeWidgetChans.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.ui.tableWidgetInbox, self.ui.treeWidgetChans,
|
||||||
self.ui.treeWidgetYourIdentities.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.ui.treeWidgetYourIdentities, self.ui.treeWidgetSubscriptions,
|
||||||
self.ui.treeWidgetSubscriptions.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.ui.tableWidgetAddressBook
|
||||||
self.ui.tableWidgetAddressBook.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
):
|
||||||
|
widget.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
||||||
|
|
||||||
self.UISignalThread = UISignaler.get()
|
self.UISignalThread = UISignaler.get()
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.UISignalThread.writeNewAddressToTable.connect(
|
||||||
"writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.writeNewAddressToTable)
|
self.writeNewAddressToTable)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.UISignalThread.updateStatusBar.connect(self.updateStatusBar)
|
||||||
"updateStatusBar(PyQt_PyObject)"), self.updateStatusBar)
|
self.UISignalThread.updateSentItemStatusByToAddress.connect(
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.updateSentItemStatusByToAddress)
|
||||||
"updateSentItemStatusByToAddress(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByToAddress)
|
self.UISignalThread.updateSentItemStatusByAckdata.connect(
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.updateSentItemStatusByAckdata)
|
||||||
"updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByAckdata)
|
self.UISignalThread.displayNewInboxMessage.connect(
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.displayNewInboxMessage)
|
||||||
"displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewInboxMessage)
|
self.UISignalThread.displayNewSentMessage.connect(
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.displayNewSentMessage)
|
||||||
"displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewSentMessage)
|
self.UISignalThread.setStatusIcon.connect(self.setStatusIcon)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.UISignalThread.changedInboxUnread.connect(self.changedInboxUnread)
|
||||||
"setStatusIcon(PyQt_PyObject)"), self.setStatusIcon)
|
self.UISignalThread.rerenderMessagelistFromLabels.connect(
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.rerenderMessagelistFromLabels)
|
||||||
"changedInboxUnread(PyQt_PyObject)"), self.changedInboxUnread)
|
self.UISignalThread.rerenderMessagelistToLabels.connect(
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.rerenderMessagelistToLabels)
|
||||||
"rerenderMessagelistFromLabels()"), self.rerenderMessagelistFromLabels)
|
self.UISignalThread.rerenderAddressBook.connect(
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.rerenderAddressBook)
|
||||||
"rerenderMessgelistToLabels()"), self.rerenderMessagelistToLabels)
|
self.UISignalThread.rerenderSubscriptions.connect(
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.rerenderSubscriptions)
|
||||||
"rerenderAddressBook()"), self.rerenderAddressBook)
|
self.UISignalThread.removeInboxRowByMsgid.connect(
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.removeInboxRowByMsgid)
|
||||||
"rerenderSubscriptions()"), self.rerenderSubscriptions)
|
self.UISignalThread.newVersionAvailable.connect(
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.newVersionAvailable)
|
||||||
"removeInboxRowByMsgid(PyQt_PyObject)"), self.removeInboxRowByMsgid)
|
self.UISignalThread.displayAlert.connect(self.displayAlert)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
|
||||||
"newVersionAvailable(PyQt_PyObject)"), self.newVersionAvailable)
|
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
|
||||||
"displayAlert(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayAlert)
|
|
||||||
self.UISignalThread.start()
|
self.UISignalThread.start()
|
||||||
|
|
||||||
# Key press in tree view
|
# Key press in tree view
|
||||||
|
@ -784,7 +761,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
self.rerenderComboBoxSendFrom()
|
self.rerenderComboBoxSendFrom()
|
||||||
self.rerenderComboBoxSendFromBroadcast()
|
self.rerenderComboBoxSendFromBroadcast()
|
||||||
|
|
||||||
# Put the TTL slider in the correct spot
|
# Put the TTL slider in the correct spot
|
||||||
TTL = BMConfigParser().getint('bitmessagesettings', 'ttl')
|
TTL = BMConfigParser().getint('bitmessagesettings', 'ttl')
|
||||||
if TTL < 3600: # an hour
|
if TTL < 3600: # an hour
|
||||||
|
@ -793,12 +770,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
TTL = 28*24*60*60
|
TTL = 28*24*60*60
|
||||||
self.ui.horizontalSliderTTL.setSliderPosition((TTL - 3600) ** (1/3.199))
|
self.ui.horizontalSliderTTL.setSliderPosition((TTL - 3600) ** (1/3.199))
|
||||||
self.updateHumanFriendlyTTLDescription(TTL)
|
self.updateHumanFriendlyTTLDescription(TTL)
|
||||||
|
|
||||||
QtCore.QObject.connect(self.ui.horizontalSliderTTL, QtCore.SIGNAL(
|
|
||||||
"valueChanged(int)"), self.updateTTL)
|
|
||||||
|
|
||||||
|
self.ui.horizontalSliderTTL.valueChanged.connect(self.updateTTL)
|
||||||
self.initSettings()
|
self.initSettings()
|
||||||
|
|
||||||
# Check to see whether we can connect to namecoin. Hide the 'Fetch Namecoin ID' button if we can't.
|
# Check to see whether we can connect to namecoin. Hide the 'Fetch Namecoin ID' button if we can't.
|
||||||
try:
|
try:
|
||||||
options = {}
|
options = {}
|
||||||
|
@ -811,15 +786,17 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if nc.test()[0] == 'failed':
|
if nc.test()[0] == 'failed':
|
||||||
self.ui.pushButtonFetchNamecoinID.hide()
|
self.ui.pushButtonFetchNamecoinID.hide()
|
||||||
except:
|
except:
|
||||||
logger.error('There was a problem testing for a Namecoin daemon. Hiding the Fetch Namecoin ID button')
|
logger.error(
|
||||||
|
'There was a problem testing for a Namecoin daemon.'
|
||||||
|
' Hiding the Fetch Namecoin ID button')
|
||||||
self.ui.pushButtonFetchNamecoinID.hide()
|
self.ui.pushButtonFetchNamecoinID.hide()
|
||||||
|
|
||||||
def updateTTL(self, sliderPosition):
|
def updateTTL(self, sliderPosition):
|
||||||
TTL = int(sliderPosition ** 3.199 + 3600)
|
TTL = int(sliderPosition ** 3.199 + 3600)
|
||||||
self.updateHumanFriendlyTTLDescription(TTL)
|
self.updateHumanFriendlyTTLDescription(TTL)
|
||||||
BMConfigParser().set('bitmessagesettings', 'ttl', str(TTL))
|
BMConfigParser().set('bitmessagesettings', 'ttl', str(TTL))
|
||||||
BMConfigParser().save()
|
BMConfigParser().save()
|
||||||
|
|
||||||
def updateHumanFriendlyTTLDescription(self, TTL):
|
def updateHumanFriendlyTTLDescription(self, TTL):
|
||||||
numberOfHours = int(round(TTL / (60*60)))
|
numberOfHours = int(round(TTL / (60*60)))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
|
@ -827,15 +804,19 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
if numberOfHours < 48:
|
if numberOfHours < 48:
|
||||||
self.ui.labelHumanFriendlyTTLDescription.setText(
|
self.ui.labelHumanFriendlyTTLDescription.setText(
|
||||||
_translate("MainWindow", "%n hour(s)", None, QtCore.QCoreApplication.CodecForTr, numberOfHours) +
|
_translate(
|
||||||
", " +
|
"MainWindow", "%n hour(s)", None, numberOfHours)
|
||||||
_translate("MainWindow", "not recommended for chans", None, QtCore.QCoreApplication.CodecForTr)
|
+ ", " +
|
||||||
)
|
_translate("MainWindow", "not recommended for chans")
|
||||||
|
)
|
||||||
stylesheet = "QLabel { color : red; }"
|
stylesheet = "QLabel { color : red; }"
|
||||||
font.setBold(True)
|
font.setBold(True)
|
||||||
else:
|
else:
|
||||||
numberOfDays = int(round(TTL / (24*60*60)))
|
numberOfDays = int(round(TTL / (24*60*60)))
|
||||||
self.ui.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "%n day(s)", None, QtCore.QCoreApplication.CodecForTr, numberOfDays))
|
self.ui.labelHumanFriendlyTTLDescription.setText(
|
||||||
|
_translate(
|
||||||
|
"MainWindow", "%n day(s)", None, numberOfDays)
|
||||||
|
)
|
||||||
font.setBold(False)
|
font.setBold(False)
|
||||||
self.ui.labelHumanFriendlyTTLDescription.setStyleSheet(stylesheet)
|
self.ui.labelHumanFriendlyTTLDescription.setStyleSheet(stylesheet)
|
||||||
self.ui.labelHumanFriendlyTTLDescription.setFont(font)
|
self.ui.labelHumanFriendlyTTLDescription.setFont(font)
|
||||||
|
@ -942,8 +923,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# related = related.findItems(msgid, QtCore.Qt.MatchExactly),
|
# related = related.findItems(msgid, QtCore.Qt.MatchExactly),
|
||||||
# returns an empty list
|
# returns an empty list
|
||||||
for rrow in xrange(related.rowCount()):
|
for rrow in xrange(related.rowCount()):
|
||||||
if msgid == str(related.item(rrow, 3).data(
|
if msgid == related.item(rrow, 3).data(QtCore.Qt.UserRole):
|
||||||
QtCore.Qt.UserRole).toPyObject()):
|
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
rrow = None
|
rrow = None
|
||||||
|
@ -1027,16 +1007,19 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if sortingEnabled:
|
if sortingEnabled:
|
||||||
tableWidget.setSortingEnabled(True)
|
tableWidget.setSortingEnabled(True)
|
||||||
|
|
||||||
def addMessageListItemSent(self, tableWidget, toAddress, fromAddress, subject, status, ackdata, lastactiontime):
|
def addMessageListItemSent(
|
||||||
|
self, tableWidget, toAddress, fromAddress, subject, status,
|
||||||
|
ackdata, lastactiontime
|
||||||
|
):
|
||||||
acct = accountClass(fromAddress)
|
acct = accountClass(fromAddress)
|
||||||
if acct is None:
|
if acct is None:
|
||||||
acct = BMAccount(fromAddress)
|
acct = BMAccount(fromAddress)
|
||||||
acct.parseMessage(toAddress, fromAddress, subject, "")
|
acct.parseMessage(toAddress, fromAddress, subject, "")
|
||||||
|
|
||||||
items = []
|
items = []
|
||||||
MessageList_AddressWidget(items, str(toAddress), unicode(acct.toLabel, 'utf-8'))
|
MessageList_AddressWidget(items, toAddress, acct.toLabel)
|
||||||
MessageList_AddressWidget(items, str(fromAddress), unicode(acct.fromLabel, 'utf-8'))
|
MessageList_AddressWidget(items, fromAddress, acct.fromLabel)
|
||||||
MessageList_SubjectWidget(items, str(subject), unicode(acct.subject, 'utf-8', 'replace'))
|
MessageList_SubjectWidget(items, subject, acct.subject)
|
||||||
|
|
||||||
if status == 'awaitingpubkey':
|
if status == 'awaitingpubkey':
|
||||||
statusText = _translate(
|
statusText = _translate(
|
||||||
|
@ -1048,17 +1031,21 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
statusText = _translate(
|
statusText = _translate(
|
||||||
"MainWindow", "Queued.")
|
"MainWindow", "Queued.")
|
||||||
elif status == 'msgsent':
|
elif status == 'msgsent':
|
||||||
statusText = _translate("MainWindow", "Message sent. Waiting for acknowledgement. Sent at %1").arg(
|
statusText = _translate(
|
||||||
l10n.formatTimestamp(lastactiontime))
|
"MainWindow",
|
||||||
|
"Message sent. Waiting for acknowledgement. Sent at {0}"
|
||||||
|
).format(l10n.formatTimestamp(lastactiontime))
|
||||||
elif status == 'msgsentnoackexpected':
|
elif status == 'msgsentnoackexpected':
|
||||||
statusText = _translate("MainWindow", "Message sent. Sent at %1").arg(
|
statusText = _translate(
|
||||||
l10n.formatTimestamp(lastactiontime))
|
"MainWindow", "Message sent. Sent at {0}"
|
||||||
|
).format(l10n.formatTimestamp(lastactiontime))
|
||||||
elif status == 'doingmsgpow':
|
elif status == 'doingmsgpow':
|
||||||
statusText = _translate(
|
statusText = _translate(
|
||||||
"MainWindow", "Doing work necessary to send message.")
|
"MainWindow", "Doing work necessary to send message.")
|
||||||
elif status == 'ackreceived':
|
elif status == 'ackreceived':
|
||||||
statusText = _translate("MainWindow", "Acknowledgement of the message received %1").arg(
|
statusText = _translate(
|
||||||
l10n.formatTimestamp(lastactiontime))
|
"MainWindow", "Acknowledgement of the message received {0}"
|
||||||
|
).format(l10n.formatTimestamp(lastactiontime))
|
||||||
elif status == 'broadcastqueued':
|
elif status == 'broadcastqueued':
|
||||||
statusText = _translate(
|
statusText = _translate(
|
||||||
"MainWindow", "Broadcast queued.")
|
"MainWindow", "Broadcast queued.")
|
||||||
|
@ -1066,23 +1053,31 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
statusText = _translate(
|
statusText = _translate(
|
||||||
"MainWindow", "Doing work necessary to send broadcast.")
|
"MainWindow", "Doing work necessary to send broadcast.")
|
||||||
elif status == 'broadcastsent':
|
elif status == 'broadcastsent':
|
||||||
statusText = _translate("MainWindow", "Broadcast on %1").arg(
|
statusText = _translate("MainWindow", "Broadcast on {0}").format(
|
||||||
l10n.formatTimestamp(lastactiontime))
|
l10n.formatTimestamp(lastactiontime)
|
||||||
|
)
|
||||||
elif status == 'toodifficult':
|
elif status == 'toodifficult':
|
||||||
statusText = _translate("MainWindow", "Problem: The work demanded by the recipient is more difficult than you are willing to do. %1").arg(
|
statusText = _translate(
|
||||||
l10n.formatTimestamp(lastactiontime))
|
"MainWindow",
|
||||||
|
"Problem: The work demanded by the recipient is more"
|
||||||
|
" difficult than you are willing to do. {0}"
|
||||||
|
).format(l10n.formatTimestamp(lastactiontime))
|
||||||
elif status == 'badkey':
|
elif status == 'badkey':
|
||||||
statusText = _translate("MainWindow", "Problem: The recipient\'s encryption key is no good. Could not encrypt message. %1").arg(
|
statusText = _translate(
|
||||||
l10n.formatTimestamp(lastactiontime))
|
"MainWindow",
|
||||||
|
"Problem: The recipient\'s encryption key is no good."
|
||||||
|
" Could not encrypt message. {0}"
|
||||||
|
).format(l10n.formatTimestamp(lastactiontime))
|
||||||
elif status == 'forcepow':
|
elif status == 'forcepow':
|
||||||
statusText = _translate(
|
statusText = _translate(
|
||||||
"MainWindow", "Forced difficulty override. Send should start soon.")
|
"MainWindow", "Forced difficulty override. Send should start soon.")
|
||||||
else:
|
else:
|
||||||
statusText = _translate("MainWindow", "Unknown status: %1 %2").arg(status).arg(
|
statusText = _translate(
|
||||||
l10n.formatTimestamp(lastactiontime))
|
"MainWindow", "Unknown status: {0} {1}"
|
||||||
|
).format(status, l10n.formatTimestamp(lastactiontime))
|
||||||
newItem = myTableWidgetItem(statusText)
|
newItem = myTableWidgetItem(statusText)
|
||||||
newItem.setToolTip(statusText)
|
newItem.setToolTip(statusText)
|
||||||
newItem.setData(QtCore.Qt.UserRole, QtCore.QByteArray(ackdata))
|
newItem.setData(QtCore.Qt.UserRole, ackdata)
|
||||||
newItem.setData(33, int(lastactiontime))
|
newItem.setData(33, int(lastactiontime))
|
||||||
newItem.setFlags(
|
newItem.setFlags(
|
||||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||||
|
@ -1090,7 +1085,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.addMessageListItem(tableWidget, items)
|
self.addMessageListItem(tableWidget, items)
|
||||||
return acct
|
return acct
|
||||||
|
|
||||||
def addMessageListItemInbox(self, tableWidget, msgfolder, msgid, toAddress, fromAddress, subject, received, read):
|
def addMessageListItemInbox(
|
||||||
|
self, tableWidget, msgfolder, msgid, toAddress, fromAddress,
|
||||||
|
subject, received, read
|
||||||
|
):
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setBold(True)
|
font.setBold(True)
|
||||||
if toAddress == str_broadcast_subscribers:
|
if toAddress == str_broadcast_subscribers:
|
||||||
|
@ -1102,18 +1100,18 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if acct is None:
|
if acct is None:
|
||||||
acct = BMAccount(fromAddress)
|
acct = BMAccount(fromAddress)
|
||||||
acct.parseMessage(toAddress, fromAddress, subject, "")
|
acct.parseMessage(toAddress, fromAddress, subject, "")
|
||||||
|
|
||||||
items = []
|
items = []
|
||||||
#to
|
# to
|
||||||
MessageList_AddressWidget(items, toAddress, unicode(acct.toLabel, 'utf-8'), not read)
|
MessageList_AddressWidget(items, toAddress, acct.toLabel, not read)
|
||||||
# from
|
# from
|
||||||
MessageList_AddressWidget(items, fromAddress, unicode(acct.fromLabel, 'utf-8'), not read)
|
MessageList_AddressWidget(items, fromAddress, acct.fromLabel, not read)
|
||||||
# subject
|
# subject
|
||||||
MessageList_SubjectWidget(items, str(subject), unicode(acct.subject, 'utf-8', 'replace'), not read)
|
MessageList_SubjectWidget(items, subject, acct.subject, not read)
|
||||||
# time received
|
# time received
|
||||||
time_item = myTableWidgetItem(l10n.formatTimestamp(received))
|
time_item = myTableWidgetItem(l10n.formatTimestamp(received))
|
||||||
time_item.setToolTip(l10n.formatTimestamp(received))
|
time_item.setToolTip(l10n.formatTimestamp(received))
|
||||||
time_item.setData(QtCore.Qt.UserRole, QtCore.QByteArray(msgid))
|
time_item.setData(QtCore.Qt.UserRole, msgid)
|
||||||
time_item.setData(33, int(received))
|
time_item.setData(33, int(received))
|
||||||
time_item.setFlags(
|
time_item.setFlags(
|
||||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||||
|
@ -1144,20 +1142,28 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
tableWidget.setUpdatesEnabled(False)
|
tableWidget.setUpdatesEnabled(False)
|
||||||
tableWidget.setSortingEnabled(False)
|
tableWidget.setSortingEnabled(False)
|
||||||
tableWidget.setRowCount(0)
|
tableWidget.setRowCount(0)
|
||||||
queryreturn = helper_search.search_sql(xAddress, account, "sent", where, what, False)
|
queryreturn = helper_search.search_sql(
|
||||||
|
xAddress, account, "sent", where, what, False)
|
||||||
|
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
toAddress, fromAddress, subject, status, ackdata, lastactiontime = row
|
toAddress, fromAddress, subject, status, ackdata, lastactiontime = row
|
||||||
self.addMessageListItemSent(tableWidget, toAddress, fromAddress, subject, status, ackdata, lastactiontime)
|
self.addMessageListItemSent(
|
||||||
|
tableWidget, toAddress, fromAddress,
|
||||||
|
unicode(subject, 'utf-8'), status,
|
||||||
|
ackdata, lastactiontime
|
||||||
|
)
|
||||||
|
|
||||||
tableWidget.horizontalHeader().setSortIndicator(
|
tableWidget.horizontalHeader().setSortIndicator(
|
||||||
3, QtCore.Qt.DescendingOrder)
|
3, QtCore.Qt.DescendingOrder)
|
||||||
tableWidget.setSortingEnabled(True)
|
tableWidget.setSortingEnabled(True)
|
||||||
tableWidget.horizontalHeaderItem(3).setText(_translate("MainWindow", "Sent", None))
|
tableWidget.horizontalHeaderItem(3).setText(
|
||||||
|
_translate("MainWindow", "Sent"))
|
||||||
tableWidget.setUpdatesEnabled(True)
|
tableWidget.setUpdatesEnabled(True)
|
||||||
|
|
||||||
# Load messages from database file
|
# Load messages from database file
|
||||||
def loadMessagelist(self, tableWidget, account, folder="inbox", where="", what="", unreadOnly = False):
|
def loadMessagelist(
|
||||||
|
self, tableWidget, account,
|
||||||
|
folder="inbox", where="", what="", unreadOnly=False):
|
||||||
if folder == 'sent':
|
if folder == 'sent':
|
||||||
self.loadSent(tableWidget, account, where, what)
|
self.loadSent(tableWidget, account, where, what)
|
||||||
return
|
return
|
||||||
|
@ -1177,39 +1183,42 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
tableWidget.setSortingEnabled(False)
|
tableWidget.setSortingEnabled(False)
|
||||||
tableWidget.setRowCount(0)
|
tableWidget.setRowCount(0)
|
||||||
|
|
||||||
queryreturn = helper_search.search_sql(xAddress, account, folder, where, what, unreadOnly)
|
queryreturn = helper_search.search_sql(
|
||||||
|
xAddress, account, folder, where, what, unreadOnly)
|
||||||
|
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
msgfolder, msgid, toAddress, fromAddress, subject, received, read = row
|
msgfolder, msgid, toAddress, fromAddress, subject, received, read = row
|
||||||
self.addMessageListItemInbox(tableWidget, msgfolder, msgid, toAddress, fromAddress, subject, received, read)
|
self.addMessageListItemInbox(
|
||||||
|
tableWidget, msgfolder, msgid, toAddress, fromAddress,
|
||||||
|
unicode(subject, 'utf-8'), received, read
|
||||||
|
)
|
||||||
|
|
||||||
tableWidget.horizontalHeader().setSortIndicator(
|
tableWidget.horizontalHeader().setSortIndicator(
|
||||||
3, QtCore.Qt.DescendingOrder)
|
3, QtCore.Qt.DescendingOrder)
|
||||||
tableWidget.setSortingEnabled(True)
|
tableWidget.setSortingEnabled(True)
|
||||||
tableWidget.selectRow(0)
|
tableWidget.selectRow(0)
|
||||||
tableWidget.horizontalHeaderItem(3).setText(_translate("MainWindow", "Received", None))
|
tableWidget.horizontalHeaderItem(3).setText(
|
||||||
|
_translate("MainWindow", "Received"))
|
||||||
tableWidget.setUpdatesEnabled(True)
|
tableWidget.setUpdatesEnabled(True)
|
||||||
|
|
||||||
# create application indicator
|
# create application indicator
|
||||||
def appIndicatorInit(self, app):
|
def appIndicatorInit(self, app):
|
||||||
self.initTrayIcon("can-icon-24px-red.png", app)
|
self.initTrayIcon("can-icon-24px-red.png", app)
|
||||||
traySignal = "activated(QSystemTrayIcon::ActivationReason)"
|
self.tray.activated.connect(self.__icon_activated)
|
||||||
QtCore.QObject.connect(self.tray, QtCore.SIGNAL(
|
|
||||||
traySignal), self.__icon_activated)
|
|
||||||
|
|
||||||
m = QtGui.QMenu()
|
m = QtWidgets.QMenu()
|
||||||
|
|
||||||
self.actionStatus = QtGui.QAction(_translate(
|
self.actionStatus = QtWidgets.QAction(_translate(
|
||||||
"MainWindow", "Not Connected"), m, checkable=False)
|
"MainWindow", "Not Connected"), m, checkable=False)
|
||||||
m.addAction(self.actionStatus)
|
m.addAction(self.actionStatus)
|
||||||
|
|
||||||
# separator
|
# separator
|
||||||
actionSeparator = QtGui.QAction('', m, checkable=False)
|
actionSeparator = QtWidgets.QAction('', m, checkable=False)
|
||||||
actionSeparator.setSeparator(True)
|
actionSeparator.setSeparator(True)
|
||||||
m.addAction(actionSeparator)
|
m.addAction(actionSeparator)
|
||||||
|
|
||||||
# show bitmessage
|
# show bitmessage
|
||||||
self.actionShow = QtGui.QAction(_translate(
|
self.actionShow = QtWidgets.QAction(_translate(
|
||||||
"MainWindow", "Show Bitmessage"), m, checkable=True)
|
"MainWindow", "Show Bitmessage"), m, checkable=True)
|
||||||
self.actionShow.setChecked(not BMConfigParser().getboolean(
|
self.actionShow.setChecked(not BMConfigParser().getboolean(
|
||||||
'bitmessagesettings', 'startintray'))
|
'bitmessagesettings', 'startintray'))
|
||||||
|
@ -1218,7 +1227,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
m.addAction(self.actionShow)
|
m.addAction(self.actionShow)
|
||||||
|
|
||||||
# quiet mode
|
# quiet mode
|
||||||
self.actionQuiet = QtGui.QAction(_translate(
|
self.actionQuiet = QtWidgets.QAction(_translate(
|
||||||
"MainWindow", "Quiet Mode"), m, checkable=True)
|
"MainWindow", "Quiet Mode"), m, checkable=True)
|
||||||
self.actionQuiet.setChecked(not BMConfigParser().getboolean(
|
self.actionQuiet.setChecked(not BMConfigParser().getboolean(
|
||||||
'bitmessagesettings', 'showtraynotifications'))
|
'bitmessagesettings', 'showtraynotifications'))
|
||||||
|
@ -1226,25 +1235,25 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
m.addAction(self.actionQuiet)
|
m.addAction(self.actionQuiet)
|
||||||
|
|
||||||
# Send
|
# Send
|
||||||
actionSend = QtGui.QAction(_translate(
|
actionSend = QtWidgets.QAction(_translate(
|
||||||
"MainWindow", "Send"), m, checkable=False)
|
"MainWindow", "Send"), m, checkable=False)
|
||||||
actionSend.triggered.connect(self.appIndicatorSend)
|
actionSend.triggered.connect(self.appIndicatorSend)
|
||||||
m.addAction(actionSend)
|
m.addAction(actionSend)
|
||||||
|
|
||||||
# Subscribe
|
# Subscribe
|
||||||
actionSubscribe = QtGui.QAction(_translate(
|
actionSubscribe = QtWidgets.QAction(_translate(
|
||||||
"MainWindow", "Subscribe"), m, checkable=False)
|
"MainWindow", "Subscribe"), m, checkable=False)
|
||||||
actionSubscribe.triggered.connect(self.appIndicatorSubscribe)
|
actionSubscribe.triggered.connect(self.appIndicatorSubscribe)
|
||||||
m.addAction(actionSubscribe)
|
m.addAction(actionSubscribe)
|
||||||
|
|
||||||
# Channels
|
# Channels
|
||||||
actionSubscribe = QtGui.QAction(_translate(
|
actionSubscribe = QtWidgets.QAction(_translate(
|
||||||
"MainWindow", "Channel"), m, checkable=False)
|
"MainWindow", "Channel"), m, checkable=False)
|
||||||
actionSubscribe.triggered.connect(self.appIndicatorChannel)
|
actionSubscribe.triggered.connect(self.appIndicatorChannel)
|
||||||
m.addAction(actionSubscribe)
|
m.addAction(actionSubscribe)
|
||||||
|
|
||||||
# separator
|
# separator
|
||||||
actionSeparator = QtGui.QAction('', m, checkable=False)
|
actionSeparator = QtWidgets.QAction('', m, checkable=False)
|
||||||
actionSeparator.setSeparator(True)
|
actionSeparator.setSeparator(True)
|
||||||
m.addAction(actionSeparator)
|
m.addAction(actionSeparator)
|
||||||
|
|
||||||
|
@ -1362,8 +1371,6 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.tray.showMessage(title, subtitle, 1, 2000)
|
self.tray.showMessage(title, subtitle, 1, 2000)
|
||||||
|
|
||||||
self._notifier = _simple_notify
|
self._notifier = _simple_notify
|
||||||
# does nothing if isAvailable returns false
|
|
||||||
self._player = QtGui.QSound.play
|
|
||||||
|
|
||||||
if not get_plugins:
|
if not get_plugins:
|
||||||
return
|
return
|
||||||
|
@ -1376,7 +1383,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
self._theme_player = get_plugin('notification.sound', 'theme')
|
self._theme_player = get_plugin('notification.sound', 'theme')
|
||||||
|
|
||||||
if not QtGui.QSound.isAvailable():
|
try:
|
||||||
|
from qtpy import QtMultimedia
|
||||||
|
self._player = QtMultimedia.QSound.play
|
||||||
|
except ImportError:
|
||||||
_plugin = get_plugin(
|
_plugin = get_plugin(
|
||||||
'notification.sound', 'file', fallback='file.fallback')
|
'notification.sound', 'file', fallback='file.fallback')
|
||||||
if _plugin:
|
if _plugin:
|
||||||
|
@ -1402,17 +1412,17 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
def textEditKeyPressEvent(self, event):
|
def textEditKeyPressEvent(self, event):
|
||||||
return self.handleKeyPress(event, self.getCurrentMessageTextedit())
|
return self.handleKeyPress(event, self.getCurrentMessageTextedit())
|
||||||
|
|
||||||
def handleKeyPress(self, event, focus = None):
|
def handleKeyPress(self, event, focus=None):
|
||||||
messagelist = self.getCurrentMessagelist()
|
messagelist = self.getCurrentMessagelist()
|
||||||
folder = self.getCurrentFolder()
|
folder = self.getCurrentFolder()
|
||||||
if event.key() == QtCore.Qt.Key_Delete:
|
if event.key() == QtCore.Qt.Key_Delete:
|
||||||
if isinstance (focus, MessageView) or isinstance(focus, QtGui.QTableWidget):
|
if isinstance(focus, MessageView) or isinstance(focus, QtWidgets.QTableWidget):
|
||||||
if folder == "sent":
|
if folder == "sent":
|
||||||
self.on_action_SentTrash()
|
self.on_action_SentTrash()
|
||||||
else:
|
else:
|
||||||
self.on_action_InboxTrash()
|
self.on_action_InboxTrash()
|
||||||
event.ignore()
|
event.ignore()
|
||||||
elif QtGui.QApplication.queryKeyboardModifiers() == QtCore.Qt.NoModifier:
|
elif QtWidgets.QApplication.queryKeyboardModifiers() == QtCore.Qt.NoModifier:
|
||||||
if event.key() == QtCore.Qt.Key_N:
|
if event.key() == QtCore.Qt.Key_N:
|
||||||
currentRow = messagelist.currentRow()
|
currentRow = messagelist.currentRow()
|
||||||
if currentRow < messagelist.rowCount() - 1:
|
if currentRow < messagelist.rowCount() - 1:
|
||||||
|
@ -1442,46 +1452,79 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.lineEditTo.setFocus()
|
self.ui.lineEditTo.setFocus()
|
||||||
event.ignore()
|
event.ignore()
|
||||||
elif event.key() == QtCore.Qt.Key_F:
|
elif event.key() == QtCore.Qt.Key_F:
|
||||||
searchline = self.getCurrentSearchLine(retObj = True)
|
searchline = self.getCurrentSearchLine(retObj=True)
|
||||||
if searchline:
|
if searchline:
|
||||||
searchline.setFocus()
|
searchline.setFocus()
|
||||||
event.ignore()
|
event.ignore()
|
||||||
if not event.isAccepted():
|
if not event.isAccepted():
|
||||||
return
|
return
|
||||||
if isinstance (focus, MessageView):
|
if isinstance(focus, MessageView):
|
||||||
return MessageView.keyPressEvent(focus, event)
|
return MessageView.keyPressEvent(focus, event)
|
||||||
elif isinstance (focus, QtGui.QTableWidget):
|
elif isinstance(focus, QtWidgets.QTableWidget):
|
||||||
return QtGui.QTableWidget.keyPressEvent(focus, event)
|
return QtWidgets.QTableWidget.keyPressEvent(focus, event)
|
||||||
elif isinstance (focus, QtGui.QTreeWidget):
|
elif isinstance(focus, QtWidgets.QTreeWidget):
|
||||||
return QtGui.QTreeWidget.keyPressEvent(focus, event)
|
return QtWidgets.QTreeWidget.keyPressEvent(focus, event)
|
||||||
|
|
||||||
# menu button 'manage keys'
|
# menu button 'manage keys'
|
||||||
def click_actionManageKeys(self):
|
def click_actionManageKeys(self):
|
||||||
if 'darwin' in sys.platform or 'linux' in sys.platform:
|
if 'darwin' in sys.platform or 'linux' in sys.platform:
|
||||||
if state.appdata == '':
|
if state.appdata == '':
|
||||||
# reply = QtGui.QMessageBox.information(self, 'keys.dat?','You
|
# reply = QtWidgets.QMessageBox.information(self, 'keys.dat?','You
|
||||||
# may manage your keys by editing the keys.dat file stored in
|
# may manage your keys by editing the keys.dat file stored in
|
||||||
# the same directory as this program. It is important that you
|
# the same directory as this program. It is important that you
|
||||||
# back up this file.', QMessageBox.Ok)
|
# back up this file.', QMessageBox.Ok)
|
||||||
reply = QtGui.QMessageBox.information(self, 'keys.dat?', _translate(
|
reply = QtWidgets.QMessageBox.information(
|
||||||
"MainWindow", "You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file."), QtGui.QMessageBox.Ok)
|
self, 'keys.dat?', _translate(
|
||||||
|
"MainWindow",
|
||||||
|
"You may manage your keys by editing the keys.dat"
|
||||||
|
" file stored in the same directory as this"
|
||||||
|
" program. It is important that you back up this"
|
||||||
|
" file."), QtWidgets.QMessageBox.Ok)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
QtGui.QMessageBox.information(self, 'keys.dat?', _translate(
|
QtWidgets.QMessageBox.information(
|
||||||
"MainWindow", "You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important that you back up this file.").arg(state.appdata), QtGui.QMessageBox.Ok)
|
self, 'keys.dat?',
|
||||||
|
_translate(
|
||||||
|
"MainWindow",
|
||||||
|
"You may manage your keys by editing the keys.dat"
|
||||||
|
" file stored in\n {0} \nIt is important that you"
|
||||||
|
" back up this file."
|
||||||
|
).format(state.appdata),
|
||||||
|
QtWidgets.QMessageBox.Ok
|
||||||
|
)
|
||||||
elif sys.platform == 'win32' or sys.platform == 'win64':
|
elif sys.platform == 'win32' or sys.platform == 'win64':
|
||||||
if state.appdata == '':
|
if state.appdata == '':
|
||||||
reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Open keys.dat?"), _translate(
|
reply = QtWidgets.QMessageBox.question(
|
||||||
"MainWindow", "You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
self, _translate("MainWindow", "Open keys.dat?"),
|
||||||
|
_translate(
|
||||||
|
"MainWindow",
|
||||||
|
"You may manage your keys by editing the keys.dat"
|
||||||
|
" file stored in the same directory as this"
|
||||||
|
" program. It is important that you back up this"
|
||||||
|
" file. Would you like to open the file now?"
|
||||||
|
" (Be sure to close Bitmessage before making any"
|
||||||
|
" changes.)"
|
||||||
|
), QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)
|
||||||
else:
|
else:
|
||||||
reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Open keys.dat?"), _translate(
|
reply = QtWidgets.QMessageBox.question(
|
||||||
"MainWindow", "You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)").arg(state.appdata), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
self,
|
||||||
if reply == QtGui.QMessageBox.Yes:
|
_translate("MainWindow", "Open keys.dat?"),
|
||||||
|
_translate(
|
||||||
|
"MainWindow",
|
||||||
|
"You may manage your keys by editing the keys.dat"
|
||||||
|
" file stored in\n {0} \nIt is important that you"
|
||||||
|
" back up this file. Would you like to open the"
|
||||||
|
" file now? (Be sure to close Bitmessage before"
|
||||||
|
" making any changes.)"
|
||||||
|
).format(state.appdata),
|
||||||
|
QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No
|
||||||
|
)
|
||||||
|
if reply == QtWidgets.QMessageBox.Yes:
|
||||||
shared.openKeysFile()
|
shared.openKeysFile()
|
||||||
|
|
||||||
# menu button 'delete all treshed messages'
|
# menu button 'delete all treshed messages'
|
||||||
def click_actionDeleteAllTrashedMessages(self):
|
def click_actionDeleteAllTrashedMessages(self):
|
||||||
if QtGui.QMessageBox.question(self, _translate("MainWindow", "Delete trash?"), _translate("MainWindow", "Are you sure you want to delete all trashed messages?"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
|
if QtWidgets.QMessageBox.question(self, _translate("MainWindow", "Delete trash?"), _translate("MainWindow", "Are you sure you want to delete all trashed messages?"), QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No) == QtWidgets.QMessageBox.No:
|
||||||
return
|
return
|
||||||
sqlStoredProcedure('deleteandvacuume')
|
sqlStoredProcedure('deleteandvacuume')
|
||||||
self.rerenderTabTreeMessages()
|
self.rerenderTabTreeMessages()
|
||||||
|
@ -1499,7 +1542,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
dialog = dialogs.RegenerateAddressesDialog(self)
|
dialog = dialogs.RegenerateAddressesDialog(self)
|
||||||
if dialog.exec_():
|
if dialog.exec_():
|
||||||
if dialog.lineEditPassphrase.text() == "":
|
if dialog.lineEditPassphrase.text() == "":
|
||||||
QtGui.QMessageBox.about(
|
QtWidgets.QMessageBox.about(
|
||||||
self, _translate("MainWindow", "bad passphrase"),
|
self, _translate("MainWindow", "bad passphrase"),
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -1512,7 +1555,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
addressVersionNumber = int(
|
addressVersionNumber = int(
|
||||||
dialog.lineEditAddressVersionNumber.text())
|
dialog.lineEditAddressVersionNumber.text())
|
||||||
except:
|
except:
|
||||||
QtGui.QMessageBox.about(
|
QtWidgets.QMessageBox.about(
|
||||||
self,
|
self,
|
||||||
_translate("MainWindow", "Bad address version number"),
|
_translate("MainWindow", "Bad address version number"),
|
||||||
_translate(
|
_translate(
|
||||||
|
@ -1522,7 +1565,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
))
|
))
|
||||||
return
|
return
|
||||||
if addressVersionNumber < 3 or addressVersionNumber > 4:
|
if addressVersionNumber < 3 or addressVersionNumber > 4:
|
||||||
QtGui.QMessageBox.about(
|
QtWidgets.QMessageBox.about(
|
||||||
self,
|
self,
|
||||||
_translate("MainWindow", "Bad address version number"),
|
_translate("MainWindow", "Bad address version number"),
|
||||||
_translate(
|
_translate(
|
||||||
|
@ -1535,7 +1578,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
addressVersionNumber, streamNumberForAddress,
|
addressVersionNumber, streamNumberForAddress,
|
||||||
"regenerated deterministic address",
|
"regenerated deterministic address",
|
||||||
dialog.spinBoxNumberOfAddressesToMake.value(),
|
dialog.spinBoxNumberOfAddressesToMake.value(),
|
||||||
dialog.lineEditPassphrase.text().toUtf8(),
|
dialog.lineEditPassphrase.text().encode('utf-8'),
|
||||||
dialog.checkBoxEighteenByteRipe.isChecked()
|
dialog.checkBoxEighteenByteRipe.isChecked()
|
||||||
))
|
))
|
||||||
self.ui.tabWidget.setCurrentIndex(
|
self.ui.tabWidget.setCurrentIndex(
|
||||||
|
@ -1583,10 +1626,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# The window state has just been changed to
|
# The window state has just been changed to
|
||||||
# Normal/Maximised/FullScreen
|
# Normal/Maximised/FullScreen
|
||||||
pass
|
pass
|
||||||
# QtGui.QWidget.changeEvent(self, event)
|
# QtWidgets.QWidget.changeEvent(self, event)
|
||||||
|
|
||||||
def __icon_activated(self, reason):
|
def __icon_activated(self, reason):
|
||||||
if reason == QtGui.QSystemTrayIcon.Trigger:
|
if reason == QtWidgets.QSystemTrayIcon.Trigger:
|
||||||
self.actionShow.setChecked(not self.actionShow.isChecked())
|
self.actionShow.setChecked(not self.actionShow.isChecked())
|
||||||
self.appIndicatorShowOrHideWindow()
|
self.appIndicatorShowOrHideWindow()
|
||||||
|
|
||||||
|
@ -1659,7 +1702,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
def initTrayIcon(self, iconFileName, app):
|
def initTrayIcon(self, iconFileName, app):
|
||||||
self.currentTrayIconFileName = iconFileName
|
self.currentTrayIconFileName = iconFileName
|
||||||
self.tray = QtGui.QSystemTrayIcon(
|
self.tray = QtWidgets.QSystemTrayIcon(
|
||||||
self.calcTrayIcon(iconFileName, self.findInboxUnreadCount()), app)
|
self.calcTrayIcon(iconFileName, self.findInboxUnreadCount()), app)
|
||||||
|
|
||||||
def setTrayIconFile(self, iconFileName):
|
def setTrayIconFile(self, iconFileName):
|
||||||
|
@ -1667,7 +1710,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.drawTrayIcon(iconFileName, self.findInboxUnreadCount())
|
self.drawTrayIcon(iconFileName, self.findInboxUnreadCount())
|
||||||
|
|
||||||
def calcTrayIcon(self, iconFileName, inboxUnreadCount):
|
def calcTrayIcon(self, iconFileName, inboxUnreadCount):
|
||||||
pixmap = QtGui.QPixmap(":/newPrefix/images/"+iconFileName)
|
pixmap = QtGui.QPixmap(":/newPrefix/images/" + iconFileName)
|
||||||
if inboxUnreadCount > 0:
|
if inboxUnreadCount > 0:
|
||||||
# choose font and calculate font parameters
|
# choose font and calculate font parameters
|
||||||
fontName = "Lucida"
|
fontName = "Lucida"
|
||||||
|
@ -1679,7 +1722,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
rect = fontMetrics.boundingRect(txt)
|
rect = fontMetrics.boundingRect(txt)
|
||||||
# margins that we add in the top-right corner
|
# margins that we add in the top-right corner
|
||||||
marginX = 2
|
marginX = 2
|
||||||
marginY = 0 # it looks like -2 is also ok due to the error of metric
|
# it looks like -2 is also ok due to the error of metric
|
||||||
|
marginY = 0
|
||||||
# if it renders too wide we need to change it to a plus symbol
|
# if it renders too wide we need to change it to a plus symbol
|
||||||
if rect.width() > 20:
|
if rect.width() > 20:
|
||||||
txt = "+"
|
txt = "+"
|
||||||
|
@ -1688,6 +1732,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
fontMetrics = QtGui.QFontMetrics(font)
|
fontMetrics = QtGui.QFontMetrics(font)
|
||||||
rect = fontMetrics.boundingRect(txt)
|
rect = fontMetrics.boundingRect(txt)
|
||||||
# draw text
|
# draw text
|
||||||
|
# painter = QtGui.QPainter(self)
|
||||||
painter = QtGui.QPainter()
|
painter = QtGui.QPainter()
|
||||||
painter.begin(pixmap)
|
painter.begin(pixmap)
|
||||||
painter.setPen(
|
painter.setPen(
|
||||||
|
@ -1719,11 +1764,18 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
return self.unreadCount
|
return self.unreadCount
|
||||||
|
|
||||||
def updateSentItemStatusByToAddress(self, toAddress, textToDisplay):
|
def updateSentItemStatusByToAddress(self, toAddress, textToDisplay):
|
||||||
for sent in [self.ui.tableWidgetInbox, self.ui.tableWidgetInboxSubscriptions, self.ui.tableWidgetInboxChans]:
|
for sent in (
|
||||||
|
self.ui.tableWidgetInbox,
|
||||||
|
self.ui.tableWidgetInboxSubscriptions,
|
||||||
|
self.ui.tableWidgetInboxChans
|
||||||
|
):
|
||||||
treeWidget = self.widgetConvert(sent)
|
treeWidget = self.widgetConvert(sent)
|
||||||
if self.getCurrentFolder(treeWidget) != "sent":
|
if self.getCurrentFolder(treeWidget) != "sent":
|
||||||
continue
|
continue
|
||||||
if treeWidget in [self.ui.treeWidgetSubscriptions, self.ui.treeWidgetChans] and self.getCurrentAccount(treeWidget) != toAddress:
|
if treeWidget in (
|
||||||
|
self.ui.treeWidgetSubscriptions,
|
||||||
|
self.ui.treeWidgetChans
|
||||||
|
) and self.getCurrentAccount(treeWidget) != toAddress:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
for i in range(sent.rowCount()):
|
for i in range(sent.rowCount()):
|
||||||
|
@ -1731,8 +1783,11 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if toAddress == rowAddress:
|
if toAddress == rowAddress:
|
||||||
sent.item(i, 3).setToolTip(textToDisplay)
|
sent.item(i, 3).setToolTip(textToDisplay)
|
||||||
try:
|
try:
|
||||||
newlinePosition = textToDisplay.indexOf('\n')
|
newlinePosition = textToDisplay.find('\n')
|
||||||
except: # If someone misses adding a "_translate" to a string before passing it to this function, this function won't receive a qstring which will cause an exception.
|
# If someone misses adding a "_translate" to a string
|
||||||
|
# before passing it to this function
|
||||||
|
# ? why textToDisplay isn't unicode
|
||||||
|
except AttributeError:
|
||||||
newlinePosition = 0
|
newlinePosition = 0
|
||||||
if newlinePosition > 1:
|
if newlinePosition > 1:
|
||||||
sent.item(i, 3).setText(
|
sent.item(i, 3).setText(
|
||||||
|
@ -1741,9 +1796,11 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
sent.item(i, 3).setText(textToDisplay)
|
sent.item(i, 3).setText(textToDisplay)
|
||||||
|
|
||||||
def updateSentItemStatusByAckdata(self, ackdata, textToDisplay):
|
def updateSentItemStatusByAckdata(self, ackdata, textToDisplay):
|
||||||
if type(ackdata) is str:
|
for sent in (
|
||||||
ackdata = QtCore.QByteArray(ackdata)
|
self.ui.tableWidgetInbox,
|
||||||
for sent in [self.ui.tableWidgetInbox, self.ui.tableWidgetInboxSubscriptions, self.ui.tableWidgetInboxChans]:
|
self.ui.tableWidgetInboxSubscriptions,
|
||||||
|
self.ui.tableWidgetInboxChans
|
||||||
|
):
|
||||||
treeWidget = self.widgetConvert(sent)
|
treeWidget = self.widgetConvert(sent)
|
||||||
if self.getCurrentFolder(treeWidget) != "sent":
|
if self.getCurrentFolder(treeWidget) != "sent":
|
||||||
continue
|
continue
|
||||||
|
@ -1751,14 +1808,18 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
toAddress = sent.item(
|
toAddress = sent.item(
|
||||||
i, 0).data(QtCore.Qt.UserRole)
|
i, 0).data(QtCore.Qt.UserRole)
|
||||||
tableAckdata = sent.item(
|
tableAckdata = sent.item(
|
||||||
i, 3).data(QtCore.Qt.UserRole).toPyObject()
|
i, 3).data(QtCore.Qt.UserRole)
|
||||||
status, addressVersionNumber, streamNumber, ripe = decodeAddress(
|
status, addressVersionNumber, streamNumber, ripe = decodeAddress(
|
||||||
toAddress)
|
toAddress)
|
||||||
|
|
||||||
if ackdata == tableAckdata:
|
if ackdata == tableAckdata:
|
||||||
sent.item(i, 3).setToolTip(textToDisplay)
|
sent.item(i, 3).setToolTip(textToDisplay)
|
||||||
try:
|
try:
|
||||||
newlinePosition = textToDisplay.indexOf('\n')
|
newlinePosition = textToDisplay.find('\n')
|
||||||
except: # If someone misses adding a "_translate" to a string before passing it to this function, this function won't receive a qstring which will cause an exception.
|
# If someone misses adding a "_translate" to a string
|
||||||
|
# before passing it to this function
|
||||||
|
# ? why textToDisplay isn't unicode
|
||||||
|
except AttributeError:
|
||||||
newlinePosition = 0
|
newlinePosition = 0
|
||||||
if newlinePosition > 1:
|
if newlinePosition > 1:
|
||||||
sent.item(i, 3).setText(
|
sent.item(i, 3).setText(
|
||||||
|
@ -1766,17 +1827,19 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
else:
|
else:
|
||||||
sent.item(i, 3).setText(textToDisplay)
|
sent.item(i, 3).setText(textToDisplay)
|
||||||
|
|
||||||
def removeInboxRowByMsgid(self, msgid): # msgid and inventoryHash are the same thing
|
# msgid and inventoryHash are the same thing
|
||||||
for inbox in ([
|
def removeInboxRowByMsgid(self, msgid):
|
||||||
|
for inbox in (
|
||||||
self.ui.tableWidgetInbox,
|
self.ui.tableWidgetInbox,
|
||||||
self.ui.tableWidgetInboxSubscriptions,
|
self.ui.tableWidgetInboxSubscriptions,
|
||||||
self.ui.tableWidgetInboxChans]):
|
self.ui.tableWidgetInboxChans
|
||||||
|
):
|
||||||
for i in range(inbox.rowCount()):
|
for i in range(inbox.rowCount()):
|
||||||
if msgid == str(inbox.item(i, 3).data(QtCore.Qt.UserRole).toPyObject()):
|
if msgid == str(inbox.item(i, 3).data(QtCore.Qt.UserRole)):
|
||||||
self.updateStatusBar(
|
self.updateStatusBar(
|
||||||
_translate("MainWindow", "Message trashed"))
|
_translate("MainWindow", "Message trashed"))
|
||||||
treeWidget = self.widgetConvert(inbox)
|
# treeWidget = self.widgetConvert(inbox)
|
||||||
self.propagateUnreadCount(inbox.item(i, 1 if inbox.item(i, 1).type == AccountMixin.SUBSCRIPTION else 0).data(QtCore.Qt.UserRole), self.getCurrentFolder(treeWidget), treeWidget, 0)
|
self.propagateUnreadCount()
|
||||||
inbox.removeRow(i)
|
inbox.removeRow(i)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -1784,33 +1847,42 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.notifiedNewVersion = ".".join(str(n) for n in version)
|
self.notifiedNewVersion = ".".join(str(n) for n in version)
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"New version of PyBitmessage is available: %1. Download it"
|
"New version of PyBitmessage is available: {0}. Download it"
|
||||||
" from https://github.com/Bitmessage/PyBitmessage/releases/latest"
|
" from https://github.com/Bitmessage/PyBitmessage/releases/latest"
|
||||||
).arg(self.notifiedNewVersion)
|
).format(self.notifiedNewVersion)
|
||||||
)
|
)
|
||||||
|
|
||||||
def displayAlert(self, title, text, exitAfterUserClicksOk):
|
def displayAlert(self, title, text, exitAfterUserClicksOk):
|
||||||
self.updateStatusBar(text)
|
self.updateStatusBar(text)
|
||||||
QtGui.QMessageBox.critical(self, title, text, QtGui.QMessageBox.Ok)
|
QtWidgets.QMessageBox.critical(
|
||||||
|
self, title, text, QtWidgets.QMessageBox.Ok)
|
||||||
if exitAfterUserClicksOk:
|
if exitAfterUserClicksOk:
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
def rerenderMessagelistFromLabels(self):
|
def rerenderMessagelistFromLabels(self):
|
||||||
for messagelist in (self.ui.tableWidgetInbox, self.ui.tableWidgetInboxChans, self.ui.tableWidgetInboxSubscriptions):
|
for messagelist in (
|
||||||
|
self.ui.tableWidgetInbox,
|
||||||
|
self.ui.tableWidgetInboxChans,
|
||||||
|
self.ui.tableWidgetInboxSubscriptions
|
||||||
|
):
|
||||||
for i in range(messagelist.rowCount()):
|
for i in range(messagelist.rowCount()):
|
||||||
messagelist.item(i, 1).setLabel()
|
messagelist.item(i, 1).setLabel()
|
||||||
|
|
||||||
def rerenderMessagelistToLabels(self):
|
def rerenderMessagelistToLabels(self):
|
||||||
for messagelist in (self.ui.tableWidgetInbox, self.ui.tableWidgetInboxChans, self.ui.tableWidgetInboxSubscriptions):
|
for messagelist in (
|
||||||
|
self.ui.tableWidgetInbox,
|
||||||
|
self.ui.tableWidgetInboxChans,
|
||||||
|
self.ui.tableWidgetInboxSubscriptions
|
||||||
|
):
|
||||||
for i in range(messagelist.rowCount()):
|
for i in range(messagelist.rowCount()):
|
||||||
messagelist.item(i, 0).setLabel()
|
messagelist.item(i, 0).setLabel()
|
||||||
|
|
||||||
def rerenderAddressBook(self):
|
def rerenderAddressBook(self):
|
||||||
def addRow (address, label, type):
|
def addRow(address, label, type):
|
||||||
self.ui.tableWidgetAddressBook.insertRow(0)
|
self.ui.tableWidgetAddressBook.insertRow(0)
|
||||||
newItem = Ui_AddressBookWidgetItemLabel(address, unicode(label, 'utf-8'), type)
|
newItem = Ui_AddressBookWidgetItemLabel(address, label, type)
|
||||||
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
|
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
|
||||||
newItem = Ui_AddressBookWidgetItemAddress(address, unicode(label, 'utf-8'), type)
|
newItem = Ui_AddressBookWidgetItemAddress(address, label, type)
|
||||||
self.ui.tableWidgetAddressBook.setItem(0, 1, newItem)
|
self.ui.tableWidgetAddressBook.setItem(0, 1, newItem)
|
||||||
|
|
||||||
oldRows = {}
|
oldRows = {}
|
||||||
|
@ -1828,29 +1900,34 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
queryreturn = sqlQuery('SELECT label, address FROM subscriptions WHERE enabled = 1')
|
queryreturn = sqlQuery('SELECT label, address FROM subscriptions WHERE enabled = 1')
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
label, address = row
|
label, address = row
|
||||||
newRows[address] = [label, AccountMixin.SUBSCRIPTION]
|
newRows[address] = [unicode(label, 'utf-8'), AccountMixin.SUBSCRIPTION]
|
||||||
# chans
|
# chans
|
||||||
addresses = getSortedAccounts()
|
addresses = getSortedAccounts()
|
||||||
for address in addresses:
|
for address in addresses:
|
||||||
account = accountClass(address)
|
account = accountClass(address)
|
||||||
if (account.type == AccountMixin.CHAN and BMConfigParser().safeGetBoolean(address, 'enabled')):
|
if (
|
||||||
|
account.type == AccountMixin.CHAN
|
||||||
|
and BMConfigParser().safeGetBoolean(address, 'enabled')
|
||||||
|
):
|
||||||
newRows[address] = [account.getLabel(), AccountMixin.CHAN]
|
newRows[address] = [account.getLabel(), AccountMixin.CHAN]
|
||||||
# normal accounts
|
# normal accounts
|
||||||
queryreturn = sqlQuery('SELECT * FROM addressbook')
|
queryreturn = sqlQuery('SELECT * FROM addressbook')
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
label, address = row
|
label, address = row
|
||||||
newRows[address] = [label, AccountMixin.NORMAL]
|
newRows[address] = [unicode(label, 'utf-8'), AccountMixin.NORMAL]
|
||||||
|
|
||||||
completerList = []
|
completerList = []
|
||||||
for address in sorted(oldRows, key = lambda x: oldRows[x][2], reverse = True):
|
for address in sorted(
|
||||||
|
oldRows, key=lambda x: oldRows[x][2], reverse=True
|
||||||
|
):
|
||||||
if address in newRows:
|
if address in newRows:
|
||||||
completerList.append(unicode(newRows[address][0], encoding="UTF-8") + " <" + address + ">")
|
completerList.append(
|
||||||
newRows.pop(address)
|
newRows.pop(address)[0] + " <" + address + ">")
|
||||||
else:
|
else:
|
||||||
self.ui.tableWidgetAddressBook.removeRow(oldRows[address][2])
|
self.ui.tableWidgetAddressBook.removeRow(oldRows[address][2])
|
||||||
for address in newRows:
|
for address in newRows:
|
||||||
addRow(address, newRows[address][0], newRows[address][1])
|
addRow(address, newRows[address][0], newRows[address][1])
|
||||||
completerList.append(unicode(newRows[address][0], encoding="UTF-8") + " <" + address + ">")
|
completerList.append(newRows[address][0] + " <" + address + ">")
|
||||||
|
|
||||||
# sort
|
# sort
|
||||||
self.ui.tableWidgetAddressBook.sortByColumn(
|
self.ui.tableWidgetAddressBook.sortByColumn(
|
||||||
|
@ -1862,11 +1939,11 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.rerenderTabTreeSubscriptions()
|
self.rerenderTabTreeSubscriptions()
|
||||||
|
|
||||||
def click_pushButtonTTL(self):
|
def click_pushButtonTTL(self):
|
||||||
QtGui.QMessageBox.information(self, 'Time To Live', _translate(
|
QtWidgets.QMessageBox.information(self, 'Time To Live', _translate(
|
||||||
"MainWindow", """The TTL, or Time-To-Live is the length of time that the network will hold the message.
|
"MainWindow", """The TTL, or Time-To-Live is the length of time that the network will hold the message.
|
||||||
The recipient must get it during this time. If your Bitmessage client does not hear an acknowledgement, it
|
The recipient must get it during this time. If your Bitmessage client does not hear an acknowledgement, it
|
||||||
will resend the message automatically. The longer the Time-To-Live, the
|
will resend the message automatically. The longer the Time-To-Live, the
|
||||||
more work your computer must do to send the message. A Time-To-Live of four or five days is often appropriate."""), QtGui.QMessageBox.Ok)
|
more work your computer must do to send the message. A Time-To-Live of four or five days is often appropriate."""), QtWidgets.QMessageBox.Ok)
|
||||||
|
|
||||||
def click_pushButtonClear(self):
|
def click_pushButtonClear(self):
|
||||||
self.ui.lineEditSubject.setText("")
|
self.ui.lineEditSubject.setText("")
|
||||||
|
@ -1875,7 +1952,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.comboBoxSendFrom.setCurrentIndex(0)
|
self.ui.comboBoxSendFrom.setCurrentIndex(0)
|
||||||
|
|
||||||
def click_pushButtonSend(self):
|
def click_pushButtonSend(self):
|
||||||
encoding = 3 if QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier else 2
|
encoding = 3 if QtWidgets.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier else 2
|
||||||
|
|
||||||
self.statusbar.clearMessage()
|
self.statusbar.clearMessage()
|
||||||
|
|
||||||
|
@ -1883,22 +1960,21 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.tabWidgetSend.indexOf(self.ui.sendDirect):
|
self.ui.tabWidgetSend.indexOf(self.ui.sendDirect):
|
||||||
# message to specific people
|
# message to specific people
|
||||||
sendMessageToPeople = True
|
sendMessageToPeople = True
|
||||||
fromAddress = str(self.ui.comboBoxSendFrom.itemData(
|
fromAddress = self.ui.comboBoxSendFrom.itemData(
|
||||||
self.ui.comboBoxSendFrom.currentIndex(),
|
self.ui.comboBoxSendFrom.currentIndex(),
|
||||||
QtCore.Qt.UserRole).toString())
|
QtCore.Qt.UserRole)
|
||||||
toAddresses = str(self.ui.lineEditTo.text().toUtf8())
|
toAddresses = self.ui.lineEditTo.text()
|
||||||
subject = str(self.ui.lineEditSubject.text().toUtf8())
|
subject = self.ui.lineEditSubject.text()
|
||||||
message = str(
|
message = self.ui.textEditMessage.document().toPlainText()
|
||||||
self.ui.textEditMessage.document().toPlainText().toUtf8())
|
|
||||||
else:
|
else:
|
||||||
# broadcast message
|
# broadcast message
|
||||||
sendMessageToPeople = False
|
sendMessageToPeople = False
|
||||||
fromAddress = str(self.ui.comboBoxSendFromBroadcast.itemData(
|
fromAddress = self.ui.comboBoxSendFromBroadcast.itemData(
|
||||||
self.ui.comboBoxSendFromBroadcast.currentIndex(),
|
self.ui.comboBoxSendFromBroadcast.currentIndex(),
|
||||||
QtCore.Qt.UserRole).toString())
|
QtCore.Qt.UserRole)
|
||||||
subject = str(self.ui.lineEditSubjectBroadcast.text().toUtf8())
|
subject = self.ui.lineEditSubjectBroadcast.text()
|
||||||
message = str(
|
message = \
|
||||||
self.ui.textEditMessageBroadcast.document().toPlainText().toUtf8())
|
self.ui.textEditMessageBroadcast.document().toPlainText()
|
||||||
"""
|
"""
|
||||||
The whole network message must fit in 2^18 bytes.
|
The whole network message must fit in 2^18 bytes.
|
||||||
Let's assume 500 bytes of overhead. If someone wants to get that
|
Let's assume 500 bytes of overhead. If someone wants to get that
|
||||||
|
@ -1907,23 +1983,27 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
users can send messages of any length.
|
users can send messages of any length.
|
||||||
"""
|
"""
|
||||||
if len(message) > (2 ** 18 - 500):
|
if len(message) > (2 ** 18 - 500):
|
||||||
QtGui.QMessageBox.about(
|
QtWidgets.QMessageBox.about(
|
||||||
self, _translate("MainWindow", "Message too long"),
|
self, _translate("MainWindow", "Message too long"),
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"The message that you are trying to send is too long"
|
"The message that you are trying to send is too long"
|
||||||
" by %1 bytes. (The maximum is 261644 bytes). Please"
|
" by {0} bytes. (The maximum is 261644 bytes). Please"
|
||||||
" cut it down before sending."
|
" cut it down before sending."
|
||||||
).arg(len(message) - (2 ** 18 - 500)))
|
).format(len(message) - (2 ** 18 - 500)))
|
||||||
return
|
return
|
||||||
|
|
||||||
acct = accountClass(fromAddress)
|
acct = accountClass(fromAddress)
|
||||||
|
|
||||||
if sendMessageToPeople: # To send a message to specific people (rather than broadcast)
|
# To send a message to specific people (rather than broadcast)
|
||||||
toAddressesList = [s.strip()
|
if sendMessageToPeople:
|
||||||
for s in toAddresses.replace(',', ';').split(';')]
|
toAddressesList = [
|
||||||
toAddressesList = list(set(
|
s.strip() for s in toAddresses.replace(',', ';').split(';')
|
||||||
toAddressesList)) # remove duplicate addresses. If the user has one address with a BM- and the same address without the BM-, this will not catch it. They'll send the message to the person twice.
|
]
|
||||||
|
# remove duplicate addresses. If the user has one address
|
||||||
|
# with a BM- and the same address without the BM-, this will
|
||||||
|
# not catch it. They'll send the message to the person twice.
|
||||||
|
toAddressesList = list(set(toAddressesList))
|
||||||
for toAddress in toAddressesList:
|
for toAddress in toAddressesList:
|
||||||
if toAddress != '':
|
if toAddress != '':
|
||||||
# label plus address
|
# label plus address
|
||||||
|
@ -1932,18 +2012,32 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# email address
|
# email address
|
||||||
if toAddress.find("@") >= 0:
|
if toAddress.find("@") >= 0:
|
||||||
if isinstance(acct, GatewayAccount):
|
if isinstance(acct, GatewayAccount):
|
||||||
acct.createMessage(toAddress, fromAddress, subject, message)
|
acct.createMessage(
|
||||||
|
toAddress, fromAddress, subject, message)
|
||||||
subject = acct.subject
|
subject = acct.subject
|
||||||
toAddress = acct.toAddress
|
toAddress = acct.toAddress
|
||||||
else:
|
else:
|
||||||
if QtGui.QMessageBox.question(self, "Sending an email?", _translate("MainWindow",
|
if QtWidgets.QMessageBox.question(
|
||||||
"You are trying to send an email instead of a bitmessage. This requires registering with a gateway. Attempt to register?"),
|
self, "Sending an email?",
|
||||||
QtGui.QMessageBox.Yes|QtGui.QMessageBox.No) != QtGui.QMessageBox.Yes:
|
_translate(
|
||||||
|
"MainWindow",
|
||||||
|
"You are trying to send an email"
|
||||||
|
" instead of a bitmessage. This"
|
||||||
|
" requires registering with a"
|
||||||
|
" gateway. Attempt to register?"
|
||||||
|
), QtWidgets.QMessageBox.Yes
|
||||||
|
| QtWidgets.QMessageBox.No
|
||||||
|
) != QtWidgets.QMessageBox.Yes:
|
||||||
continue
|
continue
|
||||||
email = acct.getLabel()
|
email = acct.getLabel()
|
||||||
if email[-14:] != "@mailchuck.com": #attempt register
|
# attempt register
|
||||||
|
if email[-14:] != "@mailchuck.com":
|
||||||
# 12 character random email address
|
# 12 character random email address
|
||||||
email = ''.join(random.SystemRandom().choice(string.ascii_lowercase) for _ in range(12)) + "@mailchuck.com"
|
email = ''.join(
|
||||||
|
random.SystemRandom().choice(
|
||||||
|
string.ascii_lowercase
|
||||||
|
) for _ in range(12)
|
||||||
|
) + "@mailchuck.com"
|
||||||
acct = MailchuckAccount(fromAddress)
|
acct = MailchuckAccount(fromAddress)
|
||||||
acct.register(email)
|
acct.register(email)
|
||||||
BMConfigParser().set(fromAddress, 'label', email)
|
BMConfigParser().set(fromAddress, 'label', email)
|
||||||
|
@ -1953,76 +2047,80 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Your account wasn't registered at"
|
"Error: Your account wasn't registered at"
|
||||||
" an email gateway. Sending registration"
|
" an email gateway. Sending registration"
|
||||||
" now as %1, please wait for the registration"
|
" now as {0}, please wait for the registration"
|
||||||
" to be processed before retrying sending."
|
" to be processed before retrying sending."
|
||||||
).arg(email)
|
).format(email)
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
status, addressVersionNumber, streamNumber, ripe = decodeAddress(
|
status, addressVersionNumber, streamNumber, ripe = \
|
||||||
toAddress)
|
decodeAddress(toAddress)
|
||||||
if status != 'success':
|
if status != 'success':
|
||||||
try:
|
try:
|
||||||
toAddress = unicode(toAddress, 'utf-8', 'ignore')
|
toAddress = unicode(toAddress, 'utf-8', 'ignore')
|
||||||
except:
|
except:
|
||||||
pass
|
logger.warning(
|
||||||
logger.error('Error: Could not decode recipient address ' + toAddress + ':' + status)
|
"Failed unicode(toAddress ):",
|
||||||
|
exc_info=True)
|
||||||
|
logger.error(
|
||||||
|
'Error: Could not decode recipient address %s: %s',
|
||||||
|
toAddress, status)
|
||||||
|
|
||||||
if status == 'missingbm':
|
if status == 'missingbm':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Bitmessage addresses start with"
|
"Error: Bitmessage addresses start with"
|
||||||
" BM- Please check the recipient address %1"
|
" BM- Please check the recipient address {0}"
|
||||||
).arg(toAddress))
|
).format(toAddress))
|
||||||
elif status == 'checksumfailed':
|
elif status == 'checksumfailed':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: The recipient address %1 is not"
|
"Error: The recipient address {0} is not"
|
||||||
" typed or copied correctly. Please check it."
|
" typed or copied correctly. Please check it."
|
||||||
).arg(toAddress))
|
).format(toAddress))
|
||||||
elif status == 'invalidcharacters':
|
elif status == 'invalidcharacters':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: The recipient address %1 contains"
|
"Error: The recipient address {0} contains"
|
||||||
" invalid characters. Please check it."
|
" invalid characters. Please check it."
|
||||||
).arg(toAddress))
|
).format(toAddress))
|
||||||
elif status == 'versiontoohigh':
|
elif status == 'versiontoohigh':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: The version of the recipient address"
|
"Error: The version of the recipient address"
|
||||||
" %1 is too high. Either you need to upgrade"
|
" {0} is too high. Either you need to upgrade"
|
||||||
" your Bitmessage software or your"
|
" your Bitmessage software or your"
|
||||||
" acquaintance is being clever."
|
" acquaintance is being clever."
|
||||||
).arg(toAddress))
|
).format(toAddress))
|
||||||
elif status == 'ripetooshort':
|
elif status == 'ripetooshort':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Some data encoded in the recipient"
|
"Error: Some data encoded in the recipient"
|
||||||
" address %1 is too short. There might be"
|
" address {0} is too short. There might be"
|
||||||
" something wrong with the software of"
|
" something wrong with the software of"
|
||||||
" your acquaintance."
|
" your acquaintance."
|
||||||
).arg(toAddress))
|
).format(toAddress))
|
||||||
elif status == 'ripetoolong':
|
elif status == 'ripetoolong':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Some data encoded in the recipient"
|
"Error: Some data encoded in the recipient"
|
||||||
" address %1 is too long. There might be"
|
" address {0} is too long. There might be"
|
||||||
" something wrong with the software of"
|
" something wrong with the software of"
|
||||||
" your acquaintance."
|
" your acquaintance."
|
||||||
).arg(toAddress))
|
).format(toAddress))
|
||||||
elif status == 'varintmalformed':
|
elif status == 'varintmalformed':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Some data encoded in the recipient"
|
"Error: Some data encoded in the recipient"
|
||||||
" address %1 is malformed. There might be"
|
" address {0} is malformed. There might be"
|
||||||
" something wrong with the software of"
|
" something wrong with the software of"
|
||||||
" your acquaintance."
|
" your acquaintance."
|
||||||
).arg(toAddress))
|
).format(toAddress))
|
||||||
else:
|
else:
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Error: Something is wrong with the"
|
"Error: Something is wrong with the"
|
||||||
" recipient address %1."
|
" recipient address {0}."
|
||||||
).arg(toAddress))
|
).format(toAddress))
|
||||||
elif fromAddress == '':
|
elif fromAddress == '':
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -2034,12 +2132,31 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
toAddress = addBMIfNotPresent(toAddress)
|
toAddress = addBMIfNotPresent(toAddress)
|
||||||
|
|
||||||
if addressVersionNumber > 4 or addressVersionNumber <= 1:
|
if addressVersionNumber > 4 or addressVersionNumber <= 1:
|
||||||
QtGui.QMessageBox.about(self, _translate("MainWindow", "Address version number"), _translate(
|
QtWidgets.QMessageBox.about(
|
||||||
"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)))
|
self,
|
||||||
|
_translate(
|
||||||
|
"MainWindow", "Address version number"),
|
||||||
|
_translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Concerning the address {0}, Bitmessage"
|
||||||
|
" cannot understand address version"
|
||||||
|
" numbers of {1}. Perhaps upgrade"
|
||||||
|
" Bitmessage to the latest version."
|
||||||
|
).format(toAddress, addressVersionNumber)
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
if streamNumber > 1 or streamNumber == 0:
|
if streamNumber > 1 or streamNumber == 0:
|
||||||
QtGui.QMessageBox.about(self, _translate("MainWindow", "Stream number"), _translate(
|
QtWidgets.QMessageBox.about(
|
||||||
"MainWindow", "Concerning the address %1, Bitmessage cannot handle stream numbers of %2. Perhaps upgrade Bitmessage to the latest version.").arg(toAddress).arg(str(streamNumber)))
|
self,
|
||||||
|
_translate("MainWindow", "Stream number"),
|
||||||
|
_translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Concerning the address {0}, Bitmessage"
|
||||||
|
" cannot handle stream numbers of {1}."
|
||||||
|
" Perhaps upgrade Bitmessage to the"
|
||||||
|
" latest version."
|
||||||
|
).format(toAddress, streamNumber)
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
self.statusbar.clearMessage()
|
self.statusbar.clearMessage()
|
||||||
if shared.statusIconColor == 'red':
|
if shared.statusIconColor == 'red':
|
||||||
|
@ -2163,11 +2280,11 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
def click_pushButtonFetchNamecoinID(self):
|
def click_pushButtonFetchNamecoinID(self):
|
||||||
nc = namecoinConnection()
|
nc = namecoinConnection()
|
||||||
identities = str(self.ui.lineEditTo.text().toUtf8()).split(";")
|
identities = self.ui.lineEditTo.text().split(";")
|
||||||
err, addr = nc.query(identities[-1].strip())
|
err, addr = nc.query(identities[-1].strip())
|
||||||
if err is not None:
|
if err is not None:
|
||||||
self.updateStatusBar(
|
self.updateStatusBar(
|
||||||
_translate("MainWindow", "Error: %1").arg(err))
|
_translate("MainWindow", "Error: {0}").format(err))
|
||||||
else:
|
else:
|
||||||
identities[-1] = addr
|
identities[-1] = addr
|
||||||
self.ui.lineEditTo.setText("; ".join(identities))
|
self.ui.lineEditTo.setText("; ".join(identities))
|
||||||
|
@ -2197,8 +2314,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.comboBoxSendFrom.addItem(avatarize(addressInKeysFile), label, addressInKeysFile)
|
self.ui.comboBoxSendFrom.addItem(avatarize(addressInKeysFile), label, addressInKeysFile)
|
||||||
# self.ui.comboBoxSendFrom.model().sort(1, Qt.AscendingOrder)
|
# self.ui.comboBoxSendFrom.model().sort(1, Qt.AscendingOrder)
|
||||||
for i in range(self.ui.comboBoxSendFrom.count()):
|
for i in range(self.ui.comboBoxSendFrom.count()):
|
||||||
address = str(self.ui.comboBoxSendFrom.itemData(
|
address = self.ui.comboBoxSendFrom.itemData(
|
||||||
i, QtCore.Qt.UserRole).toString())
|
i, QtCore.Qt.UserRole)
|
||||||
self.ui.comboBoxSendFrom.setItemData(
|
self.ui.comboBoxSendFrom.setItemData(
|
||||||
i, AccountColor(address).accountColor(),
|
i, AccountColor(address).accountColor(),
|
||||||
QtCore.Qt.ForegroundRole)
|
QtCore.Qt.ForegroundRole)
|
||||||
|
@ -2220,13 +2337,13 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
label = addressInKeysFile
|
label = addressInKeysFile
|
||||||
self.ui.comboBoxSendFromBroadcast.addItem(avatarize(addressInKeysFile), label, addressInKeysFile)
|
self.ui.comboBoxSendFromBroadcast.addItem(avatarize(addressInKeysFile), label, addressInKeysFile)
|
||||||
for i in range(self.ui.comboBoxSendFromBroadcast.count()):
|
for i in range(self.ui.comboBoxSendFromBroadcast.count()):
|
||||||
address = str(self.ui.comboBoxSendFromBroadcast.itemData(
|
address = self.ui.comboBoxSendFromBroadcast.itemData(
|
||||||
i, QtCore.Qt.UserRole).toString())
|
i, QtCore.Qt.UserRole)
|
||||||
self.ui.comboBoxSendFromBroadcast.setItemData(
|
self.ui.comboBoxSendFromBroadcast.setItemData(
|
||||||
i, AccountColor(address).accountColor(),
|
i, AccountColor(address).accountColor(),
|
||||||
QtCore.Qt.ForegroundRole)
|
QtCore.Qt.ForegroundRole)
|
||||||
self.ui.comboBoxSendFromBroadcast.insertItem(0, '', '')
|
self.ui.comboBoxSendFromBroadcast.insertItem(0, '', '')
|
||||||
if(self.ui.comboBoxSendFromBroadcast.count() == 2):
|
if self.ui.comboBoxSendFromBroadcast.count() == 2:
|
||||||
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(1)
|
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(1)
|
||||||
else:
|
else:
|
||||||
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(0)
|
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(0)
|
||||||
|
@ -2252,12 +2369,13 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
continue
|
continue
|
||||||
elif not helper_search.check_match(toAddress, fromAddress, subject, message, self.getCurrentSearchOption(tab), self.getCurrentSearchLine(tab)):
|
elif not helper_search.check_match(toAddress, fromAddress, subject, message, self.getCurrentSearchOption(tab), self.getCurrentSearchLine(tab)):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
self.addMessageListItemSent(sent, toAddress, fromAddress, subject, "msgqueued", ackdata, time.time())
|
self.addMessageListItemSent(sent, toAddress, fromAddress, subject, "msgqueued", ackdata, time.time())
|
||||||
self.getAccountTextedit(acct).setPlainText(unicode(message, 'utf-8', 'replace'))
|
self.getAccountTextedit(acct).setPlainText(message)
|
||||||
sent.setCurrentCell(0, 0)
|
sent.setCurrentCell(0, 0)
|
||||||
|
|
||||||
def displayNewInboxMessage(self, inventoryHash, toAddress, fromAddress, subject, message):
|
def displayNewInboxMessage(
|
||||||
|
self, inventoryHash, toAddress, fromAddress, subject, message):
|
||||||
if toAddress == str_broadcast_subscribers:
|
if toAddress == str_broadcast_subscribers:
|
||||||
acct = accountClass(fromAddress)
|
acct = accountClass(fromAddress)
|
||||||
else:
|
else:
|
||||||
|
@ -2265,17 +2383,39 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
inbox = self.getAccountMessagelist(acct)
|
inbox = self.getAccountMessagelist(acct)
|
||||||
ret = None
|
ret = None
|
||||||
tab = -1
|
tab = -1
|
||||||
for treeWidget in [self.ui.treeWidgetYourIdentities, self.ui.treeWidgetSubscriptions, self.ui.treeWidgetChans]:
|
for treeWidget in [
|
||||||
|
self.ui.treeWidgetYourIdentities,
|
||||||
|
self.ui.treeWidgetSubscriptions,
|
||||||
|
self.ui.treeWidgetChans
|
||||||
|
]:
|
||||||
tab += 1
|
tab += 1
|
||||||
if tab == 1:
|
if tab == 1:
|
||||||
tab = 2
|
tab = 2
|
||||||
tableWidget = self.widgetConvert(treeWidget)
|
tableWidget = self.widgetConvert(treeWidget)
|
||||||
if not helper_search.check_match(toAddress, fromAddress, subject, message, self.getCurrentSearchOption(tab), self.getCurrentSearchLine(tab)):
|
if not helper_search.check_match(
|
||||||
|
toAddress, fromAddress, subject, message,
|
||||||
|
self.getCurrentSearchOption(tab),
|
||||||
|
self.getCurrentSearchLine(tab)
|
||||||
|
):
|
||||||
continue
|
continue
|
||||||
if tableWidget == inbox and self.getCurrentAccount(treeWidget) == acct.address and self.getCurrentFolder(treeWidget) in ["inbox", None]:
|
# inventoryHash surprisingly is of type unicode
|
||||||
ret = self.addMessageListItemInbox(inbox, "inbox", inventoryHash, toAddress, fromAddress, subject, time.time(), 0)
|
inventoryHash = inventoryHash.encode('utf-8')
|
||||||
elif treeWidget == self.ui.treeWidgetYourIdentities and self.getCurrentAccount(treeWidget) is None and self.getCurrentFolder(treeWidget) in ["inbox", "new", None]:
|
if tableWidget == inbox \
|
||||||
ret = self.addMessageListItemInbox(tableWidget, "inbox", inventoryHash, toAddress, fromAddress, subject, time.time(), 0)
|
and self.getCurrentAccount(treeWidget) == acct.address \
|
||||||
|
and self.getCurrentFolder(treeWidget) \
|
||||||
|
in ["inbox", None]:
|
||||||
|
ret = self.addMessageListItemInbox(
|
||||||
|
inbox, "inbox", inventoryHash, toAddress, fromAddress,
|
||||||
|
subject, time.time(), 0
|
||||||
|
)
|
||||||
|
elif treeWidget == self.ui.treeWidgetYourIdentities \
|
||||||
|
and self.getCurrentAccount(treeWidget) is None \
|
||||||
|
and self.getCurrentFolder(treeWidget) \
|
||||||
|
in ["inbox", "new", None]:
|
||||||
|
ret = self.addMessageListItemInbox(
|
||||||
|
tableWidget, "inbox", inventoryHash, toAddress,
|
||||||
|
fromAddress, subject, time.time(), 0
|
||||||
|
)
|
||||||
if ret is None:
|
if ret is None:
|
||||||
acct.parseMessage(toAddress, fromAddress, subject, "")
|
acct.parseMessage(toAddress, fromAddress, subject, "")
|
||||||
else:
|
else:
|
||||||
|
@ -2285,11 +2425,13 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
'bitmessagesettings', 'showtraynotifications'):
|
'bitmessagesettings', 'showtraynotifications'):
|
||||||
self.notifierShow(
|
self.notifierShow(
|
||||||
_translate("MainWindow", "New Message"),
|
_translate("MainWindow", "New Message"),
|
||||||
_translate("MainWindow", "From %1").arg(
|
_translate("MainWindow", "From {0}").format(acct.fromLabel),
|
||||||
unicode(acct.fromLabel, 'utf-8')),
|
|
||||||
sound.SOUND_UNKNOWN
|
sound.SOUND_UNKNOWN
|
||||||
)
|
)
|
||||||
if self.getCurrentAccount() is not None and ((self.getCurrentFolder(treeWidget) != "inbox" and self.getCurrentFolder(treeWidget) is not None) or self.getCurrentAccount(treeWidget) != acct.address):
|
if self.getCurrentAccount() is not None and (
|
||||||
|
(self.getCurrentFolder(treeWidget) != "inbox"
|
||||||
|
and self.getCurrentFolder(treeWidget) is not None)
|
||||||
|
or self.getCurrentAccount(treeWidget) != acct.address):
|
||||||
# Ubuntu should notify of new message irespective of
|
# Ubuntu should notify of new message irespective of
|
||||||
# whether it's in current message list or not
|
# whether it's in current message list or not
|
||||||
self.indicatorUpdate(True, to_label=acct.toLabel)
|
self.indicatorUpdate(True, to_label=acct.toLabel)
|
||||||
|
@ -2414,14 +2556,14 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.settingsDialogInstance.ui.checkBoxUseIdenticons.isChecked()))
|
self.settingsDialogInstance.ui.checkBoxUseIdenticons.isChecked()))
|
||||||
BMConfigParser().set('bitmessagesettings', 'replybelow', str(
|
BMConfigParser().set('bitmessagesettings', 'replybelow', str(
|
||||||
self.settingsDialogInstance.ui.checkBoxReplyBelow.isChecked()))
|
self.settingsDialogInstance.ui.checkBoxReplyBelow.isChecked()))
|
||||||
|
|
||||||
lang = str(self.settingsDialogInstance.ui.languageComboBox.itemData(self.settingsDialogInstance.ui.languageComboBox.currentIndex()).toString())
|
lang = str(self.settingsDialogInstance.ui.languageComboBox.itemData(self.settingsDialogInstance.ui.languageComboBox.currentIndex()))
|
||||||
BMConfigParser().set('bitmessagesettings', 'userlocale', lang)
|
BMConfigParser().set('bitmessagesettings', 'userlocale', lang)
|
||||||
change_translation(l10n.getTranslationLanguage())
|
change_translation(l10n.getTranslationLanguage())
|
||||||
|
|
||||||
if int(BMConfigParser().get('bitmessagesettings', 'port')) != int(self.settingsDialogInstance.ui.lineEditTCPPort.text()):
|
if int(BMConfigParser().get('bitmessagesettings', 'port')) != int(self.settingsDialogInstance.ui.lineEditTCPPort.text()):
|
||||||
if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'dontconnect'):
|
if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'dontconnect'):
|
||||||
QtGui.QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate(
|
QtWidgets.QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate(
|
||||||
"MainWindow", "You must restart Bitmessage for the port number change to take effect."))
|
"MainWindow", "You must restart Bitmessage for the port number change to take effect."))
|
||||||
BMConfigParser().set('bitmessagesettings', 'port', str(
|
BMConfigParser().set('bitmessagesettings', 'port', str(
|
||||||
self.settingsDialogInstance.ui.lineEditTCPPort.text()))
|
self.settingsDialogInstance.ui.lineEditTCPPort.text()))
|
||||||
|
@ -2435,7 +2577,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
#print 'self.settingsDialogInstance.ui.comboBoxProxyType.currentText())[0:5]', self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5]
|
#print 'self.settingsDialogInstance.ui.comboBoxProxyType.currentText())[0:5]', self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5]
|
||||||
if BMConfigParser().get('bitmessagesettings', 'socksproxytype') == 'none' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS':
|
if BMConfigParser().get('bitmessagesettings', 'socksproxytype') == 'none' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS':
|
||||||
if shared.statusIconColor != 'red':
|
if shared.statusIconColor != 'red':
|
||||||
QtGui.QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate(
|
QtWidgets.QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate(
|
||||||
"MainWindow", "Bitmessage will use your proxy from now on but you may want to manually restart Bitmessage now to close existing connections (if any)."))
|
"MainWindow", "Bitmessage will use your proxy from now on but you may want to manually restart Bitmessage now to close existing connections (if any)."))
|
||||||
if BMConfigParser().get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] != 'SOCKS':
|
if BMConfigParser().get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] != 'SOCKS':
|
||||||
self.statusbar.clearMessage()
|
self.statusbar.clearMessage()
|
||||||
|
@ -2464,7 +2606,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
BMConfigParser().set('bitmessagesettings', 'maxuploadrate', str(
|
BMConfigParser().set('bitmessagesettings', 'maxuploadrate', str(
|
||||||
int(float(self.settingsDialogInstance.ui.lineEditMaxUploadRate.text()))))
|
int(float(self.settingsDialogInstance.ui.lineEditMaxUploadRate.text()))))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
QtGui.QMessageBox.about(self, _translate("MainWindow", "Number needed"), _translate(
|
QtWidgets.QMessageBox.about(self, _translate("MainWindow", "Number needed"), _translate(
|
||||||
"MainWindow", "Your maximum download and upload rate must be numbers. Ignoring what you typed."))
|
"MainWindow", "Your maximum download and upload rate must be numbers. Ignoring what you typed."))
|
||||||
else:
|
else:
|
||||||
set_rates(BMConfigParser().safeGetInt("bitmessagesettings", "maxdownloadrate"),
|
set_rates(BMConfigParser().safeGetInt("bitmessagesettings", "maxdownloadrate"),
|
||||||
|
@ -2492,7 +2634,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
BMConfigParser().set('bitmessagesettings', 'defaultpayloadlengthextrabytes', str(int(float(
|
BMConfigParser().set('bitmessagesettings', 'defaultpayloadlengthextrabytes', str(int(float(
|
||||||
self.settingsDialogInstance.ui.lineEditSmallMessageDifficulty.text()) * defaults.networkDefaultPayloadLengthExtraBytes)))
|
self.settingsDialogInstance.ui.lineEditSmallMessageDifficulty.text()) * defaults.networkDefaultPayloadLengthExtraBytes)))
|
||||||
|
|
||||||
if self.settingsDialogInstance.ui.comboBoxOpenCL.currentText().toUtf8() != BMConfigParser().safeGet("bitmessagesettings", "opencl"):
|
if self.settingsDialogInstance.ui.comboBoxOpenCL.currentText() != BMConfigParser().safeGet("bitmessagesettings", "opencl"):
|
||||||
BMConfigParser().set('bitmessagesettings', 'opencl', str(self.settingsDialogInstance.ui.comboBoxOpenCL.currentText()))
|
BMConfigParser().set('bitmessagesettings', 'opencl', str(self.settingsDialogInstance.ui.comboBoxOpenCL.currentText()))
|
||||||
queues.workerQueue.put(('resetPoW', ''))
|
queues.workerQueue.put(('resetPoW', ''))
|
||||||
|
|
||||||
|
@ -2544,7 +2686,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if (float(self.settingsDialogInstance.ui.lineEditDays.text()) >=0 and float(self.settingsDialogInstance.ui.lineEditMonths.text()) >=0):
|
if (float(self.settingsDialogInstance.ui.lineEditDays.text()) >=0 and float(self.settingsDialogInstance.ui.lineEditMonths.text()) >=0):
|
||||||
shared.maximumLengthOfTimeToBotherResendingMessages = (float(str(self.settingsDialogInstance.ui.lineEditDays.text())) * 24 * 60 * 60) + (float(str(self.settingsDialogInstance.ui.lineEditMonths.text())) * (60 * 60 * 24 *365)/12)
|
shared.maximumLengthOfTimeToBotherResendingMessages = (float(str(self.settingsDialogInstance.ui.lineEditDays.text())) * 24 * 60 * 60) + (float(str(self.settingsDialogInstance.ui.lineEditMonths.text())) * (60 * 60 * 24 *365)/12)
|
||||||
if shared.maximumLengthOfTimeToBotherResendingMessages < 432000: # If the time period is less than 5 hours, we give zero values to all fields. No message will be sent again.
|
if shared.maximumLengthOfTimeToBotherResendingMessages < 432000: # If the time period is less than 5 hours, we give zero values to all fields. No message will be sent again.
|
||||||
QtGui.QMessageBox.about(self, _translate("MainWindow", "Will not resend ever"), _translate(
|
QtWidgets.QMessageBox.about(self, _translate("MainWindow", "Will not resend ever"), _translate(
|
||||||
"MainWindow", "Note that the time limit you entered is less than the amount of time Bitmessage waits for the first resend attempt therefore your messages will never be resent."))
|
"MainWindow", "Note that the time limit you entered is less than the amount of time Bitmessage waits for the first resend attempt therefore your messages will never be resent."))
|
||||||
BMConfigParser().set('bitmessagesettings', 'stopresendingafterxdays', '0')
|
BMConfigParser().set('bitmessagesettings', 'stopresendingafterxdays', '0')
|
||||||
BMConfigParser().set('bitmessagesettings', 'stopresendingafterxmonths', '0')
|
BMConfigParser().set('bitmessagesettings', 'stopresendingafterxmonths', '0')
|
||||||
|
@ -2623,7 +2765,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# Only settings remain here
|
# Only settings remain here
|
||||||
acct.settings()
|
acct.settings()
|
||||||
for i in range(self.ui.comboBoxSendFrom.count()):
|
for i in range(self.ui.comboBoxSendFrom.count()):
|
||||||
if str(self.ui.comboBoxSendFrom.itemData(i).toPyObject()) \
|
if str(self.ui.comboBoxSendFrom.itemData(i)) \
|
||||||
== acct.fromAddress:
|
== acct.fromAddress:
|
||||||
self.ui.comboBoxSendFrom.setCurrentIndex(i)
|
self.ui.comboBoxSendFrom.setCurrentIndex(i)
|
||||||
break
|
break
|
||||||
|
@ -2642,13 +2784,13 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.textEditMessage.setFocus()
|
self.ui.textEditMessage.setFocus()
|
||||||
|
|
||||||
def on_action_MarkAllRead(self):
|
def on_action_MarkAllRead(self):
|
||||||
if QtGui.QMessageBox.question(
|
if QtWidgets.QMessageBox.question(
|
||||||
self, "Marking all messages as read?",
|
self, "Marking all messages as read?",
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Are you sure you would like to mark all messages read?"
|
"Are you sure you would like to mark all messages read?"
|
||||||
), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
|
), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No
|
||||||
) != QtGui.QMessageBox.Yes:
|
) != QtWidgets.QMessageBox.Yes:
|
||||||
return
|
return
|
||||||
# addressAtCurrentRow = self.getCurrentAccount()
|
# addressAtCurrentRow = self.getCurrentAccount()
|
||||||
tableWidget = self.getCurrentMessagelist()
|
tableWidget = self.getCurrentMessagelist()
|
||||||
|
@ -2663,7 +2805,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
msgids = []
|
msgids = []
|
||||||
for i in range(0, idCount):
|
for i in range(0, idCount):
|
||||||
msgids.append(str(tableWidget.item(
|
msgids.append(str(tableWidget.item(
|
||||||
i, 3).data(QtCore.Qt.UserRole).toPyObject()))
|
i, 3).data(QtCore.Qt.UserRole)))
|
||||||
tableWidget.item(i, 0).setUnread(False)
|
tableWidget.item(i, 0).setUnread(False)
|
||||||
tableWidget.item(i, 1).setUnread(False)
|
tableWidget.item(i, 1).setUnread(False)
|
||||||
tableWidget.item(i, 2).setUnread(False)
|
tableWidget.item(i, 2).setUnread(False)
|
||||||
|
@ -2693,13 +2835,6 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
# Quit selected from menu or application indicator
|
# Quit selected from menu or application indicator
|
||||||
def quit(self):
|
def quit(self):
|
||||||
'''quit_msg = "Are you sure you want to exit Bitmessage?"
|
|
||||||
reply = QtGui.QMessageBox.question(self, 'Message',
|
|
||||||
quit_msg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
|
||||||
|
|
||||||
if reply is QtGui.QMessageBox.No:
|
|
||||||
return
|
|
||||||
'''
|
|
||||||
|
|
||||||
if self.quitAccepted:
|
if self.quitAccepted:
|
||||||
return
|
return
|
||||||
|
@ -2713,41 +2848,67 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
waitForSync = False
|
waitForSync = False
|
||||||
|
|
||||||
# C PoW currently doesn't support interrupting and OpenCL is untested
|
# C PoW currently doesn't support interrupting and OpenCL is untested
|
||||||
if getPowType() == "python" and (powQueueSize() > 0 or pendingUpload() > 0):
|
if getPowType() == "python" and (
|
||||||
reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Proof of work pending"),
|
powQueueSize() > 0 or PendingUpload() > 0):
|
||||||
_translate("MainWindow", "%n object(s) pending proof of work", None, QtCore.QCoreApplication.CodecForTr, powQueueSize()) + ", " +
|
reply = QtWidgets.QMessageBox.question(
|
||||||
_translate("MainWindow", "%n object(s) waiting to be distributed", None, QtCore.QCoreApplication.CodecForTr, pendingUpload()) + "\n\n" +
|
self, _translate("MainWindow", "Proof of work pending"),
|
||||||
_translate("MainWindow", "Wait until these tasks finish?"),
|
_translate(
|
||||||
QtGui.QMessageBox.Yes|QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel)
|
"MainWindow",
|
||||||
if reply == QtGui.QMessageBox.No:
|
"%n object(s) pending proof of work", None, powQueueSize()
|
||||||
|
) + ", " +
|
||||||
|
_translate(
|
||||||
|
"MainWindow",
|
||||||
|
"%n object(s) waiting to be distributed",
|
||||||
|
None, PendingUpload()
|
||||||
|
) + "\n\n" +
|
||||||
|
_translate("MainWindow", "Wait until these tasks finish?"),
|
||||||
|
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No
|
||||||
|
| QtWidgets.QMessageBox.Cancel,
|
||||||
|
QtWidgets.QMessageBox.Cancel
|
||||||
|
)
|
||||||
|
if reply == QtWidgets.QMessageBox.No:
|
||||||
waitForPow = False
|
waitForPow = False
|
||||||
elif reply == QtGui.QMessageBox.Cancel:
|
elif reply == QtWidgets.QMessageBox.Cancel:
|
||||||
return
|
return
|
||||||
|
|
||||||
if pendingDownload() > 0:
|
if pendingDownload() > 0:
|
||||||
reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Synchronisation pending"),
|
reply = QtWidgets.QMessageBox.question(
|
||||||
_translate("MainWindow", "Bitmessage hasn't synchronised with the network, %n object(s) to be downloaded. If you quit now, it may cause delivery delays. Wait until the synchronisation finishes?", None, QtCore.QCoreApplication.CodecForTr, pendingDownload()),
|
self, _translate("MainWindow", "Synchronisation pending"),
|
||||||
QtGui.QMessageBox.Yes|QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel)
|
_translate(
|
||||||
if reply == QtGui.QMessageBox.Yes:
|
"MainWindow",
|
||||||
|
"Bitmessage hasn't synchronised with the network,"
|
||||||
|
" %n object(s) to be downloaded. If you quit now, it may"
|
||||||
|
" cause delivery delays. Wait until the synchronisation"
|
||||||
|
" finishes?", None, pendingDownload()
|
||||||
|
), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No
|
||||||
|
| QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Cancel)
|
||||||
|
if reply == QtWidgets.QMessageBox.Yes:
|
||||||
waitForSync = True
|
waitForSync = True
|
||||||
elif reply == QtGui.QMessageBox.Cancel:
|
elif reply == QtWidgets.QMessageBox.Cancel:
|
||||||
return
|
return
|
||||||
|
|
||||||
if shared.statusIconColor == 'red' and not BMConfigParser().safeGetBoolean(
|
if shared.statusIconColor == 'red' \
|
||||||
|
and not BMConfigParser().safeGetBoolean(
|
||||||
'bitmessagesettings', 'dontconnect'):
|
'bitmessagesettings', 'dontconnect'):
|
||||||
reply = QtGui.QMessageBox.question(self, _translate("MainWindow", "Not connected"),
|
reply = QtWidgets.QMessageBox.question(
|
||||||
_translate("MainWindow", "Bitmessage isn't connected to the network. If you quit now, it may cause delivery delays. Wait until connected and the synchronisation finishes?"),
|
self, _translate("MainWindow", "Not connected"),
|
||||||
QtGui.QMessageBox.Yes|QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Cancel)
|
_translate(
|
||||||
if reply == QtGui.QMessageBox.Yes:
|
"MainWindow",
|
||||||
|
"Bitmessage isn't connected to the network."
|
||||||
|
" If you quit now, it may cause delivery delays."
|
||||||
|
" Wait until connected and the synchronisation finishes?"
|
||||||
|
), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No
|
||||||
|
| QtWidgets.QMessageBox.Cancel, QtWidgets.QMessageBox.Cancel)
|
||||||
|
if reply == QtWidgets.QMessageBox.Yes:
|
||||||
waitForConnection = True
|
waitForConnection = True
|
||||||
waitForSync = True
|
waitForSync = True
|
||||||
elif reply == QtGui.QMessageBox.Cancel:
|
elif reply == QtWidgets.QMessageBox.Cancel:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.quitAccepted = True
|
self.quitAccepted = True
|
||||||
|
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow", "Shutting down PyBitmessage... %1%").arg(0))
|
"MainWindow", "Shutting down PyBitmessage... {0}%").format(0))
|
||||||
|
|
||||||
if waitForConnection:
|
if waitForConnection:
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
|
@ -2758,7 +2919,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
QtCore.QEventLoop.AllEvents, 1000
|
QtCore.QEventLoop.AllEvents, 1000
|
||||||
)
|
)
|
||||||
|
|
||||||
# this probably will not work correctly, because there is a delay between the status icon turning red and inventory exchange, but it's better than nothing.
|
# this probably will not work correctly, because there is a delay
|
||||||
|
# between the status icon turning red and inventory exchange,
|
||||||
|
# but it's better than nothing.
|
||||||
if waitForSync:
|
if waitForSync:
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow", "Waiting for finishing synchronisation..."))
|
"MainWindow", "Waiting for finishing synchronisation..."))
|
||||||
|
@ -2779,17 +2942,18 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
maxWorkerQueue = curWorkerQueue
|
maxWorkerQueue = curWorkerQueue
|
||||||
if curWorkerQueue > 0:
|
if curWorkerQueue > 0:
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow", "Waiting for PoW to finish... %1%"
|
"MainWindow", "Waiting for PoW to finish... {0}%"
|
||||||
).arg(50 * (maxWorkerQueue - curWorkerQueue)
|
).format(
|
||||||
/ maxWorkerQueue)
|
50 * (maxWorkerQueue - curWorkerQueue) / maxWorkerQueue
|
||||||
)
|
))
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
QtCore.QCoreApplication.processEvents(
|
QtCore.QCoreApplication.processEvents(
|
||||||
QtCore.QEventLoop.AllEvents, 1000
|
QtCore.QEventLoop.AllEvents, 1000
|
||||||
)
|
)
|
||||||
|
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow", "Shutting down Pybitmessage... %1%").arg(50))
|
"MainWindow", "Shutting down Pybitmessage... {0}%"
|
||||||
|
).format(50))
|
||||||
|
|
||||||
QtCore.QCoreApplication.processEvents(
|
QtCore.QCoreApplication.processEvents(
|
||||||
QtCore.QEventLoop.AllEvents, 1000
|
QtCore.QEventLoop.AllEvents, 1000
|
||||||
|
@ -2803,30 +2967,27 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
# check if upload (of objects created locally) pending
|
# check if upload (of objects created locally) pending
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow", "Waiting for objects to be sent... %1%").arg(50))
|
"MainWindow", "Waiting for objects to be sent... {0}%"
|
||||||
|
).format(50))
|
||||||
maxPendingUpload = max(1, pendingUpload())
|
maxPendingUpload = max(1, pendingUpload())
|
||||||
|
|
||||||
while pendingUpload() > 1:
|
while pendingUpload() > 1:
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Waiting for objects to be sent... %1%"
|
"Waiting for objects to be sent... {0}%"
|
||||||
).arg(int(50 + 20 * (pendingUpload()/maxPendingUpload)))
|
).format(int(50 + 20 * pendingUpload()/maxPendingUpload)))
|
||||||
)
|
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
QtCore.QCoreApplication.processEvents(
|
QtCore.QCoreApplication.processEvents(
|
||||||
QtCore.QEventLoop.AllEvents, 1000
|
QtCore.QEventLoop.AllEvents, 1000
|
||||||
)
|
)
|
||||||
|
|
||||||
QtCore.QCoreApplication.processEvents(
|
|
||||||
QtCore.QEventLoop.AllEvents, 1000
|
|
||||||
)
|
|
||||||
QtCore.QCoreApplication.processEvents(
|
QtCore.QCoreApplication.processEvents(
|
||||||
QtCore.QEventLoop.AllEvents, 1000
|
QtCore.QEventLoop.AllEvents, 1000
|
||||||
)
|
)
|
||||||
|
|
||||||
# save state and geometry self and all widgets
|
# save state and geometry self and all widgets
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow", "Saving settings... %1%").arg(70))
|
"MainWindow", "Saving settings... {0}%").format(70))
|
||||||
QtCore.QCoreApplication.processEvents(
|
QtCore.QCoreApplication.processEvents(
|
||||||
QtCore.QEventLoop.AllEvents, 1000
|
QtCore.QEventLoop.AllEvents, 1000
|
||||||
)
|
)
|
||||||
|
@ -2839,17 +3000,17 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
obj.saveSettings()
|
obj.saveSettings()
|
||||||
|
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow", "Shutting down core... %1%").arg(80))
|
"MainWindow", "Shutting down core... {0}%").format(80))
|
||||||
QtCore.QCoreApplication.processEvents(
|
QtCore.QCoreApplication.processEvents(
|
||||||
QtCore.QEventLoop.AllEvents, 1000
|
QtCore.QEventLoop.AllEvents, 1000
|
||||||
)
|
)
|
||||||
shutdown.doCleanShutdown()
|
shutdown.doCleanShutdown()
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow", "Stopping notifications... %1%").arg(90))
|
"MainWindow", "Stopping notifications... {0}%").format(90))
|
||||||
self.tray.hide()
|
self.tray.hide()
|
||||||
|
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow", "Shutdown imminent... %1%").arg(100))
|
"MainWindow", "Shutdown imminent... {0}%").format(100))
|
||||||
shared.thisapp.cleanup()
|
shared.thisapp.cleanup()
|
||||||
logger.info("Shutdown complete")
|
logger.info("Shutdown complete")
|
||||||
super(MyForm, myapp).close()
|
super(MyForm, myapp).close()
|
||||||
|
@ -2899,10 +3060,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
elif lines[i] == '' and (i+1) < totalLines and \
|
elif lines[i] == '' and (i+1) < totalLines and \
|
||||||
lines[i+1] != '------------------------------------------------------':
|
lines[i+1] != '------------------------------------------------------':
|
||||||
lines[i] = '<br><br>'
|
lines[i] = '<br><br>'
|
||||||
content = ' '.join(lines) # To keep the whitespace between lines
|
content = ' '.join(lines) # To keep the whitespace between lines
|
||||||
content = shared.fixPotentiallyInvalidUTF8Data(content)
|
content = shared.fixPotentiallyInvalidUTF8Data(content)
|
||||||
content = unicode(content, 'utf-8)')
|
content = unicode(content, 'utf-8')
|
||||||
textEdit.setHtml(QtCore.QString(content))
|
textEdit.setHtml(content)
|
||||||
|
|
||||||
def on_action_InboxMarkUnread(self):
|
def on_action_InboxMarkUnread(self):
|
||||||
tableWidget = self.getCurrentMessagelist()
|
tableWidget = self.getCurrentMessagelist()
|
||||||
|
@ -2914,7 +3075,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
for row in tableWidget.selectedIndexes():
|
for row in tableWidget.selectedIndexes():
|
||||||
currentRow = row.row()
|
currentRow = row.row()
|
||||||
msgid = str(tableWidget.item(
|
msgid = str(tableWidget.item(
|
||||||
currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
currentRow, 3).data(QtCore.Qt.UserRole))
|
||||||
msgids.add(msgid)
|
msgids.add(msgid)
|
||||||
# if not tableWidget.item(currentRow, 0).unread:
|
# if not tableWidget.item(currentRow, 0).unread:
|
||||||
# modified += 1
|
# modified += 1
|
||||||
|
@ -2929,26 +3090,18 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
)
|
)
|
||||||
|
|
||||||
self.propagateUnreadCount()
|
self.propagateUnreadCount()
|
||||||
# if rowcount == 1:
|
|
||||||
# # performance optimisation
|
|
||||||
# self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(QtCore.Qt.UserRole), self.getCurrentFolder())
|
|
||||||
# else:
|
|
||||||
# self.propagateUnreadCount(tableWidget.item(currentRow, 1 if tableWidget.item(currentRow, 1).type == AccountMixin.SUBSCRIPTION else 0).data(QtCore.Qt.UserRole), self.getCurrentFolder(), self.getCurrentTreeWidget(), 0)
|
|
||||||
# tableWidget.selectRow(currentRow + 1)
|
|
||||||
# This doesn't de-select the last message if you try to mark it unread, but that doesn't interfere. Might not be necessary.
|
|
||||||
# We could also select upwards, but then our problem would be with the topmost message.
|
|
||||||
# tableWidget.clearSelection() manages to mark the message as read again.
|
|
||||||
|
|
||||||
# Format predefined text on message reply.
|
# Format predefined text on message reply.
|
||||||
def quoted_text(self, message):
|
def quoted_text(self, message):
|
||||||
if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'replybelow'):
|
if not BMConfigParser().safeGetBoolean('bitmessagesettings', 'replybelow'):
|
||||||
return '\n\n------------------------------------------------------\n' + message
|
return '\n\n------------------------------------------------------\n' + message
|
||||||
|
|
||||||
quoteWrapper = textwrap.TextWrapper(replace_whitespace = False,
|
quoteWrapper = textwrap.TextWrapper(
|
||||||
initial_indent = '> ',
|
replace_whitespace=False, initial_indent='> ',
|
||||||
subsequent_indent = '> ',
|
subsequent_indent='> ', break_long_words=False,
|
||||||
break_long_words = False,
|
break_on_hyphens=False
|
||||||
break_on_hyphens = False)
|
)
|
||||||
|
|
||||||
def quote_line(line):
|
def quote_line(line):
|
||||||
# Do quote empty lines.
|
# Do quote empty lines.
|
||||||
if line == '' or line.isspace():
|
if line == '' or line.isspace():
|
||||||
|
@ -2969,7 +3122,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
address = messagelist.item(
|
address = messagelist.item(
|
||||||
currentInboxRow, 0).address
|
currentInboxRow, 0).address
|
||||||
for box in [self.ui.comboBoxSendFrom, self.ui.comboBoxSendFromBroadcast]:
|
for box in [self.ui.comboBoxSendFrom, self.ui.comboBoxSendFromBroadcast]:
|
||||||
listOfAddressesInComboBoxSendFrom = [str(box.itemData(i).toPyObject()) for i in range(box.count())]
|
listOfAddressesInComboBoxSendFrom = [str(box.itemData(i)) for i in range(box.count())]
|
||||||
if address in listOfAddressesInComboBoxSendFrom:
|
if address in listOfAddressesInComboBoxSendFrom:
|
||||||
currentIndex = listOfAddressesInComboBoxSendFrom.index(address)
|
currentIndex = listOfAddressesInComboBoxSendFrom.index(address)
|
||||||
box.setCurrentIndex(currentIndex)
|
box.setCurrentIndex(currentIndex)
|
||||||
|
@ -2978,18 +3131,18 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
def on_action_InboxReplyChan(self):
|
def on_action_InboxReplyChan(self):
|
||||||
self.on_action_InboxReply(self.REPLY_TYPE_CHAN)
|
self.on_action_InboxReply(self.REPLY_TYPE_CHAN)
|
||||||
|
|
||||||
def on_action_InboxReply(self, replyType = None):
|
def on_action_InboxReply(self, replyType=None):
|
||||||
tableWidget = self.getCurrentMessagelist()
|
tableWidget = self.getCurrentMessagelist()
|
||||||
if not tableWidget:
|
if not tableWidget:
|
||||||
return
|
return
|
||||||
|
|
||||||
if replyType is None:
|
if replyType is None:
|
||||||
replyType = self.REPLY_TYPE_SENDER
|
replyType = self.REPLY_TYPE_SENDER
|
||||||
|
|
||||||
# save this to return back after reply is done
|
# save this to return back after reply is done
|
||||||
self.replyFromTab = self.ui.tabWidget.currentIndex()
|
self.replyFromTab = self.ui.tabWidget.currentIndex()
|
||||||
|
|
||||||
currentInboxRow = tableWidget.currentRow()
|
currentInboxRow = tableWidget.currentRow()
|
||||||
toAddressAtCurrentInboxRow = tableWidget.item(
|
toAddressAtCurrentInboxRow = tableWidget.item(
|
||||||
currentInboxRow, 0).address
|
currentInboxRow, 0).address
|
||||||
|
@ -2997,13 +3150,17 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
fromAddressAtCurrentInboxRow = tableWidget.item(
|
fromAddressAtCurrentInboxRow = tableWidget.item(
|
||||||
currentInboxRow, 1).address
|
currentInboxRow, 1).address
|
||||||
msgid = str(tableWidget.item(
|
msgid = str(tableWidget.item(
|
||||||
currentInboxRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
currentInboxRow, 3).data(QtCore.Qt.UserRole))
|
||||||
queryreturn = sqlQuery(
|
queryreturn = sqlQuery(
|
||||||
'''select message from inbox where msgid=?''', msgid)
|
'''select message from inbox where msgid=?''', msgid)
|
||||||
if queryreturn != []:
|
if queryreturn != []:
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
messageAtCurrentInboxRow, = row
|
messageAtCurrentInboxRow, = row
|
||||||
acct.parseMessage(toAddressAtCurrentInboxRow, fromAddressAtCurrentInboxRow, tableWidget.item(currentInboxRow, 2).subject, messageAtCurrentInboxRow)
|
acct.parseMessage(
|
||||||
|
toAddressAtCurrentInboxRow, fromAddressAtCurrentInboxRow,
|
||||||
|
tableWidget.item(currentInboxRow, 2).subject,
|
||||||
|
messageAtCurrentInboxRow
|
||||||
|
)
|
||||||
widget = {
|
widget = {
|
||||||
'subject': self.ui.lineEditSubject,
|
'subject': self.ui.lineEditSubject,
|
||||||
'from': self.ui.comboBoxSendFrom,
|
'from': self.ui.comboBoxSendFrom,
|
||||||
|
@ -3015,11 +3172,26 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
)
|
)
|
||||||
# toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
|
# toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow
|
||||||
elif not BMConfigParser().has_section(toAddressAtCurrentInboxRow):
|
elif not BMConfigParser().has_section(toAddressAtCurrentInboxRow):
|
||||||
QtGui.QMessageBox.information(self, _translate("MainWindow", "Address is gone"), _translate(
|
QtWidgets.QMessageBox.information(
|
||||||
"MainWindow", "Bitmessage cannot find your address %1. Perhaps you removed it?").arg(toAddressAtCurrentInboxRow), QtGui.QMessageBox.Ok)
|
self,
|
||||||
elif not BMConfigParser().getboolean(toAddressAtCurrentInboxRow, 'enabled'):
|
_translate("MainWindow", "Address is gone"),
|
||||||
QtGui.QMessageBox.information(self, _translate("MainWindow", "Address disabled"), _translate(
|
_translate(
|
||||||
"MainWindow", "Error: The address from which you are trying to send is disabled. You\'ll have to enable it on the \'Your Identities\' tab before using it."), QtGui.QMessageBox.Ok)
|
"MainWindow",
|
||||||
|
"Bitmessage cannot find your address {0}. Perhaps you"
|
||||||
|
" removed it?"
|
||||||
|
).format(toAddressAtCurrentInboxRow),
|
||||||
|
QtWidgets.QMessageBox.Ok)
|
||||||
|
elif not BMConfigParser().getboolean(
|
||||||
|
toAddressAtCurrentInboxRow, 'enabled'):
|
||||||
|
QtWidgets.QMessageBox.information(
|
||||||
|
self,
|
||||||
|
_translate("MainWindow", "Address disabled"),
|
||||||
|
_translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Error: The address from which you are trying to send"
|
||||||
|
" is disabled. You\'ll have to enable it on the \'Your"
|
||||||
|
" Identities\' tab before using it."
|
||||||
|
), QtWidgets.QMessageBox.Ok)
|
||||||
else:
|
else:
|
||||||
self.setBroadcastEnablementDependingOnWhetherThisIsAMailingListAddress(toAddressAtCurrentInboxRow)
|
self.setBroadcastEnablementDependingOnWhetherThisIsAMailingListAddress(toAddressAtCurrentInboxRow)
|
||||||
broadcast_tab_index = self.ui.tabWidgetSend.indexOf(
|
broadcast_tab_index = self.ui.tabWidgetSend.indexOf(
|
||||||
|
@ -3037,24 +3209,35 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
isinstance(acct, GatewayAccount) and fromAddressAtCurrentInboxRow == acct.relayAddress):
|
isinstance(acct, GatewayAccount) and fromAddressAtCurrentInboxRow == acct.relayAddress):
|
||||||
self.ui.lineEditTo.setText(str(acct.fromAddress))
|
self.ui.lineEditTo.setText(str(acct.fromAddress))
|
||||||
else:
|
else:
|
||||||
self.ui.lineEditTo.setText(tableWidget.item(currentInboxRow, 1).label + " <" + str(acct.fromAddress) + ">")
|
self.ui.lineEditTo.setText(
|
||||||
|
tableWidget.item(currentInboxRow, 1).label +
|
||||||
# If the previous message was to a chan then we should send our reply to the chan rather than to the particular person who sent the message.
|
" <" + str(acct.fromAddress) + ">"
|
||||||
|
)
|
||||||
|
|
||||||
|
# If the previous message was to a chan then we should send our
|
||||||
|
# reply to the chan rather than to the particular person
|
||||||
|
# who sent the message.
|
||||||
if acct.type == AccountMixin.CHAN and replyType == self.REPLY_TYPE_CHAN:
|
if acct.type == AccountMixin.CHAN and replyType == self.REPLY_TYPE_CHAN:
|
||||||
logger.debug('original sent to a chan. Setting the to address in the reply to the chan address.')
|
logger.debug(
|
||||||
|
'original sent to a chan. Setting the to address'
|
||||||
|
' in the reply to the chan address.'
|
||||||
|
)
|
||||||
if toAddressAtCurrentInboxRow == tableWidget.item(currentInboxRow, 0).label:
|
if toAddressAtCurrentInboxRow == tableWidget.item(currentInboxRow, 0).label:
|
||||||
self.ui.lineEditTo.setText(str(toAddressAtCurrentInboxRow))
|
self.ui.lineEditTo.setText(str(toAddressAtCurrentInboxRow))
|
||||||
else:
|
else:
|
||||||
self.ui.lineEditTo.setText(tableWidget.item(currentInboxRow, 0).label + " <" + str(acct.toAddress) + ">")
|
self.ui.lineEditTo.setText(tableWidget.item(currentInboxRow, 0).label + " <" + str(acct.toAddress) + ">")
|
||||||
|
|
||||||
self.setSendFromComboBox(toAddressAtCurrentInboxRow)
|
self.setSendFromComboBox(toAddressAtCurrentInboxRow)
|
||||||
|
|
||||||
quotedText = self.quoted_text(unicode(messageAtCurrentInboxRow, 'utf-8', 'replace'))
|
quotedText = self.quoted_text(
|
||||||
|
unicode(messageAtCurrentInboxRow, 'utf-8', 'replace'))
|
||||||
widget['message'].setPlainText(quotedText)
|
widget['message'].setPlainText(quotedText)
|
||||||
if acct.subject[0:3] in ['Re:', 'RE:']:
|
if acct.subject[0:3] in ['Re:', 'RE:']:
|
||||||
widget['subject'].setText(tableWidget.item(currentInboxRow, 2).label)
|
widget['subject'].setText(
|
||||||
|
tableWidget.item(currentInboxRow, 2).label)
|
||||||
else:
|
else:
|
||||||
widget['subject'].setText('Re: ' + tableWidget.item(currentInboxRow, 2).label)
|
widget['subject'].setText(
|
||||||
|
'Re: ' + tableWidget.item(currentInboxRow, 2).label)
|
||||||
self.ui.tabWidget.setCurrentIndex(
|
self.ui.tabWidget.setCurrentIndex(
|
||||||
self.ui.tabWidget.indexOf(self.ui.send)
|
self.ui.tabWidget.indexOf(self.ui.send)
|
||||||
)
|
)
|
||||||
|
@ -3065,7 +3248,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if not tableWidget:
|
if not tableWidget:
|
||||||
return
|
return
|
||||||
currentInboxRow = tableWidget.currentRow()
|
currentInboxRow = tableWidget.currentRow()
|
||||||
# tableWidget.item(currentRow,1).data(Qt.UserRole).toPyObject()
|
# tableWidget.item(currentRow,1).data(Qt.UserRole)
|
||||||
addressAtCurrentInboxRow = tableWidget.item(
|
addressAtCurrentInboxRow = tableWidget.item(
|
||||||
currentInboxRow, 1).data(QtCore.Qt.UserRole)
|
currentInboxRow, 1).data(QtCore.Qt.UserRole)
|
||||||
self.ui.tabWidget.setCurrentIndex(
|
self.ui.tabWidget.setCurrentIndex(
|
||||||
|
@ -3079,7 +3262,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if not tableWidget:
|
if not tableWidget:
|
||||||
return
|
return
|
||||||
currentInboxRow = tableWidget.currentRow()
|
currentInboxRow = tableWidget.currentRow()
|
||||||
# tableWidget.item(currentRow,1).data(Qt.UserRole).toPyObject()
|
# tableWidget.item(currentRow,1).data(Qt.UserRole)
|
||||||
addressAtCurrentInboxRow = tableWidget.item(
|
addressAtCurrentInboxRow = tableWidget.item(
|
||||||
currentInboxRow, 1).data(QtCore.Qt.UserRole)
|
currentInboxRow, 1).data(QtCore.Qt.UserRole)
|
||||||
recipientAddress = tableWidget.item(
|
recipientAddress = tableWidget.item(
|
||||||
|
@ -3103,23 +3286,28 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
"Error: You cannot add the same address to your blacklist"
|
"Error: You cannot add the same address to your blacklist"
|
||||||
" twice. Try renaming the existing one if you want."))
|
" twice. Try renaming the existing one if you want."))
|
||||||
|
|
||||||
def deleteRowFromMessagelist(self, row = None, inventoryHash = None, ackData = None, messageLists = None):
|
def deleteRowFromMessagelist(
|
||||||
|
self, row=None, inventoryHash=None, ackData=None, messageLists=None
|
||||||
|
):
|
||||||
if messageLists is None:
|
if messageLists is None:
|
||||||
messageLists = (self.ui.tableWidgetInbox, self.ui.tableWidgetInboxChans, self.ui.tableWidgetInboxSubscriptions)
|
messageLists = (
|
||||||
|
self.ui.tableWidgetInbox, self.ui.tableWidgetInboxChans,
|
||||||
|
self.ui.tableWidgetInboxSubscriptions
|
||||||
|
)
|
||||||
elif type(messageLists) not in (list, tuple):
|
elif type(messageLists) not in (list, tuple):
|
||||||
messageLists = (messageLists)
|
messageLists = (messageLists)
|
||||||
for messageList in messageLists:
|
for messageList in messageLists:
|
||||||
if row is not None:
|
if row is not None:
|
||||||
inventoryHash = str(messageList.item(row, 3).data(
|
inventoryHash = messageList.item(row, 3).data(
|
||||||
QtCore.Qt.UserRole).toPyObject())
|
QtCore.Qt.UserRole)
|
||||||
messageList.removeRow(row)
|
messageList.removeRow(row)
|
||||||
elif inventoryHash is not None:
|
elif inventoryHash is not None:
|
||||||
for i in range(messageList.rowCount() - 1, -1, -1):
|
for i in range(messageList.rowCount() - 1, -1, -1):
|
||||||
if messageList.item(i, 3).data(QtCore.Qt.UserRole).toPyObject() == inventoryHash:
|
if messageList.item(i, 3).data(QtCore.Qt.UserRole) == inventoryHash:
|
||||||
messageList.removeRow(i)
|
messageList.removeRow(i)
|
||||||
elif ackData is not None:
|
elif ackData is not None:
|
||||||
for i in range(messageList.rowCount() - 1, -1, -1):
|
for i in range(messageList.rowCount() - 1, -1, -1):
|
||||||
if messageList.item(i, 3).data(QtCore.Qt.UserRole).toPyObject() == ackData:
|
if messageList.item(i, 3).data(QtCore.Qt.UserRole) == ackData:
|
||||||
messageList.removeRow(i)
|
messageList.removeRow(i)
|
||||||
|
|
||||||
# Send item on the Inbox tab to trash
|
# Send item on the Inbox tab to trash
|
||||||
|
@ -3129,20 +3317,23 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
return
|
return
|
||||||
currentRow = 0
|
currentRow = 0
|
||||||
folder = self.getCurrentFolder()
|
folder = self.getCurrentFolder()
|
||||||
shifted = QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier
|
shifted = QtWidgets.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier
|
||||||
tableWidget.setUpdatesEnabled(False);
|
tableWidget.setUpdatesEnabled(False)
|
||||||
inventoryHashesToTrash = []
|
inventoryHashesToTrash = []
|
||||||
# ranges in reversed order
|
# ranges in reversed order
|
||||||
for r in sorted(tableWidget.selectedRanges(), key=lambda r: r.topRow())[::-1]:
|
for r in sorted(
|
||||||
|
tableWidget.selectedRanges(), key=lambda r: r.topRow()
|
||||||
|
)[::-1]:
|
||||||
for i in range(r.bottomRow()-r.topRow()+1):
|
for i in range(r.bottomRow()-r.topRow()+1):
|
||||||
inventoryHashToTrash = str(tableWidget.item(
|
inventoryHashToTrash = str(tableWidget.item(
|
||||||
r.topRow()+i, 3).data(QtCore.Qt.UserRole).toPyObject())
|
r.topRow()+i, 3).data(QtCore.Qt.UserRole))
|
||||||
if inventoryHashToTrash in inventoryHashesToTrash:
|
if inventoryHashToTrash in inventoryHashesToTrash:
|
||||||
continue
|
continue
|
||||||
inventoryHashesToTrash.append(inventoryHashToTrash)
|
inventoryHashesToTrash.append(inventoryHashToTrash)
|
||||||
currentRow = r.topRow()
|
currentRow = r.topRow()
|
||||||
self.getCurrentMessageTextedit().setText("")
|
self.getCurrentMessageTextedit().setText("")
|
||||||
tableWidget.model().removeRows(r.topRow(), r.bottomRow()-r.topRow()+1)
|
tableWidget.model().removeRows(
|
||||||
|
r.topRow(), r.bottomRow() - r.topRow() + 1)
|
||||||
idCount = len(inventoryHashesToTrash)
|
idCount = len(inventoryHashesToTrash)
|
||||||
if folder == "trash" or shifted:
|
if folder == "trash" or shifted:
|
||||||
sqlExecuteChunked('''DELETE FROM inbox WHERE msgid IN ({0})''',
|
sqlExecuteChunked('''DELETE FROM inbox WHERE msgid IN ({0})''',
|
||||||
|
@ -3164,16 +3355,19 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
tableWidget.setUpdatesEnabled(False)
|
tableWidget.setUpdatesEnabled(False)
|
||||||
inventoryHashesToTrash = []
|
inventoryHashesToTrash = []
|
||||||
# ranges in reversed order
|
# ranges in reversed order
|
||||||
for r in sorted(tableWidget.selectedRanges(), key=lambda r: r.topRow())[::-1]:
|
for r in sorted(
|
||||||
for i in range(r.bottomRow()-r.topRow()+1):
|
tableWidget.selectedRanges(),
|
||||||
|
key=lambda r: r.topRow())[::-1]:
|
||||||
|
for i in range(r.bottomRow() - r.topRow() + 1):
|
||||||
inventoryHashToTrash = str(tableWidget.item(
|
inventoryHashToTrash = str(tableWidget.item(
|
||||||
r.topRow()+i, 3).data(QtCore.Qt.UserRole).toPyObject())
|
r.topRow()+i, 3).data(QtCore.Qt.UserRole))
|
||||||
if inventoryHashToTrash in inventoryHashesToTrash:
|
if inventoryHashToTrash in inventoryHashesToTrash:
|
||||||
continue
|
continue
|
||||||
inventoryHashesToTrash.append(inventoryHashToTrash)
|
inventoryHashesToTrash.append(inventoryHashToTrash)
|
||||||
currentRow = r.topRow()
|
currentRow = r.topRow()
|
||||||
self.getCurrentMessageTextedit().setText("")
|
self.getCurrentMessageTextedit().setText("")
|
||||||
tableWidget.model().removeRows(r.topRow(), r.bottomRow()-r.topRow()+1)
|
tableWidget.model().removeRows(
|
||||||
|
r.topRow(), r.bottomRow() - r.topRow() + 1)
|
||||||
if currentRow == 0:
|
if currentRow == 0:
|
||||||
tableWidget.selectRow(currentRow)
|
tableWidget.selectRow(currentRow)
|
||||||
else:
|
else:
|
||||||
|
@ -3199,16 +3393,20 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
# Retrieve the message data out of the SQL database
|
# Retrieve the message data out of the SQL database
|
||||||
msgid = str(tableWidget.item(
|
msgid = str(tableWidget.item(
|
||||||
currentInboxRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
currentInboxRow, 3).data(QtCore.Qt.UserRole))
|
||||||
queryreturn = sqlQuery(
|
queryreturn = sqlQuery(
|
||||||
'''select message from inbox where msgid=?''', msgid)
|
'''select message from inbox where msgid=?''', msgid)
|
||||||
if queryreturn != []:
|
if queryreturn != []:
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
message, = row
|
message, = row
|
||||||
|
|
||||||
defaultFilename = "".join(x for x in subjectAtCurrentInboxRow if x.isalnum()) + '.txt'
|
defaultFilename = "".join(
|
||||||
filename = QtGui.QFileDialog.getSaveFileName(self, _translate("MainWindow","Save As..."), defaultFilename, "Text files (*.txt);;All files (*.*)")
|
x for x in subjectAtCurrentInboxRow if x.isalnum()) + '.txt'
|
||||||
if filename == '':
|
filename, filetype = QtWidgets.QFileDialog.getSaveFileName(
|
||||||
|
self, _translate("MainWindow", "Save As..."), defaultFilename,
|
||||||
|
"Text files (*.txt);;All files (*.*)"
|
||||||
|
)
|
||||||
|
if not filename:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
f = open(filename, 'w')
|
f = open(filename, 'w')
|
||||||
|
@ -3221,16 +3419,15 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# Send item on the Sent tab to trash
|
# Send item on the Sent tab to trash
|
||||||
def on_action_SentTrash(self):
|
def on_action_SentTrash(self):
|
||||||
currentRow = 0
|
currentRow = 0
|
||||||
unread = False
|
|
||||||
tableWidget = self.getCurrentMessagelist()
|
tableWidget = self.getCurrentMessagelist()
|
||||||
if not tableWidget:
|
if not tableWidget:
|
||||||
return
|
return
|
||||||
folder = self.getCurrentFolder()
|
folder = self.getCurrentFolder()
|
||||||
shifted = (QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier) > 0
|
shifted = (QtWidgets.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier) > 0
|
||||||
while tableWidget.selectedIndexes() != []:
|
while tableWidget.selectedIndexes() != []:
|
||||||
currentRow = tableWidget.selectedIndexes()[0].row()
|
currentRow = tableWidget.selectedIndexes()[0].row()
|
||||||
ackdataToTrash = str(tableWidget.item(
|
ackdataToTrash = str(tableWidget.item(
|
||||||
currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
currentRow, 3).data(QtCore.Qt.UserRole))
|
||||||
if folder == "trash" or shifted:
|
if folder == "trash" or shifted:
|
||||||
sqlExecute('''DELETE FROM sent WHERE ackdata=?''', ackdataToTrash)
|
sqlExecute('''DELETE FROM sent WHERE ackdata=?''', ackdataToTrash)
|
||||||
else:
|
else:
|
||||||
|
@ -3256,15 +3453,18 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
queryreturn = sqlQuery('''select ackdata FROM sent WHERE status='forcepow' ''')
|
queryreturn = sqlQuery('''select ackdata FROM sent WHERE status='forcepow' ''')
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
ackdata, = row
|
ackdata, = row
|
||||||
queues.UISignalQueue.put(('updateSentItemStatusByAckdata', (
|
queues.UISignalQueue.put((
|
||||||
ackdata, 'Overriding maximum-difficulty setting. Work queued.')))
|
'updateSentItemStatusByAckdata',
|
||||||
|
(ackdata, 'Overriding maximum-difficulty setting.'
|
||||||
|
' Work queued.')
|
||||||
|
))
|
||||||
queues.workerQueue.put(('sendmessage', ''))
|
queues.workerQueue.put(('sendmessage', ''))
|
||||||
|
|
||||||
def on_action_SentClipboard(self):
|
def on_action_SentClipboard(self):
|
||||||
currentRow = self.ui.tableWidgetInbox.currentRow()
|
currentRow = self.ui.tableWidgetInbox.currentRow()
|
||||||
addressAtCurrentRow = self.ui.tableWidgetInbox.item(
|
addressAtCurrentRow = self.ui.tableWidgetInbox.item(
|
||||||
currentRow, 0).data(QtCore.Qt.UserRole)
|
currentRow, 0).data(QtCore.Qt.UserRole)
|
||||||
clipboard = QtGui.QApplication.clipboard()
|
clipboard = QtWidgets.QApplication.clipboard()
|
||||||
clipboard.setText(str(addressAtCurrentRow))
|
clipboard.setText(str(addressAtCurrentRow))
|
||||||
|
|
||||||
# Group of functions for the Address Book dialog box
|
# Group of functions for the Address Book dialog box
|
||||||
|
@ -3276,11 +3476,11 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
currentRow = self.ui.tableWidgetAddressBook.selectedIndexes()[
|
currentRow = self.ui.tableWidgetAddressBook.selectedIndexes()[
|
||||||
0].row()
|
0].row()
|
||||||
labelAtCurrentRow = self.ui.tableWidgetAddressBook.item(
|
labelAtCurrentRow = self.ui.tableWidgetAddressBook.item(
|
||||||
currentRow, 0).text().toUtf8()
|
currentRow, 0).text()
|
||||||
addressAtCurrentRow = self.ui.tableWidgetAddressBook.item(
|
addressAtCurrentRow = self.ui.tableWidgetAddressBook.item(
|
||||||
currentRow, 1).text()
|
currentRow, 1).text()
|
||||||
sqlExecute('''DELETE FROM addressbook WHERE label=? AND address=?''',
|
sqlExecute('''DELETE FROM addressbook WHERE label=? AND address=?''',
|
||||||
str(labelAtCurrentRow), str(addressAtCurrentRow))
|
labelAtCurrentRow, addressAtCurrentRow)
|
||||||
self.ui.tableWidgetAddressBook.removeRow(currentRow)
|
self.ui.tableWidgetAddressBook.removeRow(currentRow)
|
||||||
self.rerenderMessagelistFromLabels()
|
self.rerenderMessagelistFromLabels()
|
||||||
self.rerenderMessagelistToLabels()
|
self.rerenderMessagelistToLabels()
|
||||||
|
@ -3298,7 +3498,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
fullStringOfAddresses = addressAtCurrentRow
|
fullStringOfAddresses = addressAtCurrentRow
|
||||||
else:
|
else:
|
||||||
fullStringOfAddresses += ', ' + str(addressAtCurrentRow)
|
fullStringOfAddresses += ', ' + str(addressAtCurrentRow)
|
||||||
clipboard = QtGui.QApplication.clipboard()
|
clipboard = QtWidgets.QApplication.clipboard()
|
||||||
clipboard.setText(fullStringOfAddresses)
|
clipboard.setText(fullStringOfAddresses)
|
||||||
|
|
||||||
def on_action_AddressBookSend(self):
|
def on_action_AddressBookSend(self):
|
||||||
|
@ -3315,8 +3515,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if self.ui.lineEditTo.text() == '':
|
if self.ui.lineEditTo.text() == '':
|
||||||
self.ui.lineEditTo.setText(stringToAdd)
|
self.ui.lineEditTo.setText(stringToAdd)
|
||||||
else:
|
else:
|
||||||
self.ui.lineEditTo.setText(unicode(
|
self.ui.lineEditTo.setText(
|
||||||
self.ui.lineEditTo.text().toUtf8(), encoding="UTF-8") + '; ' + stringToAdd)
|
self.ui.lineEditTo.text() + '; ' + stringToAdd)
|
||||||
if listOfSelectedRows == {}:
|
if listOfSelectedRows == {}:
|
||||||
self.updateStatusBar(_translate(
|
self.updateStatusBar(_translate(
|
||||||
"MainWindow", "No addresses selected."))
|
"MainWindow", "No addresses selected."))
|
||||||
|
@ -3340,14 +3540,14 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
" subscriptions twice. Perhaps rename the existing"
|
" subscriptions twice. Perhaps rename the existing"
|
||||||
" one if you want."))
|
" one if you want."))
|
||||||
continue
|
continue
|
||||||
labelAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,0).text().toUtf8()
|
labelAtCurrentRow = self.ui.tableWidgetAddressBook.item(currentRow,0).text()
|
||||||
self.addSubscription(addressAtCurrentRow, labelAtCurrentRow)
|
self.addSubscription(addressAtCurrentRow, labelAtCurrentRow)
|
||||||
self.ui.tabWidget.setCurrentIndex(
|
self.ui.tabWidget.setCurrentIndex(
|
||||||
self.ui.tabWidget.indexOf(self.ui.subscriptions)
|
self.ui.tabWidget.indexOf(self.ui.subscriptions)
|
||||||
)
|
)
|
||||||
|
|
||||||
def on_context_menuAddressBook(self, point):
|
def on_context_menuAddressBook(self, point):
|
||||||
self.popMenuAddressBook = QtGui.QMenu(self)
|
self.popMenuAddressBook = QtWidgets.QMenu(self)
|
||||||
self.popMenuAddressBook.addAction(self.actionAddressBookSend)
|
self.popMenuAddressBook.addAction(self.actionAddressBookSend)
|
||||||
self.popMenuAddressBook.addAction(self.actionAddressBookClipboard)
|
self.popMenuAddressBook.addAction(self.actionAddressBookClipboard)
|
||||||
self.popMenuAddressBook.addAction(self.actionAddressBookSubscribe)
|
self.popMenuAddressBook.addAction(self.actionAddressBookSubscribe)
|
||||||
|
@ -3373,7 +3573,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.click_pushButtonAddSubscription()
|
self.click_pushButtonAddSubscription()
|
||||||
|
|
||||||
def on_action_SubscriptionsDelete(self):
|
def on_action_SubscriptionsDelete(self):
|
||||||
if QtGui.QMessageBox.question(
|
if QtWidgets.QMessageBox.question(
|
||||||
self, "Delete subscription?",
|
self, "Delete subscription?",
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -3384,8 +3584,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
" messages, but you can still view messages you"
|
" messages, but you can still view messages you"
|
||||||
" already received.\n\nAre you sure you want to"
|
" already received.\n\nAre you sure you want to"
|
||||||
" delete the subscription?"
|
" delete the subscription?"
|
||||||
), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
|
), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No
|
||||||
) != QtGui.QMessageBox.Yes:
|
) != QtWidgets.QMessageBox.Yes:
|
||||||
return
|
return
|
||||||
address = self.getCurrentAccount()
|
address = self.getCurrentAccount()
|
||||||
sqlExecute('''DELETE FROM subscriptions WHERE address=?''',
|
sqlExecute('''DELETE FROM subscriptions WHERE address=?''',
|
||||||
|
@ -3397,7 +3597,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
def on_action_SubscriptionsClipboard(self):
|
def on_action_SubscriptionsClipboard(self):
|
||||||
address = self.getCurrentAccount()
|
address = self.getCurrentAccount()
|
||||||
clipboard = QtGui.QApplication.clipboard()
|
clipboard = QtWidgets.QApplication.clipboard()
|
||||||
clipboard.setText(str(address))
|
clipboard.setText(str(address))
|
||||||
|
|
||||||
def on_action_SubscriptionsEnable(self):
|
def on_action_SubscriptionsEnable(self):
|
||||||
|
@ -3422,7 +3622,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
def on_context_menuSubscriptions(self, point):
|
def on_context_menuSubscriptions(self, point):
|
||||||
currentItem = self.getCurrentItem()
|
currentItem = self.getCurrentItem()
|
||||||
self.popMenuSubscriptions = QtGui.QMenu(self)
|
self.popMenuSubscriptions = QtWidgets.QMenu(self)
|
||||||
if isinstance(currentItem, Ui_AddressWidget):
|
if isinstance(currentItem, Ui_AddressWidget):
|
||||||
self.popMenuSubscriptions.addAction(self.actionsubscriptionsNew)
|
self.popMenuSubscriptions.addAction(self.actionsubscriptionsNew)
|
||||||
self.popMenuSubscriptions.addAction(self.actionsubscriptionsDelete)
|
self.popMenuSubscriptions.addAction(self.actionsubscriptionsDelete)
|
||||||
|
@ -3460,7 +3660,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def getCurrentTreeWidget(self):
|
def getCurrentTreeWidget(self):
|
||||||
currentIndex = self.ui.tabWidget.currentIndex();
|
currentIndex = self.ui.tabWidget.currentIndex()
|
||||||
treeWidgetList = [
|
treeWidgetList = [
|
||||||
self.ui.treeWidgetYourIdentities,
|
self.ui.treeWidgetYourIdentities,
|
||||||
False,
|
False,
|
||||||
|
@ -3484,7 +3684,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
return self.ui.treeWidgetYourIdentities
|
return self.ui.treeWidgetYourIdentities
|
||||||
|
|
||||||
def getCurrentMessagelist(self):
|
def getCurrentMessagelist(self):
|
||||||
currentIndex = self.ui.tabWidget.currentIndex();
|
currentIndex = self.ui.tabWidget.currentIndex()
|
||||||
messagelistList = [
|
messagelistList = [
|
||||||
self.ui.tableWidgetInbox,
|
self.ui.tableWidgetInbox,
|
||||||
False,
|
False,
|
||||||
|
@ -3495,7 +3695,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
return messagelistList[currentIndex]
|
return messagelistList[currentIndex]
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def getAccountMessagelist(self, account):
|
def getAccountMessagelist(self, account):
|
||||||
try:
|
try:
|
||||||
if account.type == AccountMixin.CHAN:
|
if account.type == AccountMixin.CHAN:
|
||||||
|
@ -3512,8 +3712,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if messagelist:
|
if messagelist:
|
||||||
currentRow = messagelist.currentRow()
|
currentRow = messagelist.currentRow()
|
||||||
if currentRow >= 0:
|
if currentRow >= 0:
|
||||||
msgid = str(messagelist.item(
|
msgid = messagelist.item(
|
||||||
currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
currentRow, 3).data(QtCore.Qt.UserRole)
|
||||||
# data is saved at the 4. column of the table...
|
# data is saved at the 4. column of the table...
|
||||||
return msgid
|
return msgid
|
||||||
return False
|
return False
|
||||||
|
@ -3555,7 +3755,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if retObj:
|
if retObj:
|
||||||
return messagelistList[currentIndex]
|
return messagelistList[currentIndex]
|
||||||
else:
|
else:
|
||||||
return messagelistList[currentIndex].text().toUtf8().data()
|
return messagelistList[currentIndex].text()
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -3569,9 +3769,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.inboxSearchOptionChans,
|
self.ui.inboxSearchOptionChans,
|
||||||
]
|
]
|
||||||
if currentIndex >= 0 and currentIndex < len(messagelistList):
|
if currentIndex >= 0 and currentIndex < len(messagelistList):
|
||||||
return messagelistList[currentIndex].currentText().toUtf8().data()
|
return messagelistList[currentIndex].currentText()
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Group of functions for the Your Identities dialog box
|
# Group of functions for the Your Identities dialog box
|
||||||
def getCurrentItem(self, treeWidget=None):
|
def getCurrentItem(self, treeWidget=None):
|
||||||
|
@ -3582,7 +3780,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if currentItem:
|
if currentItem:
|
||||||
return currentItem
|
return currentItem
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def getCurrentAccount(self, treeWidget=None):
|
def getCurrentAccount(self, treeWidget=None):
|
||||||
currentItem = self.getCurrentItem(treeWidget)
|
currentItem = self.getCurrentItem(treeWidget)
|
||||||
if currentItem:
|
if currentItem:
|
||||||
|
@ -3595,13 +3793,11 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
def getCurrentFolder(self, treeWidget=None):
|
def getCurrentFolder(self, treeWidget=None):
|
||||||
if treeWidget is None:
|
if treeWidget is None:
|
||||||
treeWidget = self.getCurrentTreeWidget()
|
treeWidget = self.getCurrentTreeWidget()
|
||||||
#treeWidget = self.ui.treeWidgetYourIdentities
|
# treeWidget = self.ui.treeWidgetYourIdentities
|
||||||
if treeWidget:
|
if treeWidget:
|
||||||
currentItem = treeWidget.currentItem()
|
currentItem = treeWidget.currentItem()
|
||||||
if currentItem and hasattr(currentItem, 'folderName'):
|
if currentItem and hasattr(currentItem, 'folderName'):
|
||||||
return currentItem.folderName
|
return currentItem.folderName
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def setCurrentItemColor(self, color):
|
def setCurrentItemColor(self, color):
|
||||||
treeWidget = self.getCurrentTreeWidget()
|
treeWidget = self.getCurrentTreeWidget()
|
||||||
|
@ -3620,7 +3816,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if account.type == AccountMixin.NORMAL:
|
if account.type == AccountMixin.NORMAL:
|
||||||
return # maybe in the future
|
return # maybe in the future
|
||||||
elif account.type == AccountMixin.CHAN:
|
elif account.type == AccountMixin.CHAN:
|
||||||
if QtGui.QMessageBox.question(
|
if QtWidgets.QMessageBox.question(
|
||||||
self, "Delete channel?",
|
self, "Delete channel?",
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -3631,8 +3827,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
" messages, but you can still view messages you"
|
" messages, but you can still view messages you"
|
||||||
" already received.\n\nAre you sure you want to"
|
" already received.\n\nAre you sure you want to"
|
||||||
" delete the channel?"
|
" delete the channel?"
|
||||||
), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
|
), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No
|
||||||
) == QtGui.QMessageBox.Yes:
|
) == QtWidgets.QMessageBox.Yes:
|
||||||
BMConfigParser().remove_section(str(account.address))
|
BMConfigParser().remove_section(str(account.address))
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
@ -3673,14 +3869,14 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
def on_action_Clipboard(self):
|
def on_action_Clipboard(self):
|
||||||
address = self.getCurrentAccount()
|
address = self.getCurrentAccount()
|
||||||
clipboard = QtGui.QApplication.clipboard()
|
clipboard = QtWidgets.QApplication.clipboard()
|
||||||
clipboard.setText(str(address))
|
clipboard.setText(str(address))
|
||||||
|
|
||||||
def on_action_ClipboardMessagelist(self):
|
def on_action_ClipboardMessagelist(self):
|
||||||
tableWidget = self.getCurrentMessagelist()
|
tableWidget = self.getCurrentMessagelist()
|
||||||
currentColumn = tableWidget.currentColumn()
|
currentColumn = tableWidget.currentColumn()
|
||||||
currentRow = tableWidget.currentRow()
|
currentRow = tableWidget.currentRow()
|
||||||
if currentColumn not in [0, 1, 2]: # to, from, subject
|
if currentColumn not in [0, 1, 2]: # to, from, subject
|
||||||
if self.getCurrentFolder() == "sent":
|
if self.getCurrentFolder() == "sent":
|
||||||
currentColumn = 0
|
currentColumn = 0
|
||||||
else:
|
else:
|
||||||
|
@ -3692,24 +3888,25 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
myAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole)
|
myAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole)
|
||||||
otherAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole)
|
otherAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole)
|
||||||
account = accountClass(myAddress)
|
account = accountClass(myAddress)
|
||||||
if isinstance(account, GatewayAccount) and otherAddress == account.relayAddress and (
|
if isinstance(account, GatewayAccount) \
|
||||||
(currentColumn in [0, 2] and self.getCurrentFolder() == "sent") or
|
and otherAddress == account.relayAddress and (
|
||||||
(currentColumn in [1, 2] and self.getCurrentFolder() != "sent")):
|
(currentColumn in (0, 2) and currentFolder == "sent")
|
||||||
text = str(tableWidget.item(currentRow, currentColumn).label)
|
or (currentColumn in (1, 2) and currentFolder != "sent")):
|
||||||
|
text = tableWidget.item(currentRow, currentColumn).label
|
||||||
else:
|
else:
|
||||||
text = tableWidget.item(currentRow, currentColumn).data(QtCore.Qt.UserRole)
|
text = tableWidget.item(currentRow, currentColumn).data(QtCore.Qt.UserRole)
|
||||||
text = unicode(str(text), 'utf-8', 'ignore')
|
# text = unicode(str(text), 'utf-8', 'ignore')
|
||||||
clipboard = QtGui.QApplication.clipboard()
|
clipboard = QtWidgets.QApplication.clipboard()
|
||||||
clipboard.setText(text)
|
clipboard.setText(text)
|
||||||
|
|
||||||
#set avatar functions
|
# set avatar functions
|
||||||
def on_action_TreeWidgetSetAvatar(self):
|
def on_action_TreeWidgetSetAvatar(self):
|
||||||
address = self.getCurrentAccount()
|
address = self.getCurrentAccount()
|
||||||
self.setAvatar(address)
|
self.setAvatar(address)
|
||||||
|
|
||||||
def on_action_AddressBookSetAvatar(self):
|
def on_action_AddressBookSetAvatar(self):
|
||||||
self.on_action_SetAvatar(self.ui.tableWidgetAddressBook)
|
self.on_action_SetAvatar(self.ui.tableWidgetAddressBook)
|
||||||
|
|
||||||
def on_action_SetAvatar(self, thisTableWidget):
|
def on_action_SetAvatar(self, thisTableWidget):
|
||||||
currentRow = thisTableWidget.currentRow()
|
currentRow = thisTableWidget.currentRow()
|
||||||
addressAtCurrentRow = thisTableWidget.item(
|
addressAtCurrentRow = thisTableWidget.item(
|
||||||
|
@ -3723,15 +3920,33 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if not os.path.exists(state.appdata + 'avatars/'):
|
if not os.path.exists(state.appdata + 'avatars/'):
|
||||||
os.makedirs(state.appdata + 'avatars/')
|
os.makedirs(state.appdata + 'avatars/')
|
||||||
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
|
||||||
names = {'BMP':'Windows Bitmap', 'GIF':'Graphic Interchange Format', 'JPG':'Joint Photographic Experts Group', 'JPEG':'Joint Photographic Experts Group', 'MNG':'Multiple-image Network Graphics', 'PNG':'Portable Network Graphics', 'PBM':'Portable Bitmap', 'PGM':'Portable Graymap', 'PPM':'Portable Pixmap', 'TIFF':'Tagged Image File Format', 'XBM':'X11 Bitmap', 'XPM':'X11 Pixmap', 'SVG':'Scalable Vector Graphics', 'TGA':'Targa Image Format'}
|
names = {
|
||||||
|
'BMP': 'Windows Bitmap',
|
||||||
|
'GIF': 'Graphic Interchange Format',
|
||||||
|
'JPG': 'Joint Photographic Experts Group',
|
||||||
|
'JPEG': 'Joint Photographic Experts Group',
|
||||||
|
'MNG': 'Multiple-image Network Graphics',
|
||||||
|
'PNG': 'Portable Network Graphics',
|
||||||
|
'PBM': 'Portable Bitmap',
|
||||||
|
'PGM': 'Portable Graymap',
|
||||||
|
'PPM': 'Portable Pixmap',
|
||||||
|
'TIFF': 'Tagged Image File Format',
|
||||||
|
'XBM': 'X11 Bitmap',
|
||||||
|
'XPM': 'X11 Pixmap',
|
||||||
|
'SVG': 'Scalable Vector Graphics',
|
||||||
|
'TGA': 'Targa Image Format'
|
||||||
|
}
|
||||||
filters = []
|
filters = []
|
||||||
all_images_filter = []
|
all_images_filter = []
|
||||||
current_files = []
|
current_files = []
|
||||||
for ext in extensions:
|
for ext in extensions:
|
||||||
filters += [ names[ext] + ' (*.' + ext.lower() + ')' ]
|
filters += [names[ext] + ' (*.' + ext.lower() + ')']
|
||||||
all_images_filter += [ '*.' + ext.lower() ]
|
all_images_filter += ['*.' + ext.lower()]
|
||||||
upper = state.appdata + 'avatars/' + hash + '.' + ext.upper()
|
upper = state.appdata + 'avatars/' + hash + '.' + ext.upper()
|
||||||
lower = state.appdata + 'avatars/' + hash + '.' + ext.lower()
|
lower = state.appdata + 'avatars/' + hash + '.' + ext.lower()
|
||||||
if os.path.isfile(lower):
|
if os.path.isfile(lower):
|
||||||
|
@ -3740,33 +3955,43 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
current_files += [upper]
|
current_files += [upper]
|
||||||
filters[0:0] = ['Image files (' + ' '.join(all_images_filter) + ')']
|
filters[0:0] = ['Image files (' + ' '.join(all_images_filter) + ')']
|
||||||
filters[1:1] = ['All files (*.*)']
|
filters[1:1] = ['All files (*.*)']
|
||||||
sourcefile = QtGui.QFileDialog.getOpenFileName(
|
sourcefile, filetype = QtWidgets.QFileDialog.getOpenFileName(
|
||||||
self, _translate("MainWindow", "Set avatar..."),
|
self, _translate("MainWindow", "Set avatar..."),
|
||||||
filter = ';;'.join(filters)
|
filter=';;'.join(filters)
|
||||||
)
|
)
|
||||||
# determine the correct filename (note that avatars don't use the suffix)
|
# determine the correct filename (note that avatars don't use the suffix)
|
||||||
destination = state.appdata + 'avatars/' + hash + '.' + sourcefile.split('.')[-1]
|
destination = state.appdata + 'avatars/' + hash + '.' + sourcefile.split('.')[-1]
|
||||||
exists = QtCore.QFile.exists(destination)
|
exists = QtCore.QFile.exists(destination)
|
||||||
if sourcefile == '':
|
if sourcefile == '':
|
||||||
# ask for removal of avatar
|
# ask for removal of avatar
|
||||||
if exists | (len(current_files)>0):
|
if exists | (len(current_files) > 0):
|
||||||
displayMsg = _translate("MainWindow", "Do you really want to remove this avatar?")
|
displayMsg = _translate(
|
||||||
overwrite = QtGui.QMessageBox.question(
|
"MainWindow", "Do you really want to remove this avatar?"
|
||||||
self, 'Message', displayMsg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
)
|
||||||
|
overwrite = QtWidgets.QMessageBox.question(
|
||||||
|
self, 'Message', displayMsg,
|
||||||
|
QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
overwrite = QtGui.QMessageBox.No
|
overwrite = QtWidgets.QMessageBox.No
|
||||||
else:
|
else:
|
||||||
# ask whether to overwrite old avatar
|
# ask whether to overwrite old avatar
|
||||||
if exists | (len(current_files)>0):
|
if exists | (len(current_files) > 0):
|
||||||
displayMsg = _translate("MainWindow", "You have already set an avatar for this address. Do you really want to overwrite it?")
|
displayMsg = _translate(
|
||||||
overwrite = QtGui.QMessageBox.question(
|
"MainWindow",
|
||||||
self, 'Message', displayMsg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
"You have already set an avatar for this address."
|
||||||
|
" Do you really want to overwrite it?"
|
||||||
|
)
|
||||||
|
overwrite = QtWidgets.QMessageBox.question(
|
||||||
|
self, 'Message', displayMsg,
|
||||||
|
QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
overwrite = QtGui.QMessageBox.No
|
overwrite = QtWidgets.QMessageBox.No
|
||||||
|
|
||||||
# copy the image file to the appdata folder
|
# copy the image file to the appdata folder
|
||||||
if (not exists) | (overwrite == QtGui.QMessageBox.Yes):
|
if (not exists) | (overwrite == QtWidgets.QMessageBox.Yes):
|
||||||
if overwrite == QtGui.QMessageBox.Yes:
|
if overwrite == QtWidgets.QMessageBox.Yes:
|
||||||
for file in current_files:
|
for file in current_files:
|
||||||
QtCore.QFile.remove(file)
|
QtCore.QFile.remove(file)
|
||||||
QtCore.QFile.remove(destination)
|
QtCore.QFile.remove(destination)
|
||||||
|
@ -3798,10 +4023,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
"MainWindow", "Sound files (%s)" %
|
"MainWindow", "Sound files (%s)" %
|
||||||
' '.join(['*%s%s' % (os.extsep, ext) for ext in sound.extensions])
|
' '.join(['*%s%s' % (os.extsep, ext) for ext in sound.extensions])
|
||||||
))]
|
))]
|
||||||
sourcefile = unicode(QtGui.QFileDialog.getOpenFileName(
|
sourcefile, filetype = QtWidgets.QFileDialog.getOpenFileName(
|
||||||
self, _translate("MainWindow", "Set notification sound..."),
|
self, _translate("MainWindow", "Set notification sound..."),
|
||||||
filter=';;'.join(filters)
|
filter=';;'.join(filters)
|
||||||
))
|
)
|
||||||
|
|
||||||
if not sourcefile:
|
if not sourcefile:
|
||||||
return
|
return
|
||||||
|
@ -3816,15 +4041,15 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
pattern = destfile.lower()
|
pattern = destfile.lower()
|
||||||
for item in os.listdir(destdir):
|
for item in os.listdir(destdir):
|
||||||
if item.lower() == pattern:
|
if item.lower() == pattern:
|
||||||
overwrite = QtGui.QMessageBox.question(
|
overwrite = QtWidgets.QMessageBox.question(
|
||||||
self, _translate("MainWindow", "Message"),
|
self, _translate("MainWindow", "Message"),
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"You have already set a notification sound"
|
"You have already set a notification sound"
|
||||||
" for this address book entry."
|
" for this address book entry."
|
||||||
" Do you really want to overwrite it?"),
|
" Do you really want to overwrite it?"),
|
||||||
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No
|
QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No
|
||||||
) == QtGui.QMessageBox.Yes
|
) == QtWidgets.QMessageBox.Yes
|
||||||
if overwrite:
|
if overwrite:
|
||||||
QtCore.QFile.remove(os.path.join(destdir, item))
|
QtCore.QFile.remove(os.path.join(destdir, item))
|
||||||
break
|
break
|
||||||
|
@ -3835,18 +4060,23 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
def on_context_menuYourIdentities(self, point):
|
def on_context_menuYourIdentities(self, point):
|
||||||
currentItem = self.getCurrentItem()
|
currentItem = self.getCurrentItem()
|
||||||
self.popMenuYourIdentities = QtGui.QMenu(self)
|
self.popMenuYourIdentities = QtWidgets.QMenu(self)
|
||||||
if isinstance(currentItem, Ui_AddressWidget):
|
if isinstance(currentItem, Ui_AddressWidget):
|
||||||
self.popMenuYourIdentities.addAction(self.actionNewYourIdentities)
|
self.popMenuYourIdentities.addAction(self.actionNewYourIdentities)
|
||||||
self.popMenuYourIdentities.addSeparator()
|
self.popMenuYourIdentities.addSeparator()
|
||||||
self.popMenuYourIdentities.addAction(self.actionClipboardYourIdentities)
|
self.popMenuYourIdentities.addAction(
|
||||||
|
self.actionClipboardYourIdentities)
|
||||||
self.popMenuYourIdentities.addSeparator()
|
self.popMenuYourIdentities.addSeparator()
|
||||||
if currentItem.isEnabled:
|
if currentItem.isEnabled:
|
||||||
self.popMenuYourIdentities.addAction(self.actionDisableYourIdentities)
|
self.popMenuYourIdentities.addAction(
|
||||||
|
self.actionDisableYourIdentities)
|
||||||
else:
|
else:
|
||||||
self.popMenuYourIdentities.addAction(self.actionEnableYourIdentities)
|
self.popMenuYourIdentities.addAction(
|
||||||
self.popMenuYourIdentities.addAction(self.actionSetAvatarYourIdentities)
|
self.actionEnableYourIdentities)
|
||||||
self.popMenuYourIdentities.addAction(self.actionSpecialAddressBehaviorYourIdentities)
|
self.popMenuYourIdentities.addAction(
|
||||||
|
self.actionSetAvatarYourIdentities)
|
||||||
|
self.popMenuYourIdentities.addAction(
|
||||||
|
self.actionSpecialAddressBehaviorYourIdentities)
|
||||||
self.popMenuYourIdentities.addAction(self.actionEmailGateway)
|
self.popMenuYourIdentities.addAction(self.actionEmailGateway)
|
||||||
self.popMenuYourIdentities.addSeparator()
|
self.popMenuYourIdentities.addSeparator()
|
||||||
if currentItem.type != AccountMixin.ALL:
|
if currentItem.type != AccountMixin.ALL:
|
||||||
|
@ -3862,7 +4092,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# TODO make one popMenu
|
# TODO make one popMenu
|
||||||
def on_context_menuChan(self, point):
|
def on_context_menuChan(self, point):
|
||||||
currentItem = self.getCurrentItem()
|
currentItem = self.getCurrentItem()
|
||||||
self.popMenu = QtGui.QMenu(self)
|
self.popMenu = QtWidgets.QMenu(self)
|
||||||
if isinstance(currentItem, Ui_AddressWidget):
|
if isinstance(currentItem, Ui_AddressWidget):
|
||||||
self.popMenu.addAction(self.actionNew)
|
self.popMenu.addAction(self.actionNew)
|
||||||
self.popMenu.addAction(self.actionDelete)
|
self.popMenu.addAction(self.actionDelete)
|
||||||
|
@ -3892,7 +4122,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
if currentFolder == 'sent':
|
if currentFolder == 'sent':
|
||||||
self.on_context_menuSent(point)
|
self.on_context_menuSent(point)
|
||||||
else:
|
else:
|
||||||
self.popMenuInbox = QtGui.QMenu(self)
|
self.popMenuInbox = QtWidgets.QMenu(self)
|
||||||
self.popMenuInbox.addAction(self.actionForceHtml)
|
self.popMenuInbox.addAction(self.actionForceHtml)
|
||||||
self.popMenuInbox.addAction(self.actionMarkUnread)
|
self.popMenuInbox.addAction(self.actionMarkUnread)
|
||||||
self.popMenuInbox.addSeparator()
|
self.popMenuInbox.addSeparator()
|
||||||
|
@ -3914,13 +4144,14 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.popMenuInbox.addSeparator()
|
self.popMenuInbox.addSeparator()
|
||||||
self.popMenuInbox.addAction(self.actionSaveMessageAs)
|
self.popMenuInbox.addAction(self.actionSaveMessageAs)
|
||||||
if currentFolder == "trash":
|
if currentFolder == "trash":
|
||||||
self.popMenuInbox.addAction(self.actionUndeleteTrashedMessage)
|
self.popMenuInbox.addAction(
|
||||||
|
self.actionUndeleteTrashedMessage)
|
||||||
else:
|
else:
|
||||||
self.popMenuInbox.addAction(self.actionTrashInboxMessage)
|
self.popMenuInbox.addAction(self.actionTrashInboxMessage)
|
||||||
self.popMenuInbox.exec_(tableWidget.mapToGlobal(point))
|
self.popMenuInbox.exec_(tableWidget.mapToGlobal(point))
|
||||||
|
|
||||||
def on_context_menuSent(self, point):
|
def on_context_menuSent(self, point):
|
||||||
self.popMenuSent = QtGui.QMenu(self)
|
self.popMenuSent = QtWidgets.QMenu(self)
|
||||||
self.popMenuSent.addAction(self.actionSentClipboard)
|
self.popMenuSent.addAction(self.actionSentClipboard)
|
||||||
self.popMenuSent.addAction(self.actionTrashSentMessage)
|
self.popMenuSent.addAction(self.actionTrashSentMessage)
|
||||||
|
|
||||||
|
@ -3929,7 +4160,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
currentRow = self.ui.tableWidgetInbox.currentRow()
|
currentRow = self.ui.tableWidgetInbox.currentRow()
|
||||||
if currentRow >= 0:
|
if currentRow >= 0:
|
||||||
ackData = str(self.ui.tableWidgetInbox.item(
|
ackData = str(self.ui.tableWidgetInbox.item(
|
||||||
currentRow, 3).data(QtCore.Qt.UserRole).toPyObject())
|
currentRow, 3).data(QtCore.Qt.UserRole))
|
||||||
queryreturn = sqlQuery('''SELECT status FROM sent where ackdata=?''', ackData)
|
queryreturn = sqlQuery('''SELECT status FROM sent where ackdata=?''', ackData)
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
status, = row
|
status, = row
|
||||||
|
@ -3940,24 +4171,26 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
def inboxSearchLineEditUpdated(self, text):
|
def inboxSearchLineEditUpdated(self, text):
|
||||||
# dynamic search for too short text is slow
|
# dynamic search for too short text is slow
|
||||||
if len(str(text)) < 3:
|
if len(text) < 3:
|
||||||
return
|
return
|
||||||
messagelist = self.getCurrentMessagelist()
|
messagelist = self.getCurrentMessagelist()
|
||||||
searchOption = self.getCurrentSearchOption()
|
searchOption = self.getCurrentSearchOption()
|
||||||
if messagelist:
|
if messagelist:
|
||||||
account = self.getCurrentAccount()
|
account = self.getCurrentAccount()
|
||||||
folder = self.getCurrentFolder()
|
folder = self.getCurrentFolder()
|
||||||
self.loadMessagelist(messagelist, account, folder, searchOption, str(text))
|
self.loadMessagelist(
|
||||||
|
messagelist, account, folder, searchOption, text)
|
||||||
|
|
||||||
def inboxSearchLineEditReturnPressed(self):
|
def inboxSearchLineEditReturnPressed(self):
|
||||||
logger.debug("Search return pressed")
|
logger.debug("Search return pressed")
|
||||||
searchLine = self.getCurrentSearchLine()
|
searchLine = self.getCurrentSearchLine()
|
||||||
messagelist = self.getCurrentMessagelist()
|
messagelist = self.getCurrentMessagelist()
|
||||||
if len(str(searchLine)) < 3:
|
if len(searchLine) < 3:
|
||||||
searchOption = self.getCurrentSearchOption()
|
searchOption = self.getCurrentSearchOption()
|
||||||
account = self.getCurrentAccount()
|
account = self.getCurrentAccount()
|
||||||
folder = self.getCurrentFolder()
|
folder = self.getCurrentFolder()
|
||||||
self.loadMessagelist(messagelist, account, folder, searchOption, searchLine)
|
self.loadMessagelist(
|
||||||
|
messagelist, account, folder, searchOption, searchLine)
|
||||||
if messagelist:
|
if messagelist:
|
||||||
messagelist.setFocus()
|
messagelist.setFocus()
|
||||||
|
|
||||||
|
@ -3966,15 +4199,16 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
searchOption = self.getCurrentSearchOption()
|
searchOption = self.getCurrentSearchOption()
|
||||||
messageTextedit = self.getCurrentMessageTextedit()
|
messageTextedit = self.getCurrentMessageTextedit()
|
||||||
if messageTextedit:
|
if messageTextedit:
|
||||||
messageTextedit.setPlainText(QtCore.QString(""))
|
messageTextedit.setPlainText("")
|
||||||
messagelist = self.getCurrentMessagelist()
|
messagelist = self.getCurrentMessagelist()
|
||||||
if messagelist:
|
if messagelist:
|
||||||
account = self.getCurrentAccount()
|
account = self.getCurrentAccount()
|
||||||
folder = self.getCurrentFolder()
|
folder = self.getCurrentFolder()
|
||||||
treeWidget = self.getCurrentTreeWidget()
|
# treeWidget = self.getCurrentTreeWidget()
|
||||||
# refresh count indicator
|
# refresh count indicator
|
||||||
self.propagateUnreadCount(account.address if hasattr(account, 'address') else None, folder, treeWidget, 0)
|
self.propagateUnreadCount()
|
||||||
self.loadMessagelist(messagelist, account, folder, searchOption, searchLine)
|
self.loadMessagelist(
|
||||||
|
messagelist, account, folder, searchOption, searchLine)
|
||||||
|
|
||||||
def treeWidgetItemChanged(self, item, column):
|
def treeWidgetItemChanged(self, item, column):
|
||||||
# only for manual edits. automatic edits (setText) are ignored
|
# only for manual edits. automatic edits (setText) are ignored
|
||||||
|
@ -3992,8 +4226,8 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# "All accounts" can't be renamed
|
# "All accounts" can't be renamed
|
||||||
if item.type == AccountMixin.ALL:
|
if item.type == AccountMixin.ALL:
|
||||||
return
|
return
|
||||||
|
|
||||||
newLabel = unicode(item.text(0), 'utf-8', 'ignore')
|
newLabel = item.text(0)
|
||||||
oldLabel = item.defaultLabel()
|
oldLabel = item.defaultLabel()
|
||||||
|
|
||||||
# unchanged, do not do anything either
|
# unchanged, do not do anything either
|
||||||
|
@ -4012,7 +4246,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.rerenderMessagelistFromLabels()
|
self.rerenderMessagelistFromLabels()
|
||||||
if item.type != AccountMixin.SUBSCRIPTION:
|
if item.type != AccountMixin.SUBSCRIPTION:
|
||||||
self.rerenderMessagelistToLabels()
|
self.rerenderMessagelistToLabels()
|
||||||
if item.type in (AccountMixin.NORMAL, AccountMixin.CHAN, AccountMixin.SUBSCRIPTION):
|
if item.type in (
|
||||||
|
AccountMixin.NORMAL, AccountMixin.CHAN, AccountMixin.SUBSCRIPTION
|
||||||
|
):
|
||||||
self.rerenderAddressBook()
|
self.rerenderAddressBook()
|
||||||
self.recurDepth -= 1
|
self.recurDepth -= 1
|
||||||
|
|
||||||
|
@ -4032,9 +4268,9 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
message = queryreturn[-1][0]
|
message = unicode(queryreturn[-1][0], 'utf-8')
|
||||||
except NameError:
|
except NameError:
|
||||||
message = ""
|
message = u""
|
||||||
except IndexError:
|
except IndexError:
|
||||||
message = _translate(
|
message = _translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -4110,10 +4346,10 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
obj.loadSettings()
|
obj.loadSettings()
|
||||||
|
|
||||||
|
|
||||||
class settingsDialog(QtGui.QDialog):
|
class settingsDialog(QtWidgets.QDialog):
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
QtGui.QWidget.__init__(self, parent)
|
super(settingsDialog, self).__init__(parent)
|
||||||
self.ui = Ui_settingsDialog()
|
self.ui = Ui_settingsDialog()
|
||||||
self.ui.setupUi(self)
|
self.ui.setupUi(self)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
@ -4135,7 +4371,7 @@ class settingsDialog(QtGui.QDialog):
|
||||||
BMConfigParser().safeGetBoolean('bitmessagesettings', 'useidenticons'))
|
BMConfigParser().safeGetBoolean('bitmessagesettings', 'useidenticons'))
|
||||||
self.ui.checkBoxReplyBelow.setChecked(
|
self.ui.checkBoxReplyBelow.setChecked(
|
||||||
BMConfigParser().safeGetBoolean('bitmessagesettings', 'replybelow'))
|
BMConfigParser().safeGetBoolean('bitmessagesettings', 'replybelow'))
|
||||||
|
|
||||||
if state.appdata == paths.lookupExeFolder():
|
if state.appdata == paths.lookupExeFolder():
|
||||||
self.ui.checkBoxPortableMode.setChecked(True)
|
self.ui.checkBoxPortableMode.setChecked(True)
|
||||||
else:
|
else:
|
||||||
|
@ -4191,8 +4427,8 @@ class settingsDialog(QtGui.QDialog):
|
||||||
BMConfigParser().get('bitmessagesettings', 'socksusername')))
|
BMConfigParser().get('bitmessagesettings', 'socksusername')))
|
||||||
self.ui.lineEditSocksPassword.setText(str(
|
self.ui.lineEditSocksPassword.setText(str(
|
||||||
BMConfigParser().get('bitmessagesettings', 'sockspassword')))
|
BMConfigParser().get('bitmessagesettings', 'sockspassword')))
|
||||||
QtCore.QObject.connect(self.ui.comboBoxProxyType, QtCore.SIGNAL(
|
self.ui.comboBoxProxyType.currentIndexChanged.connect(
|
||||||
"currentIndexChanged(int)"), self.comboBoxProxyTypeChanged)
|
self.comboBoxProxyTypeChanged)
|
||||||
self.ui.lineEditMaxDownloadRate.setText(str(
|
self.ui.lineEditMaxDownloadRate.setText(str(
|
||||||
BMConfigParser().get('bitmessagesettings', 'maxdownloadrate')))
|
BMConfigParser().get('bitmessagesettings', 'maxdownloadrate')))
|
||||||
self.ui.lineEditMaxUploadRate.setText(str(
|
self.ui.lineEditMaxUploadRate.setText(str(
|
||||||
|
@ -4248,39 +4484,39 @@ class settingsDialog(QtGui.QDialog):
|
||||||
else:
|
else:
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
QtCore.QObject.connect(self.ui.radioButtonNamecoinNamecoind, QtCore.SIGNAL(
|
self.ui.radioButtonNamecoinNamecoind.toggled.connect(
|
||||||
"toggled(bool)"), self.namecoinTypeChanged)
|
self.namecoinTypeChanged)
|
||||||
QtCore.QObject.connect(self.ui.radioButtonNamecoinNmcontrol, QtCore.SIGNAL(
|
self.ui.radioButtonNamecoinNmcontrol.toggled.connect(
|
||||||
"toggled(bool)"), self.namecoinTypeChanged)
|
self.namecoinTypeChanged)
|
||||||
QtCore.QObject.connect(self.ui.pushButtonNamecoinTest, QtCore.SIGNAL(
|
self.ui.pushButtonNamecoinTest.clicked.connect(
|
||||||
"clicked()"), self.click_pushButtonNamecoinTest)
|
self.click_pushButtonNamecoinTest)
|
||||||
|
|
||||||
#Message Resend tab
|
# Message Resend tab
|
||||||
self.ui.lineEditDays.setText(str(
|
self.ui.lineEditDays.setText(str(
|
||||||
BMConfigParser().get('bitmessagesettings', 'stopresendingafterxdays')))
|
BMConfigParser().get('bitmessagesettings', 'stopresendingafterxdays')))
|
||||||
self.ui.lineEditMonths.setText(str(
|
self.ui.lineEditMonths.setText(str(
|
||||||
BMConfigParser().get('bitmessagesettings', 'stopresendingafterxmonths')))
|
BMConfigParser().get('bitmessagesettings', 'stopresendingafterxmonths')))
|
||||||
|
|
||||||
|
|
||||||
#'System' tab removed for now.
|
|
||||||
"""try:
|
|
||||||
maxCores = BMConfigParser().getint('bitmessagesettings', 'maxcores')
|
|
||||||
except:
|
|
||||||
maxCores = 99999
|
|
||||||
if maxCores <= 1:
|
|
||||||
self.ui.comboBoxMaxCores.setCurrentIndex(0)
|
|
||||||
elif maxCores == 2:
|
|
||||||
self.ui.comboBoxMaxCores.setCurrentIndex(1)
|
|
||||||
elif maxCores <= 4:
|
|
||||||
self.ui.comboBoxMaxCores.setCurrentIndex(2)
|
|
||||||
elif maxCores <= 8:
|
|
||||||
self.ui.comboBoxMaxCores.setCurrentIndex(3)
|
|
||||||
elif maxCores <= 16:
|
|
||||||
self.ui.comboBoxMaxCores.setCurrentIndex(4)
|
|
||||||
else:
|
|
||||||
self.ui.comboBoxMaxCores.setCurrentIndex(5)"""
|
|
||||||
|
|
||||||
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
|
# 'System' tab removed for now.
|
||||||
|
# try:
|
||||||
|
# maxCores = BMConfigParser().getint(
|
||||||
|
# 'bitmessagesettings', 'maxcores')
|
||||||
|
# except:
|
||||||
|
# maxCores = 99999
|
||||||
|
# if maxCores <= 1:
|
||||||
|
# self.ui.comboBoxMaxCores.setCurrentIndex(0)
|
||||||
|
# elif maxCores == 2:
|
||||||
|
# self.ui.comboBoxMaxCores.setCurrentIndex(1)
|
||||||
|
# elif maxCores <= 4:
|
||||||
|
# self.ui.comboBoxMaxCores.setCurrentIndex(2)
|
||||||
|
# elif maxCores <= 8:
|
||||||
|
# self.ui.comboBoxMaxCores.setCurrentIndex(3)
|
||||||
|
# elif maxCores <= 16:
|
||||||
|
# self.ui.comboBoxMaxCores.setCurrentIndex(4)
|
||||||
|
# else:
|
||||||
|
# self.ui.comboBoxMaxCores.setCurrentIndex(5)
|
||||||
|
|
||||||
|
QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
|
||||||
|
|
||||||
def comboBoxProxyTypeChanged(self, comboBoxIndex):
|
def comboBoxProxyTypeChanged(self, comboBoxIndex):
|
||||||
if comboBoxIndex == 0:
|
if comboBoxIndex == 0:
|
||||||
|
@ -4312,7 +4548,7 @@ class settingsDialog(QtGui.QDialog):
|
||||||
def namecoinTypeChanged(self, checked):
|
def namecoinTypeChanged(self, checked):
|
||||||
nmctype = self.getNamecoinType()
|
nmctype = self.getNamecoinType()
|
||||||
assert nmctype == "namecoind" or nmctype == "nmcontrol"
|
assert nmctype == "namecoind" or nmctype == "nmcontrol"
|
||||||
|
|
||||||
isNamecoind = (nmctype == "namecoind")
|
isNamecoind = (nmctype == "namecoind")
|
||||||
self.ui.lineEditNamecoinUser.setEnabled(isNamecoind)
|
self.ui.lineEditNamecoinUser.setEnabled(isNamecoind)
|
||||||
self.ui.labelNamecoinUser.setEnabled(isNamecoind)
|
self.ui.labelNamecoinUser.setEnabled(isNamecoind)
|
||||||
|
@ -4330,33 +4566,43 @@ class settingsDialog(QtGui.QDialog):
|
||||||
"MainWindow", "Testing..."))
|
"MainWindow", "Testing..."))
|
||||||
options = {}
|
options = {}
|
||||||
options["type"] = self.getNamecoinType()
|
options["type"] = self.getNamecoinType()
|
||||||
options["host"] = str(self.ui.lineEditNamecoinHost.text().toUtf8())
|
options["host"] = str(self.ui.lineEditNamecoinHost.text())
|
||||||
options["port"] = str(self.ui.lineEditNamecoinPort.text().toUtf8())
|
options["port"] = str(self.ui.lineEditNamecoinPort.text())
|
||||||
options["user"] = str(self.ui.lineEditNamecoinUser.text().toUtf8())
|
options["user"] = str(self.ui.lineEditNamecoinUser.text())
|
||||||
options["password"] = str(self.ui.lineEditNamecoinPassword.text().toUtf8())
|
options["password"] = str(self.ui.lineEditNamecoinPassword.text())
|
||||||
nc = namecoinConnection(options)
|
nc = namecoinConnection(options)
|
||||||
response = nc.test()
|
response = nc.test()
|
||||||
responseStatus = response[0]
|
responseStatus = response[0]
|
||||||
responseText = response[1]
|
responseText = response[1]
|
||||||
self.ui.labelNamecoinTestResult.setText(responseText)
|
self.ui.labelNamecoinTestResult.setText(responseText)
|
||||||
if responseStatus== 'success':
|
if responseStatus == 'success':
|
||||||
self.parent.ui.pushButtonFetchNamecoinID.show()
|
self.parent.ui.pushButtonFetchNamecoinID.show()
|
||||||
|
|
||||||
|
|
||||||
# In order for the time columns on the Inbox and Sent tabs to be sorted
|
# In order for the time columns on the Inbox and Sent tabs to be sorted
|
||||||
# correctly (rather than alphabetically), we need to overload the <
|
# correctly (rather than alphabetically), we need to overload the <
|
||||||
# operator and use this class instead of QTableWidgetItem.
|
# operator and use this class instead of QTableWidgetItem.
|
||||||
class myTableWidgetItem(QtGui.QTableWidgetItem):
|
class myTableWidgetItem(QtWidgets.QTableWidgetItem):
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
return int(self.data(33).toPyObject()) < int(other.data(33).toPyObject())
|
return self.data(33) < other.data(33)
|
||||||
|
|
||||||
|
def setData(self, role, value):
|
||||||
|
if role == QtCore.Qt.UserRole:
|
||||||
|
self._data = value
|
||||||
|
return super(myTableWidgetItem, self).setData(role, value)
|
||||||
|
|
||||||
|
def data(self, role):
|
||||||
|
if role == QtCore.Qt.UserRole:
|
||||||
|
return self._data
|
||||||
|
return super(myTableWidgetItem, self).data(role)
|
||||||
|
|
||||||
|
|
||||||
app = None
|
app = None
|
||||||
myapp = None
|
myapp = None
|
||||||
|
|
||||||
|
|
||||||
class MySingleApplication(QtGui.QApplication):
|
class MySingleApplication(QtWidgets.QApplication):
|
||||||
"""
|
"""
|
||||||
Listener to allow our Qt form to get focus when another instance of the
|
Listener to allow our Qt form to get focus when another instance of the
|
||||||
application is open.
|
application is open.
|
||||||
|
@ -4375,15 +4621,15 @@ class MySingleApplication(QtGui.QApplication):
|
||||||
self.server = None
|
self.server = None
|
||||||
self.is_running = False
|
self.is_running = False
|
||||||
|
|
||||||
socket = QLocalSocket()
|
socket = QtNetwork.QLocalSocket()
|
||||||
socket.connectToServer(id)
|
socket.connectToServer(id)
|
||||||
self.is_running = socket.waitForConnected()
|
self.is_running = socket.waitForConnected()
|
||||||
|
|
||||||
# Cleanup past crashed servers
|
# Cleanup past crashed servers
|
||||||
if not self.is_running:
|
if not self.is_running:
|
||||||
if socket.error() == QLocalSocket.ConnectionRefusedError:
|
if socket.error() == QtNetwork.QLocalSocket.ConnectionRefusedError:
|
||||||
socket.disconnectFromServer()
|
socket.disconnectFromServer()
|
||||||
QLocalServer.removeServer(id)
|
QtNetwork.QLocalServer.removeServer(id)
|
||||||
|
|
||||||
socket.abort()
|
socket.abort()
|
||||||
|
|
||||||
|
@ -4394,7 +4640,7 @@ class MySingleApplication(QtGui.QApplication):
|
||||||
else:
|
else:
|
||||||
# Nope, create a local server with this id and assign on_new_connection
|
# Nope, create a local server with this id and assign on_new_connection
|
||||||
# for whenever a second instance tries to run focus the application.
|
# for whenever a second instance tries to run focus the application.
|
||||||
self.server = QLocalServer()
|
self.server = QtNetwork.QLocalServer()
|
||||||
self.server.listen(id)
|
self.server.listen(id)
|
||||||
self.server.newConnection.connect(self.on_new_connection)
|
self.server.newConnection.connect(self.on_new_connection)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from qtpy import QtGui
|
||||||
|
|
||||||
import queues
|
import queues
|
||||||
import re
|
import re
|
||||||
|
@ -9,18 +9,21 @@ from helper_ackPayload import genAckPayload
|
||||||
from addresses import decodeAddress
|
from addresses import decodeAddress
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from foldertree import AccountMixin
|
from foldertree import AccountMixin
|
||||||
from pyelliptic.openssl import OpenSSL
|
|
||||||
from utils import str_broadcast_subscribers
|
from utils import str_broadcast_subscribers
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
def getSortedAccounts():
|
def getSortedAccounts():
|
||||||
configSections = BMConfigParser().addresses()
|
configSections = BMConfigParser().addresses()
|
||||||
configSections.sort(cmp =
|
configSections.sort(
|
||||||
lambda x,y: cmp(unicode(BMConfigParser().get(x, 'label'), 'utf-8').lower(), unicode(BMConfigParser().get(y, 'label'), 'utf-8').lower())
|
cmp=lambda x, y: cmp(
|
||||||
)
|
unicode(BMConfigParser().get(x, 'label'), 'utf-8').lower(),
|
||||||
|
unicode(BMConfigParser().get(y, 'label'), 'utf-8').lower())
|
||||||
|
)
|
||||||
return configSections
|
return configSections
|
||||||
|
|
||||||
def getSortedSubscriptions(count = False):
|
|
||||||
|
def getSortedSubscriptions(count=False):
|
||||||
queryreturn = sqlQuery('SELECT label, address, enabled FROM subscriptions ORDER BY label COLLATE NOCASE ASC')
|
queryreturn = sqlQuery('SELECT label, address, enabled FROM subscriptions ORDER BY label COLLATE NOCASE ASC')
|
||||||
ret = {}
|
ret = {}
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
|
@ -37,7 +40,7 @@ def getSortedSubscriptions(count = False):
|
||||||
GROUP BY inbox.fromaddress, folder''', str_broadcast_subscribers)
|
GROUP BY inbox.fromaddress, folder''', str_broadcast_subscribers)
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
address, folder, cnt = row
|
address, folder, cnt = row
|
||||||
if not folder in ret[address]:
|
if folder not in ret[address]:
|
||||||
ret[address][folder] = {
|
ret[address][folder] = {
|
||||||
'label': ret[address]['inbox']['label'],
|
'label': ret[address]['inbox']['label'],
|
||||||
'enabled': ret[address]['inbox']['enabled']
|
'enabled': ret[address]['inbox']['enabled']
|
||||||
|
@ -45,6 +48,7 @@ def getSortedSubscriptions(count = False):
|
||||||
ret[address][folder]['count'] = cnt
|
ret[address][folder]['count'] = cnt
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def accountClass(address):
|
def accountClass(address):
|
||||||
if not BMConfigParser().has_section(address):
|
if not BMConfigParser().has_section(address):
|
||||||
# FIXME: This BROADCAST section makes no sense
|
# FIXME: This BROADCAST section makes no sense
|
||||||
|
@ -60,8 +64,9 @@ def accountClass(address):
|
||||||
return subscription
|
return subscription
|
||||||
try:
|
try:
|
||||||
gateway = BMConfigParser().get(address, "gateway")
|
gateway = BMConfigParser().get(address, "gateway")
|
||||||
for name, cls in inspect.getmembers(sys.modules[__name__], inspect.isclass):
|
for name, cls in inspect.getmembers(
|
||||||
# obj = g(address)
|
sys.modules[__name__], inspect.isclass):
|
||||||
|
# obj = g(address)
|
||||||
if issubclass(cls, GatewayAccount) and cls.gatewayName == gateway:
|
if issubclass(cls, GatewayAccount) and cls.gatewayName == gateway:
|
||||||
return cls(address)
|
return cls(address)
|
||||||
# general gateway
|
# general gateway
|
||||||
|
@ -70,9 +75,10 @@ def accountClass(address):
|
||||||
pass
|
pass
|
||||||
# no gateway
|
# no gateway
|
||||||
return BMAccount(address)
|
return BMAccount(address)
|
||||||
|
|
||||||
|
|
||||||
class AccountColor(AccountMixin):
|
class AccountColor(AccountMixin):
|
||||||
def __init__(self, address, type = None):
|
def __init__(self, address, type=None):
|
||||||
self.isEnabled = True
|
self.isEnabled = True
|
||||||
self.address = address
|
self.address = address
|
||||||
if type is None:
|
if type is None:
|
||||||
|
@ -90,9 +96,9 @@ class AccountColor(AccountMixin):
|
||||||
else:
|
else:
|
||||||
self.type = type
|
self.type = type
|
||||||
|
|
||||||
|
|
||||||
class BMAccount(object):
|
class BMAccount(object):
|
||||||
def __init__(self, address = None):
|
def __init__(self, address=None):
|
||||||
self.address = address
|
self.address = address
|
||||||
self.type = AccountMixin.NORMAL
|
self.type = AccountMixin.NORMAL
|
||||||
if BMConfigParser().has_section(address):
|
if BMConfigParser().has_section(address):
|
||||||
|
@ -108,7 +114,7 @@ class BMAccount(object):
|
||||||
if queryreturn:
|
if queryreturn:
|
||||||
self.type = AccountMixin.SUBSCRIPTION
|
self.type = AccountMixin.SUBSCRIPTION
|
||||||
|
|
||||||
def getLabel(self, address = None):
|
def getLabel(self, address=None):
|
||||||
if address is None:
|
if address is None:
|
||||||
address = self.address
|
address = self.address
|
||||||
label = address
|
label = address
|
||||||
|
@ -125,46 +131,44 @@ class BMAccount(object):
|
||||||
if queryreturn != []:
|
if queryreturn != []:
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
label, = row
|
label, = row
|
||||||
return label
|
return unicode(label, 'utf-8')
|
||||||
|
|
||||||
def parseMessage(self, toAddress, fromAddress, subject, message):
|
def parseMessage(self, toAddress, fromAddress, subject, message):
|
||||||
self.toAddress = toAddress
|
self.toAddress = toAddress
|
||||||
self.fromAddress = fromAddress
|
self.fromAddress = fromAddress
|
||||||
if isinstance(subject, unicode):
|
self.subject = subject
|
||||||
self.subject = str(subject)
|
|
||||||
else:
|
|
||||||
self.subject = subject
|
|
||||||
self.message = message
|
self.message = message
|
||||||
self.fromLabel = self.getLabel(fromAddress)
|
self.fromLabel = self.getLabel(fromAddress)
|
||||||
self.toLabel = self.getLabel(toAddress)
|
self.toLabel = self.getLabel(toAddress)
|
||||||
|
|
||||||
|
|
||||||
class NoAccount(BMAccount):
|
class NoAccount(BMAccount):
|
||||||
def __init__(self, address = None):
|
def __init__(self, address=None):
|
||||||
self.address = address
|
self.address = address
|
||||||
self.type = AccountMixin.NORMAL
|
self.type = AccountMixin.NORMAL
|
||||||
|
|
||||||
def getLabel(self, address = None):
|
def getLabel(self, address=None):
|
||||||
if address is None:
|
if address is None:
|
||||||
address = self.address
|
address = self.address
|
||||||
return address
|
return address
|
||||||
|
|
||||||
|
|
||||||
class SubscriptionAccount(BMAccount):
|
class SubscriptionAccount(BMAccount):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BroadcastAccount(BMAccount):
|
class BroadcastAccount(BMAccount):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class GatewayAccount(BMAccount):
|
class GatewayAccount(BMAccount):
|
||||||
gatewayName = None
|
gatewayName = None
|
||||||
ALL_OK = 0
|
ALL_OK = 0
|
||||||
REGISTRATION_DENIED = 1
|
REGISTRATION_DENIED = 1
|
||||||
|
|
||||||
def __init__(self, address):
|
def __init__(self, address):
|
||||||
super(GatewayAccount, self).__init__(address)
|
super(GatewayAccount, self).__init__(address)
|
||||||
|
|
||||||
def send(self):
|
def send(self):
|
||||||
status, addressVersionNumber, streamNumber, ripe = decodeAddress(self.toAddress)
|
status, addressVersionNumber, streamNumber, ripe = decodeAddress(self.toAddress)
|
||||||
stealthLevel = BMConfigParser().safeGetInt('bitmessagesettings', 'ackstealthlevel')
|
stealthLevel = BMConfigParser().safeGetInt('bitmessagesettings', 'ackstealthlevel')
|
||||||
|
@ -190,9 +194,7 @@ class GatewayAccount(BMAccount):
|
||||||
)
|
)
|
||||||
|
|
||||||
queues.workerQueue.put(('sendmessage', self.toAddress))
|
queues.workerQueue.put(('sendmessage', self.toAddress))
|
||||||
|
|
||||||
def parseMessage(self, toAddress, fromAddress, subject, message):
|
|
||||||
super(GatewayAccount, self).parseMessage(toAddress, fromAddress, subject, message)
|
|
||||||
|
|
||||||
class MailchuckAccount(GatewayAccount):
|
class MailchuckAccount(GatewayAccount):
|
||||||
# set "gateway" in keys.dat to this
|
# set "gateway" in keys.dat to this
|
||||||
|
@ -202,23 +204,24 @@ class MailchuckAccount(GatewayAccount):
|
||||||
relayAddress = "BM-2cWim8aZwUNqxzjMxstnUMtVEUQJeezstf"
|
relayAddress = "BM-2cWim8aZwUNqxzjMxstnUMtVEUQJeezstf"
|
||||||
regExpIncoming = re.compile("(.*)MAILCHUCK-FROM::(\S+) \| (.*)")
|
regExpIncoming = re.compile("(.*)MAILCHUCK-FROM::(\S+) \| (.*)")
|
||||||
regExpOutgoing = re.compile("(\S+) (.*)")
|
regExpOutgoing = re.compile("(\S+) (.*)")
|
||||||
|
|
||||||
def __init__(self, address):
|
def __init__(self, address):
|
||||||
super(MailchuckAccount, self).__init__(address)
|
super(MailchuckAccount, self).__init__(address)
|
||||||
self.feedback = self.ALL_OK
|
self.feedback = self.ALL_OK
|
||||||
|
|
||||||
def createMessage(self, toAddress, fromAddress, subject, message):
|
def createMessage(self, toAddress, fromAddress, subject, message):
|
||||||
self.subject = toAddress + " " + subject
|
self.subject = toAddress + " " + subject
|
||||||
self.toAddress = self.relayAddress
|
self.toAddress = self.relayAddress
|
||||||
self.fromAddress = fromAddress
|
self.fromAddress = fromAddress
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
||||||
def register(self, email):
|
def register(self, email):
|
||||||
self.toAddress = self.registrationAddress
|
self.toAddress = self.registrationAddress
|
||||||
self.subject = email
|
self.subject = email
|
||||||
self.message = ""
|
self.message = ""
|
||||||
self.fromAddress = self.address
|
self.fromAddress = self.address
|
||||||
self.send()
|
self.send()
|
||||||
|
|
||||||
def unregister(self):
|
def unregister(self):
|
||||||
self.toAddress = self.unregistrationAddress
|
self.toAddress = self.unregistrationAddress
|
||||||
self.subject = ""
|
self.subject = ""
|
||||||
|
@ -255,7 +258,7 @@ class MailchuckAccount(GatewayAccount):
|
||||||
#
|
#
|
||||||
# attachments: no
|
# attachments: no
|
||||||
# Attachments will be ignored.
|
# Attachments will be ignored.
|
||||||
#
|
#
|
||||||
# archive: yes
|
# archive: yes
|
||||||
# Your incoming emails will be archived on the server. Use this if you need
|
# Your incoming emails will be archived on the server. Use this if you need
|
||||||
# help with debugging problems or you need a third party proof of emails. This
|
# help with debugging problems or you need a third party proof of emails. This
|
||||||
|
@ -279,10 +282,12 @@ class MailchuckAccount(GatewayAccount):
|
||||||
self.fromAddress = self.address
|
self.fromAddress = self.address
|
||||||
|
|
||||||
def parseMessage(self, toAddress, fromAddress, subject, message):
|
def parseMessage(self, toAddress, fromAddress, subject, message):
|
||||||
super(MailchuckAccount, self).parseMessage(toAddress, fromAddress, subject, message)
|
super(MailchuckAccount, self).parseMessage(
|
||||||
|
toAddress, fromAddress, subject, message
|
||||||
|
)
|
||||||
if fromAddress == self.relayAddress:
|
if fromAddress == self.relayAddress:
|
||||||
matches = self.regExpIncoming.search(subject)
|
matches = self.regExpIncoming.search(subject)
|
||||||
if not matches is None:
|
if matches is not None:
|
||||||
self.subject = ""
|
self.subject = ""
|
||||||
if not matches.group(1) is None:
|
if not matches.group(1) is None:
|
||||||
self.subject += matches.group(1)
|
self.subject += matches.group(1)
|
||||||
|
@ -293,13 +298,14 @@ class MailchuckAccount(GatewayAccount):
|
||||||
self.fromAddress = matches.group(2)
|
self.fromAddress = matches.group(2)
|
||||||
if toAddress == self.relayAddress:
|
if toAddress == self.relayAddress:
|
||||||
matches = self.regExpOutgoing.search(subject)
|
matches = self.regExpOutgoing.search(subject)
|
||||||
if not matches is None:
|
if matches is not None:
|
||||||
if not matches.group(2) is None:
|
if not matches.group(2) is None:
|
||||||
self.subject = matches.group(2)
|
self.subject = matches.group(2)
|
||||||
if not matches.group(1) is None:
|
if not matches.group(1) is None:
|
||||||
self.toLabel = matches.group(1)
|
self.toLabel = matches.group(1)
|
||||||
self.toAddress = matches.group(1)
|
self.toAddress = matches.group(1)
|
||||||
self.feedback = self.ALL_OK
|
self.feedback = self.ALL_OK
|
||||||
if fromAddress == self.registrationAddress and self.subject == "Registration Request Denied":
|
if fromAddress == self.registrationAddress \
|
||||||
|
and self.subject == "Registration Request Denied":
|
||||||
self.feedback = self.REGISTRATION_DENIED
|
self.feedback = self.REGISTRATION_DENIED
|
||||||
return self.feedback
|
return self.feedback
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from qtpy import QtGui, QtWidgets
|
||||||
from addresses import decodeAddress, encodeVarint, addBMIfNotPresent
|
from addresses import decodeAddress, encodeVarint, addBMIfNotPresent
|
||||||
from account import (
|
from account import (
|
||||||
GatewayAccount, MailchuckAccount, AccountMixin, accountClass,
|
GatewayAccount, MailchuckAccount, AccountMixin, accountClass,
|
||||||
|
@ -15,17 +15,15 @@ from inventory import Inventory
|
||||||
|
|
||||||
class AddressCheckMixin(object):
|
class AddressCheckMixin(object):
|
||||||
|
|
||||||
def __init__(self):
|
def _setup(self):
|
||||||
self.valid = False
|
self.valid = False
|
||||||
QtCore.QObject.connect(self.lineEditAddress, QtCore.SIGNAL(
|
self.lineEditAddress.textChanged.connect(self.addressChanged)
|
||||||
"textChanged(QString)"), self.addressChanged)
|
|
||||||
|
|
||||||
def _onSuccess(self, addressVersion, streamNumber, ripe):
|
def _onSuccess(self, addressVersion, streamNumber, ripe):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def addressChanged(self, QString):
|
def addressChanged(self, address):
|
||||||
status, addressVersion, streamNumber, ripe = decodeAddress(
|
status, addressVersion, streamNumber, ripe = decodeAddress(address)
|
||||||
str(QString))
|
|
||||||
self.valid = status == 'success'
|
self.valid = status == 'success'
|
||||||
if self.valid:
|
if self.valid:
|
||||||
self.labelAddressCheck.setText(
|
self.labelAddressCheck.setText(
|
||||||
|
@ -70,7 +68,7 @@ class AddressCheckMixin(object):
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
class AddressDataDialog(QtGui.QDialog, AddressCheckMixin):
|
class AddressDataDialog(QtWidgets.QDialog, AddressCheckMixin):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super(AddressDataDialog, self).__init__(parent)
|
super(AddressDataDialog, self).__init__(parent)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
@ -79,7 +77,7 @@ class AddressDataDialog(QtGui.QDialog, AddressCheckMixin):
|
||||||
if self.valid:
|
if self.valid:
|
||||||
self.data = (
|
self.data = (
|
||||||
addBMIfNotPresent(str(self.lineEditAddress.text())),
|
addBMIfNotPresent(str(self.lineEditAddress.text())),
|
||||||
str(self.lineEditLabel.text().toUtf8())
|
self.lineEditLabel.text().encode('utf-8')
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
queues.UISignalQueue.put(('updateStatusBar', _translate(
|
queues.UISignalQueue.put(('updateStatusBar', _translate(
|
||||||
|
@ -94,12 +92,12 @@ class AddAddressDialog(AddressDataDialog, RetranslateMixin):
|
||||||
def __init__(self, parent=None, address=None):
|
def __init__(self, parent=None, address=None):
|
||||||
super(AddAddressDialog, self).__init__(parent)
|
super(AddAddressDialog, self).__init__(parent)
|
||||||
widgets.load('addaddressdialog.ui', self)
|
widgets.load('addaddressdialog.ui', self)
|
||||||
AddressCheckMixin.__init__(self)
|
self._setup()
|
||||||
if address:
|
if address:
|
||||||
self.lineEditAddress.setText(address)
|
self.lineEditAddress.setText(address)
|
||||||
|
|
||||||
|
|
||||||
class NewAddressDialog(QtGui.QDialog, RetranslateMixin):
|
class NewAddressDialog(QtWidgets.QDialog, RetranslateMixin):
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(NewAddressDialog, self).__init__(parent)
|
super(NewAddressDialog, self).__init__(parent)
|
||||||
|
@ -111,7 +109,7 @@ class NewAddressDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
self.radioButtonExisting.click()
|
self.radioButtonExisting.click()
|
||||||
self.comboBoxExisting.addItem(address)
|
self.comboBoxExisting.addItem(address)
|
||||||
self.groupBoxDeterministic.setHidden(True)
|
self.groupBoxDeterministic.setHidden(True)
|
||||||
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
|
QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
@ -127,13 +125,13 @@ class NewAddressDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
self.comboBoxExisting.currentText())[2]
|
self.comboBoxExisting.currentText())[2]
|
||||||
queues.addressGeneratorQueue.put((
|
queues.addressGeneratorQueue.put((
|
||||||
'createRandomAddress', 4, streamNumberForAddress,
|
'createRandomAddress', 4, streamNumberForAddress,
|
||||||
str(self.newaddresslabel.text().toUtf8()), 1, "",
|
self.newaddresslabel.text().encode('utf-8'), 1, "",
|
||||||
self.checkBoxEighteenByteRipe.isChecked()
|
self.checkBoxEighteenByteRipe.isChecked()
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
if self.lineEditPassphrase.text() != \
|
if self.lineEditPassphrase.text() != \
|
||||||
self.lineEditPassphraseAgain.text():
|
self.lineEditPassphraseAgain.text():
|
||||||
QtGui.QMessageBox.about(
|
QtWidgets.QMessageBox.about(
|
||||||
self, _translate("MainWindow", "Passphrase mismatch"),
|
self, _translate("MainWindow", "Passphrase mismatch"),
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
|
@ -141,7 +139,7 @@ class NewAddressDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
" match. Try again.")
|
" match. Try again.")
|
||||||
)
|
)
|
||||||
elif self.lineEditPassphrase.text() == "":
|
elif self.lineEditPassphrase.text() == "":
|
||||||
QtGui.QMessageBox.about(
|
QtWidgets.QMessageBox.about(
|
||||||
self, _translate("MainWindow", "Choose a passphrase"),
|
self, _translate("MainWindow", "Choose a passphrase"),
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow", "You really do need a passphrase.")
|
"MainWindow", "You really do need a passphrase.")
|
||||||
|
@ -154,7 +152,7 @@ class NewAddressDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
'createDeterministicAddresses', 4, streamNumberForAddress,
|
'createDeterministicAddresses', 4, streamNumberForAddress,
|
||||||
"unused deterministic address",
|
"unused deterministic address",
|
||||||
self.spinBoxNumberOfAddressesToMake.value(),
|
self.spinBoxNumberOfAddressesToMake.value(),
|
||||||
self.lineEditPassphrase.text().toUtf8(),
|
self.lineEditPassphrase.text().encode('utf-8'),
|
||||||
self.checkBoxEighteenByteRipe.isChecked()
|
self.checkBoxEighteenByteRipe.isChecked()
|
||||||
))
|
))
|
||||||
|
|
||||||
|
@ -164,7 +162,7 @@ class NewSubscriptionDialog(AddressDataDialog, RetranslateMixin):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(NewSubscriptionDialog, self).__init__(parent)
|
super(NewSubscriptionDialog, self).__init__(parent)
|
||||||
widgets.load('newsubscriptiondialog.ui', self)
|
widgets.load('newsubscriptiondialog.ui', self)
|
||||||
AddressCheckMixin.__init__(self)
|
self._setup()
|
||||||
|
|
||||||
def _onSuccess(self, addressVersion, streamNumber, ripe):
|
def _onSuccess(self, addressVersion, streamNumber, ripe):
|
||||||
if addressVersion <= 3:
|
if addressVersion <= 3:
|
||||||
|
@ -195,21 +193,19 @@ class NewSubscriptionDialog(AddressDataDialog, RetranslateMixin):
|
||||||
_translate(
|
_translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"Display the %n recent broadcast(s) from this address.",
|
"Display the %n recent broadcast(s) from this address.",
|
||||||
None,
|
None, count
|
||||||
QtCore.QCoreApplication.CodecForTr,
|
|
||||||
count
|
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
class RegenerateAddressesDialog(QtGui.QDialog, RetranslateMixin):
|
class RegenerateAddressesDialog(QtWidgets.QDialog, RetranslateMixin):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(RegenerateAddressesDialog, self).__init__(parent)
|
super(RegenerateAddressesDialog, self).__init__(parent)
|
||||||
widgets.load('regenerateaddresses.ui', self)
|
widgets.load('regenerateaddresses.ui', self)
|
||||||
self.groupBox.setTitle('')
|
self.groupBox.setTitle('')
|
||||||
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
|
QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
|
||||||
|
|
||||||
|
|
||||||
class SpecialAddressBehaviorDialog(QtGui.QDialog, RetranslateMixin):
|
class SpecialAddressBehaviorDialog(QtWidgets.QDialog, RetranslateMixin):
|
||||||
|
|
||||||
def __init__(self, parent=None, config=None):
|
def __init__(self, parent=None, config=None):
|
||||||
super(SpecialAddressBehaviorDialog, self).__init__(parent)
|
super(SpecialAddressBehaviorDialog, self).__init__(parent)
|
||||||
|
@ -246,7 +242,7 @@ class SpecialAddressBehaviorDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
unicode(mailingListName, 'utf-8')
|
unicode(mailingListName, 'utf-8')
|
||||||
)
|
)
|
||||||
|
|
||||||
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
|
QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
@ -258,14 +254,15 @@ class SpecialAddressBehaviorDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
# Set the color to either black or grey
|
# Set the color to either black or grey
|
||||||
if self.config.getboolean(self.address, 'enabled'):
|
if self.config.getboolean(self.address, 'enabled'):
|
||||||
self.parent.setCurrentItemColor(
|
self.parent.setCurrentItemColor(
|
||||||
QtGui.QApplication.palette().text().color()
|
QtWidgets.QApplication.palette().text().color()
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.parent.setCurrentItemColor(QtGui.QColor(128, 128, 128))
|
self.parent.setCurrentItemColor(QtGui.QColor(128, 128, 128))
|
||||||
else:
|
else:
|
||||||
self.config.set(str(self.address), 'mailinglist', 'true')
|
self.config.set(str(self.address), 'mailinglist', 'true')
|
||||||
self.config.set(str(self.address), 'mailinglistname', str(
|
self.config.set(
|
||||||
self.lineEditMailingListName.text().toUtf8()))
|
str(self.address), 'mailinglistname',
|
||||||
|
self.lineEditMailingListName.text().encode('utf-8'))
|
||||||
self.parent.setCurrentItemColor(
|
self.parent.setCurrentItemColor(
|
||||||
QtGui.QColor(137, 04, 177)) # magenta
|
QtGui.QColor(137, 04, 177)) # magenta
|
||||||
self.parent.rerenderComboBoxSendFrom()
|
self.parent.rerenderComboBoxSendFrom()
|
||||||
|
@ -274,7 +271,7 @@ class SpecialAddressBehaviorDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
self.parent.rerenderMessagelistToLabels()
|
self.parent.rerenderMessagelistToLabels()
|
||||||
|
|
||||||
|
|
||||||
class EmailGatewayDialog(QtGui.QDialog, RetranslateMixin):
|
class EmailGatewayDialog(QtWidgets.QDialog, RetranslateMixin):
|
||||||
def __init__(self, parent, config=None, account=None):
|
def __init__(self, parent, config=None, account=None):
|
||||||
super(EmailGatewayDialog, self).__init__(parent)
|
super(EmailGatewayDialog, self).__init__(parent)
|
||||||
widgets.load('emailgateway.ui', self)
|
widgets.load('emailgateway.ui', self)
|
||||||
|
@ -312,7 +309,7 @@ class EmailGatewayDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
else:
|
else:
|
||||||
self.acct = MailchuckAccount(address)
|
self.acct = MailchuckAccount(address)
|
||||||
self.lineEditEmail.setFocus()
|
self.lineEditEmail.setFocus()
|
||||||
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
|
QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
self.hide()
|
self.hide()
|
||||||
|
@ -325,7 +322,7 @@ class EmailGatewayDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
|
|
||||||
if self.radioButtonRegister.isChecked() \
|
if self.radioButtonRegister.isChecked() \
|
||||||
or self.radioButtonRegister.isHidden():
|
or self.radioButtonRegister.isHidden():
|
||||||
email = str(self.lineEditEmail.text().toUtf8())
|
email = self.lineEditEmail.text().encode('utf-8')
|
||||||
self.acct.register(email)
|
self.acct.register(email)
|
||||||
self.config.set(self.acct.fromAddress, 'label', email)
|
self.config.set(self.acct.fromAddress, 'label', email)
|
||||||
self.config.set(self.acct.fromAddress, 'gateway', 'mailchuck')
|
self.config.set(self.acct.fromAddress, 'gateway', 'mailchuck')
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from PyQt4 import QtGui
|
from qtpy import QtGui, QtWidgets
|
||||||
from Queue import Empty
|
from Queue import Empty
|
||||||
|
|
||||||
from addresses import decodeAddress, addBMIfNotPresent
|
from addresses import decodeAddress, addBMIfNotPresent
|
||||||
|
@ -7,8 +7,14 @@ from queues import apiAddressGeneratorReturnQueue, addressGeneratorQueue
|
||||||
from tr import _translate
|
from tr import _translate
|
||||||
from utils import str_chan
|
from utils import str_chan
|
||||||
|
|
||||||
|
from debug import logger
|
||||||
|
|
||||||
|
|
||||||
class AddressPassPhraseValidatorMixin():
|
class AddressPassPhraseValidatorMixin():
|
||||||
def setParams(self, passPhraseObject=None, addressObject=None, feedBackObject=None, buttonBox=None, addressMandatory=True):
|
def setParams(
|
||||||
|
self, passPhraseObject=None, addressObject=None,
|
||||||
|
feedBackObject=None, buttonBox=None, addressMandatory=True
|
||||||
|
):
|
||||||
self.addressObject = addressObject
|
self.addressObject = addressObject
|
||||||
self.passPhraseObject = passPhraseObject
|
self.passPhraseObject = passPhraseObject
|
||||||
self.feedBackObject = feedBackObject
|
self.feedBackObject = feedBackObject
|
||||||
|
@ -16,7 +22,8 @@ class AddressPassPhraseValidatorMixin():
|
||||||
self.addressMandatory = addressMandatory
|
self.addressMandatory = addressMandatory
|
||||||
self.isValid = False
|
self.isValid = False
|
||||||
# save default text
|
# save default text
|
||||||
self.okButtonLabel = self.buttonBox.button(QtGui.QDialogButtonBox.Ok).text()
|
self.okButton = self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok)
|
||||||
|
self.okButtonLabel = self.okButton.text()
|
||||||
|
|
||||||
def setError(self, string):
|
def setError(self, string):
|
||||||
if string is not None and self.feedBackObject is not None:
|
if string is not None and self.feedBackObject is not None:
|
||||||
|
@ -27,11 +34,13 @@ class AddressPassPhraseValidatorMixin():
|
||||||
self.feedBackObject.setText(string)
|
self.feedBackObject.setText(string)
|
||||||
self.isValid = False
|
self.isValid = False
|
||||||
if self.buttonBox:
|
if self.buttonBox:
|
||||||
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)
|
self.okButton.setEnabled(False)
|
||||||
if string is not None and self.feedBackObject is not None:
|
if string is not None and self.feedBackObject is not None:
|
||||||
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(_translate("AddressValidator", "Invalid"))
|
self.okButton.setText(
|
||||||
|
_translate("AddressValidator", "Invalid"))
|
||||||
else:
|
else:
|
||||||
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(_translate("AddressValidator", "Validating..."))
|
self.okButton.setText(
|
||||||
|
_translate("AddressValidator", "Validating..."))
|
||||||
|
|
||||||
def setOK(self, string):
|
def setOK(self, string):
|
||||||
if string is not None and self.feedBackObject is not None:
|
if string is not None and self.feedBackObject is not None:
|
||||||
|
@ -42,8 +51,8 @@ class AddressPassPhraseValidatorMixin():
|
||||||
self.feedBackObject.setText(string)
|
self.feedBackObject.setText(string)
|
||||||
self.isValid = True
|
self.isValid = True
|
||||||
if self.buttonBox:
|
if self.buttonBox:
|
||||||
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
|
self.okButton.setEnabled(True)
|
||||||
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(self.okButtonLabel)
|
self.okButton.setText(self.okButtonLabel)
|
||||||
|
|
||||||
def checkQueue(self):
|
def checkQueue(self):
|
||||||
gotOne = False
|
gotOne = False
|
||||||
|
@ -55,7 +64,8 @@ class AddressPassPhraseValidatorMixin():
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(False)
|
addressGeneratorReturnValue = \
|
||||||
|
apiAddressGeneratorReturnQueue.get(False)
|
||||||
except Empty:
|
except Empty:
|
||||||
if gotOne:
|
if gotOne:
|
||||||
break
|
break
|
||||||
|
@ -65,80 +75,132 @@ class AddressPassPhraseValidatorMixin():
|
||||||
gotOne = True
|
gotOne = True
|
||||||
|
|
||||||
if len(addressGeneratorReturnValue) == 0:
|
if len(addressGeneratorReturnValue) == 0:
|
||||||
self.setError(_translate("AddressValidator", "Address already present as one of your identities."))
|
self.setError(
|
||||||
|
_translate(
|
||||||
|
"AddressValidator",
|
||||||
|
"Address already present as one of your identities."
|
||||||
|
))
|
||||||
return (QtGui.QValidator.Intermediate, 0)
|
return (QtGui.QValidator.Intermediate, 0)
|
||||||
if addressGeneratorReturnValue[0] == 'chan name does not match address':
|
if addressGeneratorReturnValue[0] == \
|
||||||
self.setError(_translate("AddressValidator", "Although the Bitmessage address you entered was valid, it doesn\'t match the chan name."))
|
'chan name does not match address':
|
||||||
|
self.setError(
|
||||||
|
_translate(
|
||||||
|
"AddressValidator",
|
||||||
|
"Although the Bitmessage address you entered was"
|
||||||
|
" valid, it doesn\'t match the chan name."
|
||||||
|
))
|
||||||
return (QtGui.QValidator.Intermediate, 0)
|
return (QtGui.QValidator.Intermediate, 0)
|
||||||
self.setOK(_translate("MainWindow", "Passphrase and address appear to be valid."))
|
self.setOK(
|
||||||
|
_translate(
|
||||||
|
"MainWindow", "Passphrase and address appear to be valid."))
|
||||||
|
|
||||||
def returnValid(self):
|
def returnValid(self):
|
||||||
if self.isValid:
|
return QtGui.QValidator.Acceptable if self.isValid \
|
||||||
return QtGui.QValidator.Acceptable
|
else QtGui.QValidator.Intermediate
|
||||||
else:
|
|
||||||
return QtGui.QValidator.Intermediate
|
|
||||||
|
|
||||||
def validate(self, s, pos):
|
def validate(self, s, pos):
|
||||||
if self.addressObject is None:
|
if self.addressObject is None:
|
||||||
address = None
|
address = None
|
||||||
else:
|
else:
|
||||||
address = str(self.addressObject.text().toUtf8())
|
address = self.addressObject.text().encode('utf-8')
|
||||||
if address == "":
|
if address == "":
|
||||||
address = None
|
address = None
|
||||||
if self.passPhraseObject is None:
|
if self.passPhraseObject is None:
|
||||||
passPhrase = ""
|
passPhrase = ""
|
||||||
else:
|
else:
|
||||||
passPhrase = str(self.passPhraseObject.text().toUtf8())
|
passPhrase = self.passPhraseObject.text().encode('utf-8')
|
||||||
if passPhrase == "":
|
if passPhrase == "":
|
||||||
passPhrase = None
|
passPhrase = None
|
||||||
|
|
||||||
# no chan name
|
# no chan name
|
||||||
if passPhrase is None:
|
if passPhrase is None:
|
||||||
self.setError(_translate("AddressValidator", "Chan name/passphrase needed. You didn't enter a chan name."))
|
self.setError(
|
||||||
|
_translate(
|
||||||
|
"AddressValidator",
|
||||||
|
"Chan name/passphrase needed."
|
||||||
|
" You didn't enter a chan name."
|
||||||
|
))
|
||||||
return (QtGui.QValidator.Intermediate, pos)
|
return (QtGui.QValidator.Intermediate, pos)
|
||||||
|
|
||||||
if self.addressMandatory or address is not None:
|
if self.addressMandatory or address is not None:
|
||||||
# check if address already exists:
|
# check if address already exists:
|
||||||
if address in getSortedAccounts():
|
if address in getSortedAccounts():
|
||||||
self.setError(_translate("AddressValidator", "Address already present as one of your identities."))
|
self.setError(
|
||||||
|
_translate(
|
||||||
|
"AddressValidator",
|
||||||
|
"Address already present as one of your identities."
|
||||||
|
))
|
||||||
return (QtGui.QValidator.Intermediate, pos)
|
return (QtGui.QValidator.Intermediate, pos)
|
||||||
|
|
||||||
# version too high
|
# version too high
|
||||||
if decodeAddress(address)[0] == 'versiontoohigh':
|
if decodeAddress(address)[0] == 'versiontoohigh':
|
||||||
self.setError(_translate("AddressValidator", "Address too new. Although that Bitmessage address might be valid, its version number is too new for us to handle. Perhaps you need to upgrade Bitmessage."))
|
self.setError(
|
||||||
|
_translate(
|
||||||
|
"AddressValidator",
|
||||||
|
"Address too new. Although that Bitmessage address"
|
||||||
|
" might be valid, its version number is too new"
|
||||||
|
" for us to handle. Perhaps you need to upgrade"
|
||||||
|
" Bitmessage."
|
||||||
|
))
|
||||||
return (QtGui.QValidator.Intermediate, pos)
|
return (QtGui.QValidator.Intermediate, pos)
|
||||||
|
|
||||||
# invalid
|
# invalid
|
||||||
if decodeAddress(address)[0] != 'success':
|
if decodeAddress(address)[0] != 'success':
|
||||||
self.setError(_translate("AddressValidator", "The Bitmessage address is not valid."))
|
self.setError(
|
||||||
|
_translate(
|
||||||
|
"AddressValidator",
|
||||||
|
"The Bitmessage address is not valid."
|
||||||
|
))
|
||||||
return (QtGui.QValidator.Intermediate, pos)
|
return (QtGui.QValidator.Intermediate, pos)
|
||||||
|
|
||||||
# this just disables the OK button without changing the feedback text
|
# this just disables the OK button without changing the feedback text
|
||||||
# but only if triggered by textEdited, not by clicking the Ok button
|
# but only if triggered by textEdited, not by clicking the Ok button
|
||||||
if not self.buttonBox.button(QtGui.QDialogButtonBox.Ok).hasFocus():
|
if not self.okButton.hasFocus():
|
||||||
self.setError(None)
|
self.setError(None)
|
||||||
|
|
||||||
# check through generator
|
# check through generator
|
||||||
if address is None:
|
if address is None:
|
||||||
addressGeneratorQueue.put(('createChan', 4, 1, str_chan + ' ' + str(passPhrase), passPhrase, False))
|
addressGeneratorQueue.put((
|
||||||
|
'createChan', 4, 1, ' '.join([str_chan, passPhrase]),
|
||||||
|
passPhrase, False
|
||||||
|
))
|
||||||
else:
|
else:
|
||||||
addressGeneratorQueue.put(('joinChan', addBMIfNotPresent(address), str_chan + ' ' + str(passPhrase), passPhrase, False))
|
addressGeneratorQueue.put((
|
||||||
|
'joinChan', addBMIfNotPresent(address),
|
||||||
|
' '.join([str_chan, passPhrase]), passPhrase, False
|
||||||
|
))
|
||||||
|
|
||||||
if self.buttonBox.button(QtGui.QDialogButtonBox.Ok).hasFocus():
|
if self.okButton.hasFocus():
|
||||||
return (self.returnValid(), pos)
|
return (self.returnValid(), pos)
|
||||||
else:
|
else:
|
||||||
return (QtGui.QValidator.Intermediate, pos)
|
return (QtGui.QValidator.Intermediate, pos)
|
||||||
|
|
||||||
def checkData(self):
|
def checkData(self):
|
||||||
return self.validate("", 0)
|
try:
|
||||||
|
return self.validate("", 0)
|
||||||
|
except Exception:
|
||||||
|
logger.warning("Exception in validate():", exc_info=True)
|
||||||
|
|
||||||
|
|
||||||
class AddressValidator(QtGui.QValidator, AddressPassPhraseValidatorMixin):
|
class AddressValidator(QtGui.QValidator, AddressPassPhraseValidatorMixin):
|
||||||
def __init__(self, parent=None, passPhraseObject=None, feedBackObject=None, buttonBox=None, addressMandatory=True):
|
def __init__(
|
||||||
|
self, parent=None, passPhraseObject=None, feedBackObject=None,
|
||||||
|
buttonBox=None, addressMandatory=True
|
||||||
|
):
|
||||||
super(AddressValidator, self).__init__(parent)
|
super(AddressValidator, self).__init__(parent)
|
||||||
self.setParams(passPhraseObject, parent, feedBackObject, buttonBox, addressMandatory)
|
self.setParams(
|
||||||
|
passPhraseObject, parent, feedBackObject, buttonBox,
|
||||||
|
addressMandatory
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class PassPhraseValidator(QtGui.QValidator, AddressPassPhraseValidatorMixin):
|
class PassPhraseValidator(QtGui.QValidator, AddressPassPhraseValidatorMixin):
|
||||||
def __init__(self, parent=None, addressObject=None, feedBackObject=None, buttonBox=None, addressMandatory=False):
|
def __init__(
|
||||||
|
self, parent=None, addressObject=None, feedBackObject=None,
|
||||||
|
buttonBox=None, addressMandatory=False
|
||||||
|
):
|
||||||
super(PassPhraseValidator, self).__init__(parent)
|
super(PassPhraseValidator, self).__init__(parent)
|
||||||
self.setParams(parent, addressObject, feedBackObject, buttonBox, addressMandatory)
|
self.setParams(
|
||||||
|
parent, addressObject, feedBackObject, buttonBox,
|
||||||
|
addressMandatory
|
||||||
|
)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
from PyQt4 import QtCore
|
from qtpy import QtCore
|
||||||
|
|
||||||
qt_resource_data = "\
|
qt_resource_data = "\
|
||||||
\x00\x00\x03\x66\
|
\x00\x00\x03\x66\
|
||||||
|
@ -1666,10 +1666,15 @@ qt_resource_struct = "\
|
||||||
\x00\x00\x01\xe6\x00\x00\x00\x00\x00\x01\x00\x00\x34\xdf\
|
\x00\x00\x01\xe6\x00\x00\x00\x00\x00\x01\x00\x00\x34\xdf\
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
def qInitResources():
|
def qInitResources():
|
||||||
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
QtCore.qRegisterResourceData(
|
||||||
|
0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||||
|
|
||||||
|
|
||||||
def qCleanupResources():
|
def qCleanupResources():
|
||||||
QtCore.qUnregisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
QtCore.qUnregisterResourceData(
|
||||||
|
0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||||
|
|
||||||
|
|
||||||
qInitResources()
|
qInitResources()
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
from qtpy import QtCore, QtGui, QtWidgets
|
||||||
|
from tr import _translate
|
||||||
# Form implementation generated from reading ui file 'bitmessageui.ui'
|
|
||||||
#
|
|
||||||
# Created: Mon Mar 23 22:18:07 2015
|
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
|
||||||
#
|
|
||||||
# WARNING! All changes made in this file will be lost!
|
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from foldertree import AddressBookCompleter
|
from foldertree import AddressBookCompleter
|
||||||
from messageview import MessageView
|
from messageview import MessageView
|
||||||
|
@ -16,40 +8,23 @@ import settingsmixin
|
||||||
from networkstatus import NetworkStatus
|
from networkstatus import NetworkStatus
|
||||||
from blacklist import Blacklist
|
from blacklist import Blacklist
|
||||||
|
|
||||||
try:
|
import bitmessage_icons_rc
|
||||||
_fromUtf8 = QtCore.QString.fromUtf8
|
|
||||||
except AttributeError:
|
|
||||||
def _fromUtf8(s):
|
|
||||||
return s
|
|
||||||
|
|
||||||
try:
|
|
||||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
|
||||||
def _translate(context, text, disambig, encoding = QtCore.QCoreApplication.CodecForTr, n = None):
|
|
||||||
if n is None:
|
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
|
||||||
else:
|
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding, n)
|
|
||||||
except AttributeError:
|
|
||||||
def _translate(context, text, disambig, encoding = QtCore.QCoreApplication.CodecForTr, n = None):
|
|
||||||
if n is None:
|
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
|
||||||
else:
|
|
||||||
return QtGui.QApplication.translate(context, text, disambig, QtCore.QCoreApplication.CodecForTr, n)
|
|
||||||
|
|
||||||
class Ui_MainWindow(object):
|
class Ui_MainWindow(object):
|
||||||
def setupUi(self, MainWindow):
|
def setupUi(self, MainWindow):
|
||||||
MainWindow.setObjectName(_fromUtf8("MainWindow"))
|
MainWindow.setObjectName("MainWindow")
|
||||||
MainWindow.resize(885, 580)
|
MainWindow.resize(885, 580)
|
||||||
icon = QtGui.QIcon()
|
icon = QtGui.QIcon()
|
||||||
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/can-icon-24px.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
icon.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-24px.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
MainWindow.setWindowIcon(icon)
|
MainWindow.setWindowIcon(icon)
|
||||||
MainWindow.setTabShape(QtGui.QTabWidget.Rounded)
|
MainWindow.setTabShape(QtWidgets.QTabWidget.Rounded)
|
||||||
self.centralwidget = QtGui.QWidget(MainWindow)
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
self.gridLayout_10 = QtGui.QGridLayout(self.centralwidget)
|
self.gridLayout_10 = QtWidgets.QGridLayout(self.centralwidget)
|
||||||
self.gridLayout_10.setObjectName(_fromUtf8("gridLayout_10"))
|
self.gridLayout_10.setObjectName("gridLayout_10")
|
||||||
self.tabWidget = QtGui.QTabWidget(self.centralwidget)
|
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth())
|
||||||
|
@ -59,27 +34,27 @@ class Ui_MainWindow(object):
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setPointSize(9)
|
font.setPointSize(9)
|
||||||
self.tabWidget.setFont(font)
|
self.tabWidget.setFont(font)
|
||||||
self.tabWidget.setTabPosition(QtGui.QTabWidget.North)
|
self.tabWidget.setTabPosition(QtWidgets.QTabWidget.North)
|
||||||
self.tabWidget.setTabShape(QtGui.QTabWidget.Rounded)
|
self.tabWidget.setTabShape(QtWidgets.QTabWidget.Rounded)
|
||||||
self.tabWidget.setObjectName(_fromUtf8("tabWidget"))
|
self.tabWidget.setObjectName("tabWidget")
|
||||||
self.inbox = QtGui.QWidget()
|
self.inbox = QtWidgets.QWidget()
|
||||||
self.inbox.setObjectName(_fromUtf8("inbox"))
|
self.inbox.setObjectName("inbox")
|
||||||
self.gridLayout = QtGui.QGridLayout(self.inbox)
|
self.gridLayout = QtWidgets.QGridLayout(self.inbox)
|
||||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
self.horizontalSplitter_3 = settingsmixin.SSplitter()
|
self.horizontalSplitter_3 = settingsmixin.SSplitter()
|
||||||
self.horizontalSplitter_3.setObjectName(_fromUtf8("horizontalSplitter_3"))
|
self.horizontalSplitter_3.setObjectName("horizontalSplitter_3")
|
||||||
self.verticalSplitter_12 = settingsmixin.SSplitter()
|
self.verticalSplitter_12 = settingsmixin.SSplitter()
|
||||||
self.verticalSplitter_12.setObjectName(_fromUtf8("verticalSplitter_12"))
|
self.verticalSplitter_12.setObjectName("verticalSplitter_12")
|
||||||
self.verticalSplitter_12.setOrientation(QtCore.Qt.Vertical)
|
self.verticalSplitter_12.setOrientation(QtCore.Qt.Vertical)
|
||||||
self.treeWidgetYourIdentities = settingsmixin.STreeWidget(self.inbox)
|
self.treeWidgetYourIdentities = settingsmixin.STreeWidget(self.inbox)
|
||||||
self.treeWidgetYourIdentities.setObjectName(_fromUtf8("treeWidgetYourIdentities"))
|
self.treeWidgetYourIdentities.setObjectName("treeWidgetYourIdentities")
|
||||||
self.treeWidgetYourIdentities.resize(200, self.treeWidgetYourIdentities.height())
|
self.treeWidgetYourIdentities.resize(200, self.treeWidgetYourIdentities.height())
|
||||||
icon1 = QtGui.QIcon()
|
icon1 = QtGui.QIcon()
|
||||||
icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/identities.png")), QtGui.QIcon.Selected, QtGui.QIcon.Off)
|
icon1.addPixmap(QtGui.QPixmap(":/newPrefix/images/identities.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
|
||||||
self.treeWidgetYourIdentities.headerItem().setIcon(0, icon1)
|
self.treeWidgetYourIdentities.headerItem().setIcon(0, icon1)
|
||||||
self.verticalSplitter_12.addWidget(self.treeWidgetYourIdentities)
|
self.verticalSplitter_12.addWidget(self.treeWidgetYourIdentities)
|
||||||
self.pushButtonNewAddress = QtGui.QPushButton(self.inbox)
|
self.pushButtonNewAddress = QtWidgets.QPushButton(self.inbox)
|
||||||
self.pushButtonNewAddress.setObjectName(_fromUtf8("pushButtonNewAddress"))
|
self.pushButtonNewAddress.setObjectName("pushButtonNewAddress")
|
||||||
self.pushButtonNewAddress.resize(200, self.pushButtonNewAddress.height())
|
self.pushButtonNewAddress.resize(200, self.pushButtonNewAddress.height())
|
||||||
self.verticalSplitter_12.addWidget(self.pushButtonNewAddress)
|
self.verticalSplitter_12.addWidget(self.pushButtonNewAddress)
|
||||||
self.verticalSplitter_12.setStretchFactor(0, 1)
|
self.verticalSplitter_12.setStretchFactor(0, 1)
|
||||||
|
@ -89,42 +64,42 @@ class Ui_MainWindow(object):
|
||||||
self.verticalSplitter_12.handle(1).setEnabled(False)
|
self.verticalSplitter_12.handle(1).setEnabled(False)
|
||||||
self.horizontalSplitter_3.addWidget(self.verticalSplitter_12)
|
self.horizontalSplitter_3.addWidget(self.verticalSplitter_12)
|
||||||
self.verticalSplitter_7 = settingsmixin.SSplitter()
|
self.verticalSplitter_7 = settingsmixin.SSplitter()
|
||||||
self.verticalSplitter_7.setObjectName(_fromUtf8("verticalSplitter_7"))
|
self.verticalSplitter_7.setObjectName("verticalSplitter_7")
|
||||||
self.verticalSplitter_7.setOrientation(QtCore.Qt.Vertical)
|
self.verticalSplitter_7.setOrientation(QtCore.Qt.Vertical)
|
||||||
self.horizontalSplitterSearch = QtGui.QSplitter()
|
self.horizontalSplitterSearch = QtWidgets.QSplitter()
|
||||||
self.horizontalSplitterSearch.setObjectName(_fromUtf8("horizontalSplitterSearch"))
|
self.horizontalSplitterSearch.setObjectName("horizontalSplitterSearch")
|
||||||
self.inboxSearchLineEdit = QtGui.QLineEdit(self.inbox)
|
self.inboxSearchLineEdit = QtWidgets.QLineEdit(self.inbox)
|
||||||
self.inboxSearchLineEdit.setObjectName(_fromUtf8("inboxSearchLineEdit"))
|
self.inboxSearchLineEdit.setObjectName("inboxSearchLineEdit")
|
||||||
self.horizontalSplitterSearch.addWidget(self.inboxSearchLineEdit)
|
self.horizontalSplitterSearch.addWidget(self.inboxSearchLineEdit)
|
||||||
self.inboxSearchOption = QtGui.QComboBox(self.inbox)
|
self.inboxSearchOption = QtWidgets.QComboBox(self.inbox)
|
||||||
self.inboxSearchOption.setObjectName(_fromUtf8("inboxSearchOption"))
|
self.inboxSearchOption.setObjectName("inboxSearchOption")
|
||||||
self.inboxSearchOption.addItem(_fromUtf8(""))
|
self.inboxSearchOption.addItem("")
|
||||||
self.inboxSearchOption.addItem(_fromUtf8(""))
|
self.inboxSearchOption.addItem("")
|
||||||
self.inboxSearchOption.addItem(_fromUtf8(""))
|
self.inboxSearchOption.addItem("")
|
||||||
self.inboxSearchOption.addItem(_fromUtf8(""))
|
self.inboxSearchOption.addItem("")
|
||||||
self.inboxSearchOption.addItem(_fromUtf8(""))
|
self.inboxSearchOption.addItem("")
|
||||||
self.inboxSearchOption.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
self.inboxSearchOption.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||||
self.horizontalSplitterSearch.addWidget(self.inboxSearchOption)
|
self.horizontalSplitterSearch.addWidget(self.inboxSearchOption)
|
||||||
self.horizontalSplitterSearch.handle(1).setEnabled(False)
|
self.horizontalSplitterSearch.handle(1).setEnabled(False)
|
||||||
self.horizontalSplitterSearch.setStretchFactor(0, 1)
|
self.horizontalSplitterSearch.setStretchFactor(0, 1)
|
||||||
self.horizontalSplitterSearch.setStretchFactor(1, 0)
|
self.horizontalSplitterSearch.setStretchFactor(1, 0)
|
||||||
self.verticalSplitter_7.addWidget(self.horizontalSplitterSearch)
|
self.verticalSplitter_7.addWidget(self.horizontalSplitterSearch)
|
||||||
self.tableWidgetInbox = settingsmixin.STableWidget(self.inbox)
|
self.tableWidgetInbox = settingsmixin.STableWidget(self.inbox)
|
||||||
self.tableWidgetInbox.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
|
self.tableWidgetInbox.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
self.tableWidgetInbox.setAlternatingRowColors(True)
|
self.tableWidgetInbox.setAlternatingRowColors(True)
|
||||||
self.tableWidgetInbox.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
self.tableWidgetInbox.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
self.tableWidgetInbox.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
self.tableWidgetInbox.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
self.tableWidgetInbox.setWordWrap(False)
|
self.tableWidgetInbox.setWordWrap(False)
|
||||||
self.tableWidgetInbox.setObjectName(_fromUtf8("tableWidgetInbox"))
|
self.tableWidgetInbox.setObjectName("tableWidgetInbox")
|
||||||
self.tableWidgetInbox.setColumnCount(4)
|
self.tableWidgetInbox.setColumnCount(4)
|
||||||
self.tableWidgetInbox.setRowCount(0)
|
self.tableWidgetInbox.setRowCount(0)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInbox.setHorizontalHeaderItem(0, item)
|
self.tableWidgetInbox.setHorizontalHeaderItem(0, item)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInbox.setHorizontalHeaderItem(1, item)
|
self.tableWidgetInbox.setHorizontalHeaderItem(1, item)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInbox.setHorizontalHeaderItem(2, item)
|
self.tableWidgetInbox.setHorizontalHeaderItem(2, item)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInbox.setHorizontalHeaderItem(3, item)
|
self.tableWidgetInbox.setHorizontalHeaderItem(3, item)
|
||||||
self.tableWidgetInbox.horizontalHeader().setCascadingSectionResizes(True)
|
self.tableWidgetInbox.horizontalHeader().setCascadingSectionResizes(True)
|
||||||
self.tableWidgetInbox.horizontalHeader().setDefaultSectionSize(200)
|
self.tableWidgetInbox.horizontalHeader().setDefaultSectionSize(200)
|
||||||
|
@ -138,7 +113,7 @@ class Ui_MainWindow(object):
|
||||||
self.textEditInboxMessage = MessageView(self.inbox)
|
self.textEditInboxMessage = MessageView(self.inbox)
|
||||||
self.textEditInboxMessage.setBaseSize(QtCore.QSize(0, 500))
|
self.textEditInboxMessage.setBaseSize(QtCore.QSize(0, 500))
|
||||||
self.textEditInboxMessage.setReadOnly(True)
|
self.textEditInboxMessage.setReadOnly(True)
|
||||||
self.textEditInboxMessage.setObjectName(_fromUtf8("textEditInboxMessage"))
|
self.textEditInboxMessage.setObjectName("textEditInboxMessage")
|
||||||
self.verticalSplitter_7.addWidget(self.textEditInboxMessage)
|
self.verticalSplitter_7.addWidget(self.textEditInboxMessage)
|
||||||
self.verticalSplitter_7.setStretchFactor(0, 0)
|
self.verticalSplitter_7.setStretchFactor(0, 0)
|
||||||
self.verticalSplitter_7.setStretchFactor(1, 1)
|
self.verticalSplitter_7.setStretchFactor(1, 1)
|
||||||
|
@ -154,31 +129,31 @@ class Ui_MainWindow(object):
|
||||||
self.horizontalSplitter_3.setCollapsible(1, False)
|
self.horizontalSplitter_3.setCollapsible(1, False)
|
||||||
self.gridLayout.addWidget(self.horizontalSplitter_3)
|
self.gridLayout.addWidget(self.horizontalSplitter_3)
|
||||||
icon2 = QtGui.QIcon()
|
icon2 = QtGui.QIcon()
|
||||||
icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/inbox.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
icon2.addPixmap(QtGui.QPixmap(":/newPrefix/images/inbox.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
self.tabWidget.addTab(self.inbox, icon2, _fromUtf8(""))
|
self.tabWidget.addTab(self.inbox, icon2, "")
|
||||||
self.send = QtGui.QWidget()
|
self.send = QtWidgets.QWidget()
|
||||||
self.send.setObjectName(_fromUtf8("send"))
|
self.send.setObjectName("send")
|
||||||
self.gridLayout_7 = QtGui.QGridLayout(self.send)
|
self.gridLayout_7 = QtWidgets.QGridLayout(self.send)
|
||||||
self.gridLayout_7.setObjectName(_fromUtf8("gridLayout_7"))
|
self.gridLayout_7.setObjectName("gridLayout_7")
|
||||||
self.horizontalSplitter = settingsmixin.SSplitter()
|
self.horizontalSplitter = settingsmixin.SSplitter()
|
||||||
self.horizontalSplitter.setObjectName(_fromUtf8("horizontalSplitter"))
|
self.horizontalSplitter.setObjectName("horizontalSplitter")
|
||||||
self.verticalSplitter_2 = settingsmixin.SSplitter()
|
self.verticalSplitter_2 = settingsmixin.SSplitter()
|
||||||
self.verticalSplitter_2.setObjectName(_fromUtf8("verticalSplitter_2"))
|
self.verticalSplitter_2.setObjectName("verticalSplitter_2")
|
||||||
self.verticalSplitter_2.setOrientation(QtCore.Qt.Vertical)
|
self.verticalSplitter_2.setOrientation(QtCore.Qt.Vertical)
|
||||||
self.tableWidgetAddressBook = settingsmixin.STableWidget(self.send)
|
self.tableWidgetAddressBook = settingsmixin.STableWidget(self.send)
|
||||||
self.tableWidgetAddressBook.setAlternatingRowColors(True)
|
self.tableWidgetAddressBook.setAlternatingRowColors(True)
|
||||||
self.tableWidgetAddressBook.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
self.tableWidgetAddressBook.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
self.tableWidgetAddressBook.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
self.tableWidgetAddressBook.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
self.tableWidgetAddressBook.setObjectName(_fromUtf8("tableWidgetAddressBook"))
|
self.tableWidgetAddressBook.setObjectName("tableWidgetAddressBook")
|
||||||
self.tableWidgetAddressBook.setColumnCount(2)
|
self.tableWidgetAddressBook.setColumnCount(2)
|
||||||
self.tableWidgetAddressBook.setRowCount(0)
|
self.tableWidgetAddressBook.setRowCount(0)
|
||||||
self.tableWidgetAddressBook.resize(200, self.tableWidgetAddressBook.height())
|
self.tableWidgetAddressBook.resize(200, self.tableWidgetAddressBook.height())
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
icon3 = QtGui.QIcon()
|
icon3 = QtGui.QIcon()
|
||||||
icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/addressbook.png")), QtGui.QIcon.Selected, QtGui.QIcon.Off)
|
icon3.addPixmap(QtGui.QPixmap(":/newPrefix/images/addressbook.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
|
||||||
item.setIcon(icon3)
|
item.setIcon(icon3)
|
||||||
self.tableWidgetAddressBook.setHorizontalHeaderItem(0, item)
|
self.tableWidgetAddressBook.setHorizontalHeaderItem(0, item)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetAddressBook.setHorizontalHeaderItem(1, item)
|
self.tableWidgetAddressBook.setHorizontalHeaderItem(1, item)
|
||||||
self.tableWidgetAddressBook.horizontalHeader().setCascadingSectionResizes(True)
|
self.tableWidgetAddressBook.horizontalHeader().setCascadingSectionResizes(True)
|
||||||
self.tableWidgetAddressBook.horizontalHeader().setDefaultSectionSize(200)
|
self.tableWidgetAddressBook.horizontalHeader().setDefaultSectionSize(200)
|
||||||
|
@ -187,17 +162,17 @@ class Ui_MainWindow(object):
|
||||||
self.tableWidgetAddressBook.verticalHeader().setVisible(False)
|
self.tableWidgetAddressBook.verticalHeader().setVisible(False)
|
||||||
self.verticalSplitter_2.addWidget(self.tableWidgetAddressBook)
|
self.verticalSplitter_2.addWidget(self.tableWidgetAddressBook)
|
||||||
self.addressBookCompleter = AddressBookCompleter()
|
self.addressBookCompleter = AddressBookCompleter()
|
||||||
self.addressBookCompleter.setCompletionMode(QtGui.QCompleter.PopupCompletion)
|
self.addressBookCompleter.setCompletionMode(QtWidgets.QCompleter.PopupCompletion)
|
||||||
self.addressBookCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
|
self.addressBookCompleter.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
|
||||||
self.addressBookCompleterModel = QtGui.QStringListModel()
|
self.addressBookCompleterModel = QtCore.QStringListModel()
|
||||||
self.addressBookCompleter.setModel(self.addressBookCompleterModel)
|
self.addressBookCompleter.setModel(self.addressBookCompleterModel)
|
||||||
self.pushButtonAddAddressBook = QtGui.QPushButton(self.send)
|
self.pushButtonAddAddressBook = QtWidgets.QPushButton(self.send)
|
||||||
self.pushButtonAddAddressBook.setObjectName(_fromUtf8("pushButtonAddAddressBook"))
|
self.pushButtonAddAddressBook.setObjectName("pushButtonAddAddressBook")
|
||||||
self.pushButtonAddAddressBook.resize(200, self.pushButtonAddAddressBook.height())
|
self.pushButtonAddAddressBook.resize(200, self.pushButtonAddAddressBook.height())
|
||||||
self.verticalSplitter_2.addWidget(self.pushButtonAddAddressBook)
|
self.verticalSplitter_2.addWidget(self.pushButtonAddAddressBook)
|
||||||
self.pushButtonFetchNamecoinID = QtGui.QPushButton(self.send)
|
self.pushButtonFetchNamecoinID = QtWidgets.QPushButton(self.send)
|
||||||
self.pushButtonFetchNamecoinID.resize(200, self.pushButtonFetchNamecoinID.height())
|
self.pushButtonFetchNamecoinID.resize(200, self.pushButtonFetchNamecoinID.height())
|
||||||
self.pushButtonFetchNamecoinID.setObjectName(_fromUtf8("pushButtonFetchNamecoinID"))
|
self.pushButtonFetchNamecoinID.setObjectName("pushButtonFetchNamecoinID")
|
||||||
self.verticalSplitter_2.addWidget(self.pushButtonFetchNamecoinID)
|
self.verticalSplitter_2.addWidget(self.pushButtonFetchNamecoinID)
|
||||||
self.verticalSplitter_2.setStretchFactor(0, 1)
|
self.verticalSplitter_2.setStretchFactor(0, 1)
|
||||||
self.verticalSplitter_2.setStretchFactor(1, 0)
|
self.verticalSplitter_2.setStretchFactor(1, 0)
|
||||||
|
@ -209,45 +184,45 @@ class Ui_MainWindow(object):
|
||||||
self.verticalSplitter_2.handle(2).setEnabled(False)
|
self.verticalSplitter_2.handle(2).setEnabled(False)
|
||||||
self.horizontalSplitter.addWidget(self.verticalSplitter_2)
|
self.horizontalSplitter.addWidget(self.verticalSplitter_2)
|
||||||
self.verticalSplitter = settingsmixin.SSplitter()
|
self.verticalSplitter = settingsmixin.SSplitter()
|
||||||
self.verticalSplitter.setObjectName(_fromUtf8("verticalSplitter"))
|
self.verticalSplitter.setObjectName("verticalSplitter")
|
||||||
self.verticalSplitter.setOrientation(QtCore.Qt.Vertical)
|
self.verticalSplitter.setOrientation(QtCore.Qt.Vertical)
|
||||||
self.tabWidgetSend = QtGui.QTabWidget(self.send)
|
self.tabWidgetSend = QtWidgets.QTabWidget(self.send)
|
||||||
self.tabWidgetSend.setObjectName(_fromUtf8("tabWidgetSend"))
|
self.tabWidgetSend.setObjectName("tabWidgetSend")
|
||||||
self.sendDirect = QtGui.QWidget()
|
self.sendDirect = QtWidgets.QWidget()
|
||||||
self.sendDirect.setObjectName(_fromUtf8("sendDirect"))
|
self.sendDirect.setObjectName("sendDirect")
|
||||||
self.gridLayout_8 = QtGui.QGridLayout(self.sendDirect)
|
self.gridLayout_8 = QtWidgets.QGridLayout(self.sendDirect)
|
||||||
self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8"))
|
self.gridLayout_8.setObjectName("gridLayout_8")
|
||||||
self.verticalSplitter_5 = settingsmixin.SSplitter()
|
self.verticalSplitter_5 = settingsmixin.SSplitter()
|
||||||
self.verticalSplitter_5.setObjectName(_fromUtf8("verticalSplitter_5"))
|
self.verticalSplitter_5.setObjectName("verticalSplitter_5")
|
||||||
self.verticalSplitter_5.setOrientation(QtCore.Qt.Vertical)
|
self.verticalSplitter_5.setOrientation(QtCore.Qt.Vertical)
|
||||||
self.gridLayout_2 = QtGui.QGridLayout()
|
self.gridLayout_2 = QtWidgets.QGridLayout()
|
||||||
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
self.label_3 = QtGui.QLabel(self.sendDirect)
|
self.label_3 = QtWidgets.QLabel(self.sendDirect)
|
||||||
self.label_3.setObjectName(_fromUtf8("label_3"))
|
self.label_3.setObjectName("label_3")
|
||||||
self.gridLayout_2.addWidget(self.label_3, 2, 0, 1, 1)
|
self.gridLayout_2.addWidget(self.label_3, 2, 0, 1, 1)
|
||||||
self.label_2 = QtGui.QLabel(self.sendDirect)
|
self.label_2 = QtWidgets.QLabel(self.sendDirect)
|
||||||
self.label_2.setObjectName(_fromUtf8("label_2"))
|
self.label_2.setObjectName("label_2")
|
||||||
self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1)
|
self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1)
|
||||||
self.lineEditSubject = QtGui.QLineEdit(self.sendDirect)
|
self.lineEditSubject = QtWidgets.QLineEdit(self.sendDirect)
|
||||||
self.lineEditSubject.setText(_fromUtf8(""))
|
self.lineEditSubject.setText("")
|
||||||
self.lineEditSubject.setObjectName(_fromUtf8("lineEditSubject"))
|
self.lineEditSubject.setObjectName("lineEditSubject")
|
||||||
self.gridLayout_2.addWidget(self.lineEditSubject, 2, 1, 1, 1)
|
self.gridLayout_2.addWidget(self.lineEditSubject, 2, 1, 1, 1)
|
||||||
self.label = QtGui.QLabel(self.sendDirect)
|
self.label = QtWidgets.QLabel(self.sendDirect)
|
||||||
self.label.setObjectName(_fromUtf8("label"))
|
self.label.setObjectName("label")
|
||||||
self.gridLayout_2.addWidget(self.label, 1, 0, 1, 1)
|
self.gridLayout_2.addWidget(self.label, 1, 0, 1, 1)
|
||||||
self.comboBoxSendFrom = QtGui.QComboBox(self.sendDirect)
|
self.comboBoxSendFrom = QtWidgets.QComboBox(self.sendDirect)
|
||||||
self.comboBoxSendFrom.setMinimumSize(QtCore.QSize(300, 0))
|
self.comboBoxSendFrom.setMinimumSize(QtCore.QSize(300, 0))
|
||||||
self.comboBoxSendFrom.setObjectName(_fromUtf8("comboBoxSendFrom"))
|
self.comboBoxSendFrom.setObjectName("comboBoxSendFrom")
|
||||||
self.gridLayout_2.addWidget(self.comboBoxSendFrom, 0, 1, 1, 1)
|
self.gridLayout_2.addWidget(self.comboBoxSendFrom, 0, 1, 1, 1)
|
||||||
self.lineEditTo = QtGui.QLineEdit(self.sendDirect)
|
self.lineEditTo = QtWidgets.QLineEdit(self.sendDirect)
|
||||||
self.lineEditTo.setObjectName(_fromUtf8("lineEditTo"))
|
self.lineEditTo.setObjectName("lineEditTo")
|
||||||
self.gridLayout_2.addWidget(self.lineEditTo, 1, 1, 1, 1)
|
self.gridLayout_2.addWidget(self.lineEditTo, 1, 1, 1, 1)
|
||||||
self.lineEditTo.setCompleter(self.addressBookCompleter)
|
self.lineEditTo.setCompleter(self.addressBookCompleter)
|
||||||
self.gridLayout_2_Widget = QtGui.QWidget()
|
self.gridLayout_2_Widget = QtWidgets.QWidget()
|
||||||
self.gridLayout_2_Widget.setLayout(self.gridLayout_2)
|
self.gridLayout_2_Widget.setLayout(self.gridLayout_2)
|
||||||
self.verticalSplitter_5.addWidget(self.gridLayout_2_Widget)
|
self.verticalSplitter_5.addWidget(self.gridLayout_2_Widget)
|
||||||
self.textEditMessage = MessageCompose(self.sendDirect)
|
self.textEditMessage = MessageCompose(self.sendDirect)
|
||||||
self.textEditMessage.setObjectName(_fromUtf8("textEditMessage"))
|
self.textEditMessage.setObjectName("textEditMessage")
|
||||||
self.verticalSplitter_5.addWidget(self.textEditMessage)
|
self.verticalSplitter_5.addWidget(self.textEditMessage)
|
||||||
self.verticalSplitter_5.setStretchFactor(0, 0)
|
self.verticalSplitter_5.setStretchFactor(0, 0)
|
||||||
self.verticalSplitter_5.setStretchFactor(1, 1)
|
self.verticalSplitter_5.setStretchFactor(1, 1)
|
||||||
|
@ -255,35 +230,35 @@ class Ui_MainWindow(object):
|
||||||
self.verticalSplitter_5.setCollapsible(1, False)
|
self.verticalSplitter_5.setCollapsible(1, False)
|
||||||
self.verticalSplitter_5.handle(1).setEnabled(False)
|
self.verticalSplitter_5.handle(1).setEnabled(False)
|
||||||
self.gridLayout_8.addWidget(self.verticalSplitter_5, 0, 0, 1, 1)
|
self.gridLayout_8.addWidget(self.verticalSplitter_5, 0, 0, 1, 1)
|
||||||
self.tabWidgetSend.addTab(self.sendDirect, _fromUtf8(""))
|
self.tabWidgetSend.addTab(self.sendDirect, "")
|
||||||
self.sendBroadcast = QtGui.QWidget()
|
self.sendBroadcast = QtWidgets.QWidget()
|
||||||
self.sendBroadcast.setObjectName(_fromUtf8("sendBroadcast"))
|
self.sendBroadcast.setObjectName("sendBroadcast")
|
||||||
self.gridLayout_9 = QtGui.QGridLayout(self.sendBroadcast)
|
self.gridLayout_9 = QtWidgets.QGridLayout(self.sendBroadcast)
|
||||||
self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9"))
|
self.gridLayout_9.setObjectName("gridLayout_9")
|
||||||
self.verticalSplitter_6 = settingsmixin.SSplitter()
|
self.verticalSplitter_6 = settingsmixin.SSplitter()
|
||||||
self.verticalSplitter_6.setObjectName(_fromUtf8("verticalSplitter_6"))
|
self.verticalSplitter_6.setObjectName("verticalSplitter_6")
|
||||||
self.verticalSplitter_6.setOrientation(QtCore.Qt.Vertical)
|
self.verticalSplitter_6.setOrientation(QtCore.Qt.Vertical)
|
||||||
self.gridLayout_5 = QtGui.QGridLayout()
|
self.gridLayout_5 = QtWidgets.QGridLayout()
|
||||||
self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
|
self.gridLayout_5.setObjectName("gridLayout_5")
|
||||||
self.label_8 = QtGui.QLabel(self.sendBroadcast)
|
self.label_8 = QtWidgets.QLabel(self.sendBroadcast)
|
||||||
self.label_8.setObjectName(_fromUtf8("label_8"))
|
self.label_8.setObjectName("label_8")
|
||||||
self.gridLayout_5.addWidget(self.label_8, 0, 0, 1, 1)
|
self.gridLayout_5.addWidget(self.label_8, 0, 0, 1, 1)
|
||||||
self.lineEditSubjectBroadcast = QtGui.QLineEdit(self.sendBroadcast)
|
self.lineEditSubjectBroadcast = QtWidgets.QLineEdit(self.sendBroadcast)
|
||||||
self.lineEditSubjectBroadcast.setText(_fromUtf8(""))
|
self.lineEditSubjectBroadcast.setText("")
|
||||||
self.lineEditSubjectBroadcast.setObjectName(_fromUtf8("lineEditSubjectBroadcast"))
|
self.lineEditSubjectBroadcast.setObjectName("lineEditSubjectBroadcast")
|
||||||
self.gridLayout_5.addWidget(self.lineEditSubjectBroadcast, 1, 1, 1, 1)
|
self.gridLayout_5.addWidget(self.lineEditSubjectBroadcast, 1, 1, 1, 1)
|
||||||
self.label_7 = QtGui.QLabel(self.sendBroadcast)
|
self.label_7 = QtWidgets.QLabel(self.sendBroadcast)
|
||||||
self.label_7.setObjectName(_fromUtf8("label_7"))
|
self.label_7.setObjectName("label_7")
|
||||||
self.gridLayout_5.addWidget(self.label_7, 1, 0, 1, 1)
|
self.gridLayout_5.addWidget(self.label_7, 1, 0, 1, 1)
|
||||||
self.comboBoxSendFromBroadcast = QtGui.QComboBox(self.sendBroadcast)
|
self.comboBoxSendFromBroadcast = QtWidgets.QComboBox(self.sendBroadcast)
|
||||||
self.comboBoxSendFromBroadcast.setMinimumSize(QtCore.QSize(300, 0))
|
self.comboBoxSendFromBroadcast.setMinimumSize(QtCore.QSize(300, 0))
|
||||||
self.comboBoxSendFromBroadcast.setObjectName(_fromUtf8("comboBoxSendFromBroadcast"))
|
self.comboBoxSendFromBroadcast.setObjectName("comboBoxSendFromBroadcast")
|
||||||
self.gridLayout_5.addWidget(self.comboBoxSendFromBroadcast, 0, 1, 1, 1)
|
self.gridLayout_5.addWidget(self.comboBoxSendFromBroadcast, 0, 1, 1, 1)
|
||||||
self.gridLayout_5_Widget = QtGui.QWidget()
|
self.gridLayout_5_Widget = QtWidgets.QWidget()
|
||||||
self.gridLayout_5_Widget.setLayout(self.gridLayout_5)
|
self.gridLayout_5_Widget.setLayout(self.gridLayout_5)
|
||||||
self.verticalSplitter_6.addWidget(self.gridLayout_5_Widget)
|
self.verticalSplitter_6.addWidget(self.gridLayout_5_Widget)
|
||||||
self.textEditMessageBroadcast = MessageCompose(self.sendBroadcast)
|
self.textEditMessageBroadcast = MessageCompose(self.sendBroadcast)
|
||||||
self.textEditMessageBroadcast.setObjectName(_fromUtf8("textEditMessageBroadcast"))
|
self.textEditMessageBroadcast.setObjectName("textEditMessageBroadcast")
|
||||||
self.verticalSplitter_6.addWidget(self.textEditMessageBroadcast)
|
self.verticalSplitter_6.addWidget(self.textEditMessageBroadcast)
|
||||||
self.verticalSplitter_6.setStretchFactor(0, 0)
|
self.verticalSplitter_6.setStretchFactor(0, 0)
|
||||||
self.verticalSplitter_6.setStretchFactor(1, 1)
|
self.verticalSplitter_6.setStretchFactor(1, 1)
|
||||||
|
@ -291,15 +266,15 @@ class Ui_MainWindow(object):
|
||||||
self.verticalSplitter_6.setCollapsible(1, False)
|
self.verticalSplitter_6.setCollapsible(1, False)
|
||||||
self.verticalSplitter_6.handle(1).setEnabled(False)
|
self.verticalSplitter_6.handle(1).setEnabled(False)
|
||||||
self.gridLayout_9.addWidget(self.verticalSplitter_6, 0, 0, 1, 1)
|
self.gridLayout_9.addWidget(self.verticalSplitter_6, 0, 0, 1, 1)
|
||||||
self.tabWidgetSend.addTab(self.sendBroadcast, _fromUtf8(""))
|
self.tabWidgetSend.addTab(self.sendBroadcast, "")
|
||||||
self.verticalSplitter.addWidget(self.tabWidgetSend)
|
self.verticalSplitter.addWidget(self.tabWidgetSend)
|
||||||
self.tTLContainer = QtGui.QWidget()
|
self.tTLContainer = QtWidgets.QWidget()
|
||||||
self.tTLContainer.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
|
self.tTLContainer.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
self.horizontalLayout_5 = QtGui.QHBoxLayout()
|
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
|
||||||
self.tTLContainer.setLayout(self.horizontalLayout_5)
|
self.tTLContainer.setLayout(self.horizontalLayout_5)
|
||||||
self.horizontalLayout_5.setObjectName(_fromUtf8("horizontalLayout_5"))
|
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
|
||||||
self.pushButtonTTL = QtGui.QPushButton(self.send)
|
self.pushButtonTTL = QtWidgets.QPushButton(self.send)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.pushButtonTTL.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.pushButtonTTL.sizePolicy().hasHeightForWidth())
|
||||||
|
@ -319,29 +294,29 @@ class Ui_MainWindow(object):
|
||||||
font.setUnderline(True)
|
font.setUnderline(True)
|
||||||
self.pushButtonTTL.setFont(font)
|
self.pushButtonTTL.setFont(font)
|
||||||
self.pushButtonTTL.setFlat(True)
|
self.pushButtonTTL.setFlat(True)
|
||||||
self.pushButtonTTL.setObjectName(_fromUtf8("pushButtonTTL"))
|
self.pushButtonTTL.setObjectName("pushButtonTTL")
|
||||||
self.horizontalLayout_5.addWidget(self.pushButtonTTL, 0, QtCore.Qt.AlignRight)
|
self.horizontalLayout_5.addWidget(self.pushButtonTTL, 0, QtCore.Qt.AlignRight)
|
||||||
self.horizontalSliderTTL = QtGui.QSlider(self.send)
|
self.horizontalSliderTTL = QtWidgets.QSlider(self.send)
|
||||||
self.horizontalSliderTTL.setMinimumSize(QtCore.QSize(70, 0))
|
self.horizontalSliderTTL.setMinimumSize(QtCore.QSize(70, 0))
|
||||||
self.horizontalSliderTTL.setOrientation(QtCore.Qt.Horizontal)
|
self.horizontalSliderTTL.setOrientation(QtCore.Qt.Horizontal)
|
||||||
self.horizontalSliderTTL.setInvertedAppearance(False)
|
self.horizontalSliderTTL.setInvertedAppearance(False)
|
||||||
self.horizontalSliderTTL.setInvertedControls(False)
|
self.horizontalSliderTTL.setInvertedControls(False)
|
||||||
self.horizontalSliderTTL.setObjectName(_fromUtf8("horizontalSliderTTL"))
|
self.horizontalSliderTTL.setObjectName("horizontalSliderTTL")
|
||||||
self.horizontalLayout_5.addWidget(self.horizontalSliderTTL, 0, QtCore.Qt.AlignLeft)
|
self.horizontalLayout_5.addWidget(self.horizontalSliderTTL, 0, QtCore.Qt.AlignLeft)
|
||||||
self.labelHumanFriendlyTTLDescription = QtGui.QLabel(self.send)
|
self.labelHumanFriendlyTTLDescription = QtWidgets.QLabel(self.send)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.labelHumanFriendlyTTLDescription.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.labelHumanFriendlyTTLDescription.sizePolicy().hasHeightForWidth())
|
||||||
self.labelHumanFriendlyTTLDescription.setSizePolicy(sizePolicy)
|
self.labelHumanFriendlyTTLDescription.setSizePolicy(sizePolicy)
|
||||||
self.labelHumanFriendlyTTLDescription.setMinimumSize(QtCore.QSize(45, 0))
|
self.labelHumanFriendlyTTLDescription.setMinimumSize(QtCore.QSize(45, 0))
|
||||||
self.labelHumanFriendlyTTLDescription.setObjectName(_fromUtf8("labelHumanFriendlyTTLDescription"))
|
self.labelHumanFriendlyTTLDescription.setObjectName("labelHumanFriendlyTTLDescription")
|
||||||
self.horizontalLayout_5.addWidget(self.labelHumanFriendlyTTLDescription, 1, QtCore.Qt.AlignLeft)
|
self.horizontalLayout_5.addWidget(self.labelHumanFriendlyTTLDescription, 1, QtCore.Qt.AlignLeft)
|
||||||
self.pushButtonClear = QtGui.QPushButton(self.send)
|
self.pushButtonClear = QtWidgets.QPushButton(self.send)
|
||||||
self.pushButtonClear.setObjectName(_fromUtf8("pushButtonClear"))
|
self.pushButtonClear.setObjectName("pushButtonClear")
|
||||||
self.horizontalLayout_5.addWidget(self.pushButtonClear, 0, QtCore.Qt.AlignRight)
|
self.horizontalLayout_5.addWidget(self.pushButtonClear, 0, QtCore.Qt.AlignRight)
|
||||||
self.pushButtonSend = QtGui.QPushButton(self.send)
|
self.pushButtonSend = QtWidgets.QPushButton(self.send)
|
||||||
self.pushButtonSend.setObjectName(_fromUtf8("pushButtonSend"))
|
self.pushButtonSend.setObjectName("pushButtonSend")
|
||||||
self.horizontalLayout_5.addWidget(self.pushButtonSend, 0, QtCore.Qt.AlignRight)
|
self.horizontalLayout_5.addWidget(self.pushButtonSend, 0, QtCore.Qt.AlignRight)
|
||||||
self.horizontalSliderTTL.setMaximumSize(QtCore.QSize(105, self.pushButtonSend.height()))
|
self.horizontalSliderTTL.setMaximumSize(QtCore.QSize(105, self.pushButtonSend.height()))
|
||||||
self.verticalSplitter.addWidget(self.tTLContainer)
|
self.verticalSplitter.addWidget(self.tTLContainer)
|
||||||
|
@ -358,29 +333,29 @@ class Ui_MainWindow(object):
|
||||||
self.horizontalSplitter.setCollapsible(1, False)
|
self.horizontalSplitter.setCollapsible(1, False)
|
||||||
self.gridLayout_7.addWidget(self.horizontalSplitter, 0, 0, 1, 1)
|
self.gridLayout_7.addWidget(self.horizontalSplitter, 0, 0, 1, 1)
|
||||||
icon4 = QtGui.QIcon()
|
icon4 = QtGui.QIcon()
|
||||||
icon4.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/send.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
icon4.addPixmap(QtGui.QPixmap(":/newPrefix/images/send.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
self.tabWidget.addTab(self.send, icon4, _fromUtf8(""))
|
self.tabWidget.addTab(self.send, icon4, "")
|
||||||
self.subscriptions = QtGui.QWidget()
|
self.subscriptions = QtWidgets.QWidget()
|
||||||
self.subscriptions.setObjectName(_fromUtf8("subscriptions"))
|
self.subscriptions.setObjectName("subscriptions")
|
||||||
self.gridLayout_3 = QtGui.QGridLayout(self.subscriptions)
|
self.gridLayout_3 = QtWidgets.QGridLayout(self.subscriptions)
|
||||||
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
|
self.gridLayout_3.setObjectName("gridLayout_3")
|
||||||
self.horizontalSplitter_4 = settingsmixin.SSplitter()
|
self.horizontalSplitter_4 = settingsmixin.SSplitter()
|
||||||
self.horizontalSplitter_4.setObjectName(_fromUtf8("horizontalSplitter_4"))
|
self.horizontalSplitter_4.setObjectName("horizontalSplitter_4")
|
||||||
self.verticalSplitter_3 = settingsmixin.SSplitter()
|
self.verticalSplitter_3 = settingsmixin.SSplitter()
|
||||||
self.verticalSplitter_3.setObjectName(_fromUtf8("verticalSplitter_3"))
|
self.verticalSplitter_3.setObjectName("verticalSplitter_3")
|
||||||
self.verticalSplitter_3.setOrientation(QtCore.Qt.Vertical)
|
self.verticalSplitter_3.setOrientation(QtCore.Qt.Vertical)
|
||||||
self.treeWidgetSubscriptions = settingsmixin.STreeWidget(self.subscriptions)
|
self.treeWidgetSubscriptions = settingsmixin.STreeWidget(self.subscriptions)
|
||||||
self.treeWidgetSubscriptions.setAlternatingRowColors(True)
|
self.treeWidgetSubscriptions.setAlternatingRowColors(True)
|
||||||
self.treeWidgetSubscriptions.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
|
self.treeWidgetSubscriptions.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||||
self.treeWidgetSubscriptions.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
self.treeWidgetSubscriptions.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
self.treeWidgetSubscriptions.setObjectName(_fromUtf8("treeWidgetSubscriptions"))
|
self.treeWidgetSubscriptions.setObjectName("treeWidgetSubscriptions")
|
||||||
self.treeWidgetSubscriptions.resize(200, self.treeWidgetSubscriptions.height())
|
self.treeWidgetSubscriptions.resize(200, self.treeWidgetSubscriptions.height())
|
||||||
icon5 = QtGui.QIcon()
|
icon5 = QtGui.QIcon()
|
||||||
icon5.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/subscriptions.png")), QtGui.QIcon.Selected, QtGui.QIcon.Off)
|
icon5.addPixmap(QtGui.QPixmap(":/newPrefix/images/subscriptions.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
|
||||||
self.treeWidgetSubscriptions.headerItem().setIcon(0, icon5)
|
self.treeWidgetSubscriptions.headerItem().setIcon(0, icon5)
|
||||||
self.verticalSplitter_3.addWidget(self.treeWidgetSubscriptions)
|
self.verticalSplitter_3.addWidget(self.treeWidgetSubscriptions)
|
||||||
self.pushButtonAddSubscription = QtGui.QPushButton(self.subscriptions)
|
self.pushButtonAddSubscription = QtWidgets.QPushButton(self.subscriptions)
|
||||||
self.pushButtonAddSubscription.setObjectName(_fromUtf8("pushButtonAddSubscription"))
|
self.pushButtonAddSubscription.setObjectName("pushButtonAddSubscription")
|
||||||
self.pushButtonAddSubscription.resize(200, self.pushButtonAddSubscription.height())
|
self.pushButtonAddSubscription.resize(200, self.pushButtonAddSubscription.height())
|
||||||
self.verticalSplitter_3.addWidget(self.pushButtonAddSubscription)
|
self.verticalSplitter_3.addWidget(self.pushButtonAddSubscription)
|
||||||
self.verticalSplitter_3.setStretchFactor(0, 1)
|
self.verticalSplitter_3.setStretchFactor(0, 1)
|
||||||
|
@ -390,42 +365,42 @@ class Ui_MainWindow(object):
|
||||||
self.verticalSplitter_3.handle(1).setEnabled(False)
|
self.verticalSplitter_3.handle(1).setEnabled(False)
|
||||||
self.horizontalSplitter_4.addWidget(self.verticalSplitter_3)
|
self.horizontalSplitter_4.addWidget(self.verticalSplitter_3)
|
||||||
self.verticalSplitter_4 = settingsmixin.SSplitter()
|
self.verticalSplitter_4 = settingsmixin.SSplitter()
|
||||||
self.verticalSplitter_4.setObjectName(_fromUtf8("verticalSplitter_4"))
|
self.verticalSplitter_4.setObjectName("verticalSplitter_4")
|
||||||
self.verticalSplitter_4.setOrientation(QtCore.Qt.Vertical)
|
self.verticalSplitter_4.setOrientation(QtCore.Qt.Vertical)
|
||||||
self.horizontalSplitter_2 = QtGui.QSplitter()
|
self.horizontalSplitter_2 = QtWidgets.QSplitter()
|
||||||
self.horizontalSplitter_2.setObjectName(_fromUtf8("horizontalSplitter_2"))
|
self.horizontalSplitter_2.setObjectName("horizontalSplitter_2")
|
||||||
self.inboxSearchLineEditSubscriptions = QtGui.QLineEdit(self.subscriptions)
|
self.inboxSearchLineEditSubscriptions = QtWidgets.QLineEdit(self.subscriptions)
|
||||||
self.inboxSearchLineEditSubscriptions.setObjectName(_fromUtf8("inboxSearchLineEditSubscriptions"))
|
self.inboxSearchLineEditSubscriptions.setObjectName("inboxSearchLineEditSubscriptions")
|
||||||
self.horizontalSplitter_2.addWidget(self.inboxSearchLineEditSubscriptions)
|
self.horizontalSplitter_2.addWidget(self.inboxSearchLineEditSubscriptions)
|
||||||
self.inboxSearchOptionSubscriptions = QtGui.QComboBox(self.subscriptions)
|
self.inboxSearchOptionSubscriptions = QtWidgets.QComboBox(self.subscriptions)
|
||||||
self.inboxSearchOptionSubscriptions.setObjectName(_fromUtf8("inboxSearchOptionSubscriptions"))
|
self.inboxSearchOptionSubscriptions.setObjectName("inboxSearchOptionSubscriptions")
|
||||||
self.inboxSearchOptionSubscriptions.addItem(_fromUtf8(""))
|
self.inboxSearchOptionSubscriptions.addItem("")
|
||||||
self.inboxSearchOptionSubscriptions.addItem(_fromUtf8(""))
|
self.inboxSearchOptionSubscriptions.addItem("")
|
||||||
self.inboxSearchOptionSubscriptions.addItem(_fromUtf8(""))
|
self.inboxSearchOptionSubscriptions.addItem("")
|
||||||
self.inboxSearchOptionSubscriptions.addItem(_fromUtf8(""))
|
self.inboxSearchOptionSubscriptions.addItem("")
|
||||||
self.inboxSearchOptionSubscriptions.addItem(_fromUtf8(""))
|
self.inboxSearchOptionSubscriptions.addItem("")
|
||||||
self.inboxSearchOptionSubscriptions.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
self.inboxSearchOptionSubscriptions.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||||
self.horizontalSplitter_2.addWidget(self.inboxSearchOptionSubscriptions)
|
self.horizontalSplitter_2.addWidget(self.inboxSearchOptionSubscriptions)
|
||||||
self.horizontalSplitter_2.handle(1).setEnabled(False)
|
self.horizontalSplitter_2.handle(1).setEnabled(False)
|
||||||
self.horizontalSplitter_2.setStretchFactor(0, 1)
|
self.horizontalSplitter_2.setStretchFactor(0, 1)
|
||||||
self.horizontalSplitter_2.setStretchFactor(1, 0)
|
self.horizontalSplitter_2.setStretchFactor(1, 0)
|
||||||
self.verticalSplitter_4.addWidget(self.horizontalSplitter_2)
|
self.verticalSplitter_4.addWidget(self.horizontalSplitter_2)
|
||||||
self.tableWidgetInboxSubscriptions = settingsmixin.STableWidget(self.subscriptions)
|
self.tableWidgetInboxSubscriptions = settingsmixin.STableWidget(self.subscriptions)
|
||||||
self.tableWidgetInboxSubscriptions.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
|
self.tableWidgetInboxSubscriptions.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
self.tableWidgetInboxSubscriptions.setAlternatingRowColors(True)
|
self.tableWidgetInboxSubscriptions.setAlternatingRowColors(True)
|
||||||
self.tableWidgetInboxSubscriptions.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
self.tableWidgetInboxSubscriptions.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
self.tableWidgetInboxSubscriptions.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
self.tableWidgetInboxSubscriptions.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
self.tableWidgetInboxSubscriptions.setWordWrap(False)
|
self.tableWidgetInboxSubscriptions.setWordWrap(False)
|
||||||
self.tableWidgetInboxSubscriptions.setObjectName(_fromUtf8("tableWidgetInboxSubscriptions"))
|
self.tableWidgetInboxSubscriptions.setObjectName("tableWidgetInboxSubscriptions")
|
||||||
self.tableWidgetInboxSubscriptions.setColumnCount(4)
|
self.tableWidgetInboxSubscriptions.setColumnCount(4)
|
||||||
self.tableWidgetInboxSubscriptions.setRowCount(0)
|
self.tableWidgetInboxSubscriptions.setRowCount(0)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInboxSubscriptions.setHorizontalHeaderItem(0, item)
|
self.tableWidgetInboxSubscriptions.setHorizontalHeaderItem(0, item)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInboxSubscriptions.setHorizontalHeaderItem(1, item)
|
self.tableWidgetInboxSubscriptions.setHorizontalHeaderItem(1, item)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInboxSubscriptions.setHorizontalHeaderItem(2, item)
|
self.tableWidgetInboxSubscriptions.setHorizontalHeaderItem(2, item)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInboxSubscriptions.setHorizontalHeaderItem(3, item)
|
self.tableWidgetInboxSubscriptions.setHorizontalHeaderItem(3, item)
|
||||||
self.tableWidgetInboxSubscriptions.horizontalHeader().setCascadingSectionResizes(True)
|
self.tableWidgetInboxSubscriptions.horizontalHeader().setCascadingSectionResizes(True)
|
||||||
self.tableWidgetInboxSubscriptions.horizontalHeader().setDefaultSectionSize(200)
|
self.tableWidgetInboxSubscriptions.horizontalHeader().setDefaultSectionSize(200)
|
||||||
|
@ -439,7 +414,7 @@ class Ui_MainWindow(object):
|
||||||
self.textEditInboxMessageSubscriptions = MessageView(self.subscriptions)
|
self.textEditInboxMessageSubscriptions = MessageView(self.subscriptions)
|
||||||
self.textEditInboxMessageSubscriptions.setBaseSize(QtCore.QSize(0, 500))
|
self.textEditInboxMessageSubscriptions.setBaseSize(QtCore.QSize(0, 500))
|
||||||
self.textEditInboxMessageSubscriptions.setReadOnly(True)
|
self.textEditInboxMessageSubscriptions.setReadOnly(True)
|
||||||
self.textEditInboxMessageSubscriptions.setObjectName(_fromUtf8("textEditInboxMessageSubscriptions"))
|
self.textEditInboxMessageSubscriptions.setObjectName("textEditInboxMessageSubscriptions")
|
||||||
self.verticalSplitter_4.addWidget(self.textEditInboxMessageSubscriptions)
|
self.verticalSplitter_4.addWidget(self.textEditInboxMessageSubscriptions)
|
||||||
self.verticalSplitter_4.setStretchFactor(0, 0)
|
self.verticalSplitter_4.setStretchFactor(0, 0)
|
||||||
self.verticalSplitter_4.setStretchFactor(1, 1)
|
self.verticalSplitter_4.setStretchFactor(1, 1)
|
||||||
|
@ -455,31 +430,31 @@ class Ui_MainWindow(object):
|
||||||
self.horizontalSplitter_4.setCollapsible(1, False)
|
self.horizontalSplitter_4.setCollapsible(1, False)
|
||||||
self.gridLayout_3.addWidget(self.horizontalSplitter_4, 0, 0, 1, 1)
|
self.gridLayout_3.addWidget(self.horizontalSplitter_4, 0, 0, 1, 1)
|
||||||
icon6 = QtGui.QIcon()
|
icon6 = QtGui.QIcon()
|
||||||
icon6.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/subscriptions.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
icon6.addPixmap(QtGui.QPixmap(":/newPrefix/images/subscriptions.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
self.tabWidget.addTab(self.subscriptions, icon6, _fromUtf8(""))
|
self.tabWidget.addTab(self.subscriptions, icon6, "")
|
||||||
self.chans = QtGui.QWidget()
|
self.chans = QtWidgets.QWidget()
|
||||||
self.chans.setObjectName(_fromUtf8("chans"))
|
self.chans.setObjectName("chans")
|
||||||
self.gridLayout_4 = QtGui.QGridLayout(self.chans)
|
self.gridLayout_4 = QtWidgets.QGridLayout(self.chans)
|
||||||
self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))
|
self.gridLayout_4.setObjectName("gridLayout_4")
|
||||||
self.horizontalSplitter_7 = settingsmixin.SSplitter()
|
self.horizontalSplitter_7 = settingsmixin.SSplitter()
|
||||||
self.horizontalSplitter_7.setObjectName(_fromUtf8("horizontalSplitter_7"))
|
self.horizontalSplitter_7.setObjectName("horizontalSplitter_7")
|
||||||
self.verticalSplitter_17 = settingsmixin.SSplitter()
|
self.verticalSplitter_17 = settingsmixin.SSplitter()
|
||||||
self.verticalSplitter_17.setObjectName(_fromUtf8("verticalSplitter_17"))
|
self.verticalSplitter_17.setObjectName("verticalSplitter_17")
|
||||||
self.verticalSplitter_17.setOrientation(QtCore.Qt.Vertical)
|
self.verticalSplitter_17.setOrientation(QtCore.Qt.Vertical)
|
||||||
self.treeWidgetChans = settingsmixin.STreeWidget(self.chans)
|
self.treeWidgetChans = settingsmixin.STreeWidget(self.chans)
|
||||||
self.treeWidgetChans.setFrameShadow(QtGui.QFrame.Sunken)
|
self.treeWidgetChans.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||||
self.treeWidgetChans.setLineWidth(1)
|
self.treeWidgetChans.setLineWidth(1)
|
||||||
self.treeWidgetChans.setAlternatingRowColors(True)
|
self.treeWidgetChans.setAlternatingRowColors(True)
|
||||||
self.treeWidgetChans.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
|
self.treeWidgetChans.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
|
||||||
self.treeWidgetChans.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
self.treeWidgetChans.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
self.treeWidgetChans.setObjectName(_fromUtf8("treeWidgetChans"))
|
self.treeWidgetChans.setObjectName("treeWidgetChans")
|
||||||
self.treeWidgetChans.resize(200, self.treeWidgetChans.height())
|
self.treeWidgetChans.resize(200, self.treeWidgetChans.height())
|
||||||
icon7 = QtGui.QIcon()
|
icon7 = QtGui.QIcon()
|
||||||
icon7.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/can-icon-16px.png")), QtGui.QIcon.Selected, QtGui.QIcon.Off)
|
icon7.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Selected, QtGui.QIcon.Off)
|
||||||
self.treeWidgetChans.headerItem().setIcon(0, icon7)
|
self.treeWidgetChans.headerItem().setIcon(0, icon7)
|
||||||
self.verticalSplitter_17.addWidget(self.treeWidgetChans)
|
self.verticalSplitter_17.addWidget(self.treeWidgetChans)
|
||||||
self.pushButtonAddChan = QtGui.QPushButton(self.chans)
|
self.pushButtonAddChan = QtWidgets.QPushButton(self.chans)
|
||||||
self.pushButtonAddChan.setObjectName(_fromUtf8("pushButtonAddChan"))
|
self.pushButtonAddChan.setObjectName("pushButtonAddChan")
|
||||||
self.pushButtonAddChan.resize(200, self.pushButtonAddChan.height())
|
self.pushButtonAddChan.resize(200, self.pushButtonAddChan.height())
|
||||||
self.verticalSplitter_17.addWidget(self.pushButtonAddChan)
|
self.verticalSplitter_17.addWidget(self.pushButtonAddChan)
|
||||||
self.verticalSplitter_17.setStretchFactor(0, 1)
|
self.verticalSplitter_17.setStretchFactor(0, 1)
|
||||||
|
@ -489,42 +464,42 @@ class Ui_MainWindow(object):
|
||||||
self.verticalSplitter_17.handle(1).setEnabled(False)
|
self.verticalSplitter_17.handle(1).setEnabled(False)
|
||||||
self.horizontalSplitter_7.addWidget(self.verticalSplitter_17)
|
self.horizontalSplitter_7.addWidget(self.verticalSplitter_17)
|
||||||
self.verticalSplitter_8 = settingsmixin.SSplitter()
|
self.verticalSplitter_8 = settingsmixin.SSplitter()
|
||||||
self.verticalSplitter_8.setObjectName(_fromUtf8("verticalSplitter_8"))
|
self.verticalSplitter_8.setObjectName("verticalSplitter_8")
|
||||||
self.verticalSplitter_8.setOrientation(QtCore.Qt.Vertical)
|
self.verticalSplitter_8.setOrientation(QtCore.Qt.Vertical)
|
||||||
self.horizontalSplitter_6 = QtGui.QSplitter()
|
self.horizontalSplitter_6 = QtWidgets.QSplitter()
|
||||||
self.horizontalSplitter_6.setObjectName(_fromUtf8("horizontalSplitter_6"))
|
self.horizontalSplitter_6.setObjectName("horizontalSplitter_6")
|
||||||
self.inboxSearchLineEditChans = QtGui.QLineEdit(self.chans)
|
self.inboxSearchLineEditChans = QtWidgets.QLineEdit(self.chans)
|
||||||
self.inboxSearchLineEditChans.setObjectName(_fromUtf8("inboxSearchLineEditChans"))
|
self.inboxSearchLineEditChans.setObjectName("inboxSearchLineEditChans")
|
||||||
self.horizontalSplitter_6.addWidget(self.inboxSearchLineEditChans)
|
self.horizontalSplitter_6.addWidget(self.inboxSearchLineEditChans)
|
||||||
self.inboxSearchOptionChans = QtGui.QComboBox(self.chans)
|
self.inboxSearchOptionChans = QtWidgets.QComboBox(self.chans)
|
||||||
self.inboxSearchOptionChans.setObjectName(_fromUtf8("inboxSearchOptionChans"))
|
self.inboxSearchOptionChans.setObjectName("inboxSearchOptionChans")
|
||||||
self.inboxSearchOptionChans.addItem(_fromUtf8(""))
|
self.inboxSearchOptionChans.addItem("")
|
||||||
self.inboxSearchOptionChans.addItem(_fromUtf8(""))
|
self.inboxSearchOptionChans.addItem("")
|
||||||
self.inboxSearchOptionChans.addItem(_fromUtf8(""))
|
self.inboxSearchOptionChans.addItem("")
|
||||||
self.inboxSearchOptionChans.addItem(_fromUtf8(""))
|
self.inboxSearchOptionChans.addItem("")
|
||||||
self.inboxSearchOptionChans.addItem(_fromUtf8(""))
|
self.inboxSearchOptionChans.addItem("")
|
||||||
self.inboxSearchOptionChans.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
|
self.inboxSearchOptionChans.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||||
self.horizontalSplitter_6.addWidget(self.inboxSearchOptionChans)
|
self.horizontalSplitter_6.addWidget(self.inboxSearchOptionChans)
|
||||||
self.horizontalSplitter_6.handle(1).setEnabled(False)
|
self.horizontalSplitter_6.handle(1).setEnabled(False)
|
||||||
self.horizontalSplitter_6.setStretchFactor(0, 1)
|
self.horizontalSplitter_6.setStretchFactor(0, 1)
|
||||||
self.horizontalSplitter_6.setStretchFactor(1, 0)
|
self.horizontalSplitter_6.setStretchFactor(1, 0)
|
||||||
self.verticalSplitter_8.addWidget(self.horizontalSplitter_6)
|
self.verticalSplitter_8.addWidget(self.horizontalSplitter_6)
|
||||||
self.tableWidgetInboxChans = settingsmixin.STableWidget(self.chans)
|
self.tableWidgetInboxChans = settingsmixin.STableWidget(self.chans)
|
||||||
self.tableWidgetInboxChans.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
|
self.tableWidgetInboxChans.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||||
self.tableWidgetInboxChans.setAlternatingRowColors(True)
|
self.tableWidgetInboxChans.setAlternatingRowColors(True)
|
||||||
self.tableWidgetInboxChans.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
self.tableWidgetInboxChans.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||||
self.tableWidgetInboxChans.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
self.tableWidgetInboxChans.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
|
||||||
self.tableWidgetInboxChans.setWordWrap(False)
|
self.tableWidgetInboxChans.setWordWrap(False)
|
||||||
self.tableWidgetInboxChans.setObjectName(_fromUtf8("tableWidgetInboxChans"))
|
self.tableWidgetInboxChans.setObjectName("tableWidgetInboxChans")
|
||||||
self.tableWidgetInboxChans.setColumnCount(4)
|
self.tableWidgetInboxChans.setColumnCount(4)
|
||||||
self.tableWidgetInboxChans.setRowCount(0)
|
self.tableWidgetInboxChans.setRowCount(0)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInboxChans.setHorizontalHeaderItem(0, item)
|
self.tableWidgetInboxChans.setHorizontalHeaderItem(0, item)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInboxChans.setHorizontalHeaderItem(1, item)
|
self.tableWidgetInboxChans.setHorizontalHeaderItem(1, item)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInboxChans.setHorizontalHeaderItem(2, item)
|
self.tableWidgetInboxChans.setHorizontalHeaderItem(2, item)
|
||||||
item = QtGui.QTableWidgetItem()
|
item = QtWidgets.QTableWidgetItem()
|
||||||
self.tableWidgetInboxChans.setHorizontalHeaderItem(3, item)
|
self.tableWidgetInboxChans.setHorizontalHeaderItem(3, item)
|
||||||
self.tableWidgetInboxChans.horizontalHeader().setCascadingSectionResizes(True)
|
self.tableWidgetInboxChans.horizontalHeader().setCascadingSectionResizes(True)
|
||||||
self.tableWidgetInboxChans.horizontalHeader().setDefaultSectionSize(200)
|
self.tableWidgetInboxChans.horizontalHeader().setDefaultSectionSize(200)
|
||||||
|
@ -538,7 +513,7 @@ class Ui_MainWindow(object):
|
||||||
self.textEditInboxMessageChans = MessageView(self.chans)
|
self.textEditInboxMessageChans = MessageView(self.chans)
|
||||||
self.textEditInboxMessageChans.setBaseSize(QtCore.QSize(0, 500))
|
self.textEditInboxMessageChans.setBaseSize(QtCore.QSize(0, 500))
|
||||||
self.textEditInboxMessageChans.setReadOnly(True)
|
self.textEditInboxMessageChans.setReadOnly(True)
|
||||||
self.textEditInboxMessageChans.setObjectName(_fromUtf8("textEditInboxMessageChans"))
|
self.textEditInboxMessageChans.setObjectName("textEditInboxMessageChans")
|
||||||
self.verticalSplitter_8.addWidget(self.textEditInboxMessageChans)
|
self.verticalSplitter_8.addWidget(self.textEditInboxMessageChans)
|
||||||
self.verticalSplitter_8.setStretchFactor(0, 0)
|
self.verticalSplitter_8.setStretchFactor(0, 0)
|
||||||
self.verticalSplitter_8.setStretchFactor(1, 1)
|
self.verticalSplitter_8.setStretchFactor(1, 1)
|
||||||
|
@ -554,8 +529,8 @@ class Ui_MainWindow(object):
|
||||||
self.horizontalSplitter_7.setCollapsible(1, False)
|
self.horizontalSplitter_7.setCollapsible(1, False)
|
||||||
self.gridLayout_4.addWidget(self.horizontalSplitter_7, 0, 0, 1, 1)
|
self.gridLayout_4.addWidget(self.horizontalSplitter_7, 0, 0, 1, 1)
|
||||||
icon8 = QtGui.QIcon()
|
icon8 = QtGui.QIcon()
|
||||||
icon8.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/can-icon-16px.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
icon8.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
self.tabWidget.addTab(self.chans, icon8, _fromUtf8(""))
|
self.tabWidget.addTab(self.chans, icon8, "")
|
||||||
self.blackwhitelist = Blacklist()
|
self.blackwhitelist = Blacklist()
|
||||||
self.tabWidget.addTab(self.blackwhitelist, QtGui.QIcon(":/newPrefix/images/blacklist.png"), "")
|
self.tabWidget.addTab(self.blackwhitelist, QtGui.QIcon(":/newPrefix/images/blacklist.png"), "")
|
||||||
# Initialize the Blacklist or Whitelist
|
# Initialize the Blacklist or Whitelist
|
||||||
|
@ -567,62 +542,62 @@ class Ui_MainWindow(object):
|
||||||
self.tabWidget.addTab(self.networkstatus, QtGui.QIcon(":/newPrefix/images/networkstatus.png"), "")
|
self.tabWidget.addTab(self.networkstatus, QtGui.QIcon(":/newPrefix/images/networkstatus.png"), "")
|
||||||
self.gridLayout_10.addWidget(self.tabWidget, 0, 0, 1, 1)
|
self.gridLayout_10.addWidget(self.tabWidget, 0, 0, 1, 1)
|
||||||
MainWindow.setCentralWidget(self.centralwidget)
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
self.menubar = QtGui.QMenuBar(MainWindow)
|
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 885, 27))
|
self.menubar.setGeometry(QtCore.QRect(0, 0, 885, 27))
|
||||||
self.menubar.setObjectName(_fromUtf8("menubar"))
|
self.menubar.setObjectName("menubar")
|
||||||
self.menuFile = QtGui.QMenu(self.menubar)
|
self.menuFile = QtWidgets.QMenu(self.menubar)
|
||||||
self.menuFile.setObjectName(_fromUtf8("menuFile"))
|
self.menuFile.setObjectName("menuFile")
|
||||||
self.menuSettings = QtGui.QMenu(self.menubar)
|
self.menuSettings = QtWidgets.QMenu(self.menubar)
|
||||||
self.menuSettings.setObjectName(_fromUtf8("menuSettings"))
|
self.menuSettings.setObjectName("menuSettings")
|
||||||
self.menuHelp = QtGui.QMenu(self.menubar)
|
self.menuHelp = QtWidgets.QMenu(self.menubar)
|
||||||
self.menuHelp.setObjectName(_fromUtf8("menuHelp"))
|
self.menuHelp.setObjectName("menuHelp")
|
||||||
MainWindow.setMenuBar(self.menubar)
|
MainWindow.setMenuBar(self.menubar)
|
||||||
self.statusbar = QtGui.QStatusBar(MainWindow)
|
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||||
self.statusbar.setMaximumSize(QtCore.QSize(16777215, 22))
|
self.statusbar.setMaximumSize(QtCore.QSize(16777215, 22))
|
||||||
self.statusbar.setObjectName(_fromUtf8("statusbar"))
|
self.statusbar.setObjectName("statusbar")
|
||||||
MainWindow.setStatusBar(self.statusbar)
|
MainWindow.setStatusBar(self.statusbar)
|
||||||
self.actionImport_keys = QtGui.QAction(MainWindow)
|
self.actionImport_keys = QtWidgets.QAction(MainWindow)
|
||||||
self.actionImport_keys.setObjectName(_fromUtf8("actionImport_keys"))
|
self.actionImport_keys.setObjectName("actionImport_keys")
|
||||||
self.actionManageKeys = QtGui.QAction(MainWindow)
|
self.actionManageKeys = QtWidgets.QAction(MainWindow)
|
||||||
self.actionManageKeys.setCheckable(False)
|
self.actionManageKeys.setCheckable(False)
|
||||||
self.actionManageKeys.setEnabled(True)
|
self.actionManageKeys.setEnabled(True)
|
||||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("dialog-password"))
|
icon = QtGui.QIcon.fromTheme("dialog-password")
|
||||||
self.actionManageKeys.setIcon(icon)
|
self.actionManageKeys.setIcon(icon)
|
||||||
self.actionManageKeys.setObjectName(_fromUtf8("actionManageKeys"))
|
self.actionManageKeys.setObjectName("actionManageKeys")
|
||||||
self.actionNetworkSwitch = QtGui.QAction(MainWindow)
|
self.actionNetworkSwitch = QtWidgets.QAction(MainWindow)
|
||||||
self.actionNetworkSwitch.setObjectName(_fromUtf8("actionNetworkSwitch"))
|
self.actionNetworkSwitch.setObjectName("actionNetworkSwitch")
|
||||||
self.actionExit = QtGui.QAction(MainWindow)
|
self.actionExit = QtWidgets.QAction(MainWindow)
|
||||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("application-exit"))
|
icon = QtGui.QIcon.fromTheme("application-exit")
|
||||||
self.actionExit.setIcon(icon)
|
self.actionExit.setIcon(icon)
|
||||||
self.actionExit.setObjectName(_fromUtf8("actionExit"))
|
self.actionExit.setObjectName("actionExit")
|
||||||
self.actionHelp = QtGui.QAction(MainWindow)
|
self.actionHelp = QtWidgets.QAction(MainWindow)
|
||||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("help-contents"))
|
icon = QtGui.QIcon.fromTheme("help-contents")
|
||||||
self.actionHelp.setIcon(icon)
|
self.actionHelp.setIcon(icon)
|
||||||
self.actionHelp.setObjectName(_fromUtf8("actionHelp"))
|
self.actionHelp.setObjectName("actionHelp")
|
||||||
self.actionSupport = QtGui.QAction(MainWindow)
|
self.actionSupport = QtWidgets.QAction(MainWindow)
|
||||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("help-support"))
|
icon = QtGui.QIcon.fromTheme("help-support")
|
||||||
self.actionSupport.setIcon(icon)
|
self.actionSupport.setIcon(icon)
|
||||||
self.actionSupport.setObjectName(_fromUtf8("actionSupport"))
|
self.actionSupport.setObjectName("actionSupport")
|
||||||
self.actionAbout = QtGui.QAction(MainWindow)
|
self.actionAbout = QtWidgets.QAction(MainWindow)
|
||||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("help-about"))
|
icon = QtGui.QIcon.fromTheme("help-about")
|
||||||
self.actionAbout.setIcon(icon)
|
self.actionAbout.setIcon(icon)
|
||||||
self.actionAbout.setObjectName(_fromUtf8("actionAbout"))
|
self.actionAbout.setObjectName("actionAbout")
|
||||||
self.actionSettings = QtGui.QAction(MainWindow)
|
self.actionSettings = QtWidgets.QAction(MainWindow)
|
||||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("document-properties"))
|
icon = QtGui.QIcon.fromTheme("document-properties")
|
||||||
self.actionSettings.setIcon(icon)
|
self.actionSettings.setIcon(icon)
|
||||||
self.actionSettings.setObjectName(_fromUtf8("actionSettings"))
|
self.actionSettings.setObjectName("actionSettings")
|
||||||
self.actionRegenerateDeterministicAddresses = QtGui.QAction(MainWindow)
|
self.actionRegenerateDeterministicAddresses = QtWidgets.QAction(MainWindow)
|
||||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("view-refresh"))
|
icon = QtGui.QIcon.fromTheme("view-refresh")
|
||||||
self.actionRegenerateDeterministicAddresses.setIcon(icon)
|
self.actionRegenerateDeterministicAddresses.setIcon(icon)
|
||||||
self.actionRegenerateDeterministicAddresses.setObjectName(_fromUtf8("actionRegenerateDeterministicAddresses"))
|
self.actionRegenerateDeterministicAddresses.setObjectName("actionRegenerateDeterministicAddresses")
|
||||||
self.actionDeleteAllTrashedMessages = QtGui.QAction(MainWindow)
|
self.actionDeleteAllTrashedMessages = QtWidgets.QAction(MainWindow)
|
||||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("user-trash"))
|
icon = QtGui.QIcon.fromTheme("user-trash")
|
||||||
self.actionDeleteAllTrashedMessages.setIcon(icon)
|
self.actionDeleteAllTrashedMessages.setIcon(icon)
|
||||||
self.actionDeleteAllTrashedMessages.setObjectName(_fromUtf8("actionDeleteAllTrashedMessages"))
|
self.actionDeleteAllTrashedMessages.setObjectName("actionDeleteAllTrashedMessages")
|
||||||
self.actionJoinChan = QtGui.QAction(MainWindow)
|
self.actionJoinChan = QtWidgets.QAction(MainWindow)
|
||||||
icon = QtGui.QIcon.fromTheme(_fromUtf8("contact-new"))
|
icon = QtGui.QIcon.fromTheme("contact-new")
|
||||||
self.actionJoinChan.setIcon(icon)
|
self.actionJoinChan.setIcon(icon)
|
||||||
self.actionJoinChan.setObjectName(_fromUtf8("actionJoinChan"))
|
self.actionJoinChan.setObjectName("actionJoinChan")
|
||||||
self.menuFile.addAction(self.actionManageKeys)
|
self.menuFile.addAction(self.actionManageKeys)
|
||||||
self.menuFile.addAction(self.actionDeleteAllTrashedMessages)
|
self.menuFile.addAction(self.actionDeleteAllTrashedMessages)
|
||||||
self.menuFile.addAction(self.actionRegenerateDeterministicAddresses)
|
self.menuFile.addAction(self.actionRegenerateDeterministicAddresses)
|
||||||
|
@ -703,7 +678,7 @@ class Ui_MainWindow(object):
|
||||||
hours = int(BMConfigParser().getint('bitmessagesettings', 'ttl')/60/60)
|
hours = int(BMConfigParser().getint('bitmessagesettings', 'ttl')/60/60)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "%n hour(s)", None, QtCore.QCoreApplication.CodecForTr, hours))
|
self.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "%n hour(s)", None, hours))
|
||||||
self.pushButtonClear.setText(_translate("MainWindow", "Clear", None))
|
self.pushButtonClear.setText(_translate("MainWindow", "Clear", None))
|
||||||
self.pushButtonSend.setText(_translate("MainWindow", "Send", None))
|
self.pushButtonSend.setText(_translate("MainWindow", "Send", None))
|
||||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send", None))
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send", None))
|
||||||
|
@ -763,15 +738,13 @@ class Ui_MainWindow(object):
|
||||||
self.actionDeleteAllTrashedMessages.setText(_translate("MainWindow", "Delete all trashed messages", None))
|
self.actionDeleteAllTrashedMessages.setText(_translate("MainWindow", "Delete all trashed messages", None))
|
||||||
self.actionJoinChan.setText(_translate("MainWindow", "Join / Create chan", None))
|
self.actionJoinChan.setText(_translate("MainWindow", "Join / Create chan", None))
|
||||||
|
|
||||||
import bitmessage_icons_rc
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
app = QtGui.QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
MainWindow = settingsmixin.SMainWindow()
|
MainWindow = settingsmixin.SMainWindow()
|
||||||
ui = Ui_MainWindow()
|
ui = Ui_MainWindow()
|
||||||
ui.setupUi(MainWindow)
|
ui.setupUi(MainWindow)
|
||||||
MainWindow.show()
|
MainWindow.show()
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from qtpy import QtCore, QtGui, QtWidgets
|
||||||
from tr import _translate
|
from tr import _translate
|
||||||
import l10n
|
|
||||||
import widgets
|
import widgets
|
||||||
from addresses import addBMIfNotPresent
|
from addresses import addBMIfNotPresent
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
|
@ -11,31 +10,31 @@ from utils import avatarize
|
||||||
from uisignaler import UISignaler
|
from uisignaler import UISignaler
|
||||||
|
|
||||||
|
|
||||||
class Blacklist(QtGui.QWidget, RetranslateMixin):
|
class Blacklist(QtWidgets.QWidget, RetranslateMixin):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(Blacklist, self).__init__(parent)
|
super(Blacklist, self).__init__(parent)
|
||||||
widgets.load('blacklist.ui', self)
|
widgets.load('blacklist.ui', self)
|
||||||
|
|
||||||
QtCore.QObject.connect(self.radioButtonBlacklist, QtCore.SIGNAL(
|
self.radioButtonBlacklist.clicked.connect(
|
||||||
"clicked()"), self.click_radioButtonBlacklist)
|
self.click_radioButtonBlacklist)
|
||||||
QtCore.QObject.connect(self.radioButtonWhitelist, QtCore.SIGNAL(
|
self.radioButtonWhitelist.clicked.connect(
|
||||||
"clicked()"), self.click_radioButtonWhitelist)
|
self.click_radioButtonWhitelist)
|
||||||
QtCore.QObject.connect(self.pushButtonAddBlacklist, QtCore.SIGNAL(
|
self.pushButtonAddBlacklist.clicked.connect(
|
||||||
"clicked()"), self.click_pushButtonAddBlacklist)
|
self.click_pushButtonAddBlacklist)
|
||||||
|
|
||||||
self.init_blacklist_popup_menu()
|
self.init_blacklist_popup_menu()
|
||||||
|
|
||||||
# Initialize blacklist
|
self.tableWidgetBlacklist.itemChanged.connect(
|
||||||
QtCore.QObject.connect(self.tableWidgetBlacklist, QtCore.SIGNAL(
|
self.tableWidgetBlacklistItemChanged)
|
||||||
"itemChanged(QTableWidgetItem *)"), self.tableWidgetBlacklistItemChanged)
|
|
||||||
|
|
||||||
# Set the icon sizes for the identicons
|
# Set the icon sizes for the identicons
|
||||||
identicon_size = 3*7
|
identicon_size = 3*7
|
||||||
self.tableWidgetBlacklist.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.tableWidgetBlacklist.setIconSize(
|
||||||
|
QtCore.QSize(identicon_size, identicon_size))
|
||||||
|
|
||||||
self.UISignalThread = UISignaler.get()
|
self.UISignalThread = UISignaler.get()
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.UISignalThread.rerenderBlackWhiteList.connect(
|
||||||
"rerenderBlackWhiteList()"), self.rerenderBlackWhiteList)
|
self.rerenderBlackWhiteList)
|
||||||
|
|
||||||
def click_radioButtonBlacklist(self):
|
def click_radioButtonBlacklist(self):
|
||||||
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'white':
|
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'white':
|
||||||
|
@ -68,15 +67,15 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
sql = '''select * from blacklist where address=?'''
|
sql = '''select * from blacklist where address=?'''
|
||||||
else:
|
else:
|
||||||
sql = '''select * from whitelist where address=?'''
|
sql = '''select * from whitelist where address=?'''
|
||||||
queryreturn = sqlQuery(sql,*t)
|
queryreturn = sqlQuery(sql, *t)
|
||||||
if queryreturn == []:
|
if queryreturn == []:
|
||||||
self.tableWidgetBlacklist.setSortingEnabled(False)
|
self.tableWidgetBlacklist.setSortingEnabled(False)
|
||||||
self.tableWidgetBlacklist.insertRow(0)
|
self.tableWidgetBlacklist.insertRow(0)
|
||||||
newItem = QtGui.QTableWidgetItem(unicode(
|
newItem = QtGui.QTableWidgetItem(
|
||||||
self.NewBlacklistDialogInstance.lineEditLabel.text().toUtf8(), 'utf-8'))
|
self.NewBlacklistDialogInstance.lineEditLabel.text())
|
||||||
newItem.setIcon(avatarize(address))
|
newItem.setIcon(avatarize(address))
|
||||||
self.tableWidgetBlacklist.setItem(0, 0, newItem)
|
self.tableWidgetBlacklist.setItem(0, 0, newItem)
|
||||||
newItem = QtGui.QTableWidgetItem(address)
|
newItem = QtWidgets.QTableWidgetItem(address)
|
||||||
newItem.setFlags(
|
newItem.setFlags(
|
||||||
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||||
self.tableWidgetBlacklist.setItem(0, 1, newItem)
|
self.tableWidgetBlacklist.setItem(0, 1, newItem)
|
||||||
|
@ -89,15 +88,21 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
sqlExecute(sql, *t)
|
sqlExecute(sql, *t)
|
||||||
else:
|
else:
|
||||||
self.statusBar().showMessage(_translate(
|
self.statusBar().showMessage(_translate(
|
||||||
"MainWindow", "Error: You cannot add the same address to your list twice. Perhaps rename the existing one if you want."))
|
"MainWindow",
|
||||||
|
"Error: You cannot add the same address to your"
|
||||||
|
" list twice. Perhaps rename the existing one"
|
||||||
|
" if you want."
|
||||||
|
))
|
||||||
else:
|
else:
|
||||||
self.statusBar().showMessage(_translate(
|
self.statusBar().showMessage(_translate(
|
||||||
"MainWindow", "The address you entered was invalid. Ignoring it."))
|
"MainWindow",
|
||||||
|
"The address you entered was invalid. Ignoring it."
|
||||||
|
))
|
||||||
|
|
||||||
def tableWidgetBlacklistItemChanged(self, item):
|
def tableWidgetBlacklistItemChanged(self, item):
|
||||||
if item.column() == 0:
|
if item.column() == 0:
|
||||||
addressitem = self.tableWidgetBlacklist.item(item.row(), 1)
|
addressitem = self.tableWidgetBlacklist.item(item.row(), 1)
|
||||||
if isinstance(addressitem, QtGui.QTableWidgetItem):
|
if isinstance(addressitem, QtWidgets.QTableWidgetItem):
|
||||||
if self.radioButtonBlacklist.isChecked():
|
if self.radioButtonBlacklist.isChecked():
|
||||||
sqlExecute('''UPDATE blacklist SET label=? WHERE address=?''',
|
sqlExecute('''UPDATE blacklist SET label=? WHERE address=?''',
|
||||||
str(item.text()), str(addressitem.text()))
|
str(item.text()), str(addressitem.text()))
|
||||||
|
@ -107,7 +112,7 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
|
|
||||||
def init_blacklist_popup_menu(self, connectSignal=True):
|
def init_blacklist_popup_menu(self, connectSignal=True):
|
||||||
# Popup menu for the Blacklist page
|
# Popup menu for the Blacklist page
|
||||||
self.blacklistContextMenuToolbar = QtGui.QToolBar()
|
self.blacklistContextMenuToolbar = QtWidgets.QToolBar()
|
||||||
# Actions
|
# Actions
|
||||||
self.actionBlacklistNew = self.blacklistContextMenuToolbar.addAction(
|
self.actionBlacklistNew = self.blacklistContextMenuToolbar.addAction(
|
||||||
_translate(
|
_translate(
|
||||||
|
@ -132,10 +137,9 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
self.tableWidgetBlacklist.setContextMenuPolicy(
|
self.tableWidgetBlacklist.setContextMenuPolicy(
|
||||||
QtCore.Qt.CustomContextMenu)
|
QtCore.Qt.CustomContextMenu)
|
||||||
if connectSignal:
|
if connectSignal:
|
||||||
self.connect(self.tableWidgetBlacklist, QtCore.SIGNAL(
|
self.tableWidgetBlacklist.customContextMenuRequested.connect(
|
||||||
'customContextMenuRequested(const QPoint&)'),
|
self.on_context_menuBlacklist)
|
||||||
self.on_context_menuBlacklist)
|
self.popMenuBlacklist = QtWidgets.QMenu(self)
|
||||||
self.popMenuBlacklist = QtGui.QMenu(self)
|
|
||||||
# self.popMenuBlacklist.addAction( self.actionBlacklistNew )
|
# self.popMenuBlacklist.addAction( self.actionBlacklistNew )
|
||||||
self.popMenuBlacklist.addAction(self.actionBlacklistDelete)
|
self.popMenuBlacklist.addAction(self.actionBlacklistDelete)
|
||||||
self.popMenuBlacklist.addSeparator()
|
self.popMenuBlacklist.addSeparator()
|
||||||
|
@ -161,16 +165,16 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
label, address, enabled = row
|
label, address, enabled = row
|
||||||
self.tableWidgetBlacklist.insertRow(0)
|
self.tableWidgetBlacklist.insertRow(0)
|
||||||
newItem = QtGui.QTableWidgetItem(unicode(label, 'utf-8'))
|
newItem = QtWidgets.QTableWidgetItem(label)
|
||||||
if not enabled:
|
if not enabled:
|
||||||
newItem.setTextColor(QtGui.QColor(128, 128, 128))
|
newItem.setForeground(QtGui.QColor(128, 128, 128))
|
||||||
newItem.setIcon(avatarize(address))
|
newItem.setIcon(avatarize(address))
|
||||||
self.tableWidgetBlacklist.setItem(0, 0, newItem)
|
self.tableWidgetBlacklist.setItem(0, 0, newItem)
|
||||||
newItem = QtGui.QTableWidgetItem(address)
|
newItem = QtWidgets.QTableWidgetItem(address)
|
||||||
newItem.setFlags(
|
newItem.setFlags(
|
||||||
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.setForeground(QtGui.QColor(128, 128, 128))
|
||||||
self.tableWidgetBlacklist.setItem(0, 1, newItem)
|
self.tableWidgetBlacklist.setItem(0, 1, newItem)
|
||||||
self.tableWidgetBlacklist.setSortingEnabled(True)
|
self.tableWidgetBlacklist.setSortingEnabled(True)
|
||||||
|
|
||||||
|
@ -181,7 +185,7 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
def on_action_BlacklistDelete(self):
|
def on_action_BlacklistDelete(self):
|
||||||
currentRow = self.tableWidgetBlacklist.currentRow()
|
currentRow = self.tableWidgetBlacklist.currentRow()
|
||||||
labelAtCurrentRow = self.tableWidgetBlacklist.item(
|
labelAtCurrentRow = self.tableWidgetBlacklist.item(
|
||||||
currentRow, 0).text().toUtf8()
|
currentRow, 0).text()
|
||||||
addressAtCurrentRow = self.tableWidgetBlacklist.item(
|
addressAtCurrentRow = self.tableWidgetBlacklist.item(
|
||||||
currentRow, 1).text()
|
currentRow, 1).text()
|
||||||
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'black':
|
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'black':
|
||||||
|
@ -198,7 +202,7 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
currentRow = self.tableWidgetBlacklist.currentRow()
|
currentRow = self.tableWidgetBlacklist.currentRow()
|
||||||
addressAtCurrentRow = self.tableWidgetBlacklist.item(
|
addressAtCurrentRow = self.tableWidgetBlacklist.item(
|
||||||
currentRow, 1).text()
|
currentRow, 1).text()
|
||||||
clipboard = QtGui.QApplication.clipboard()
|
clipboard = QtWidgets.QApplication.clipboard()
|
||||||
clipboard.setText(str(addressAtCurrentRow))
|
clipboard.setText(str(addressAtCurrentRow))
|
||||||
|
|
||||||
def on_context_menuBlacklist(self, point):
|
def on_context_menuBlacklist(self, point):
|
||||||
|
@ -209,11 +213,12 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
currentRow = self.tableWidgetBlacklist.currentRow()
|
currentRow = self.tableWidgetBlacklist.currentRow()
|
||||||
addressAtCurrentRow = self.tableWidgetBlacklist.item(
|
addressAtCurrentRow = self.tableWidgetBlacklist.item(
|
||||||
currentRow, 1).text()
|
currentRow, 1).text()
|
||||||
self.tableWidgetBlacklist.item(
|
self.tableWidgetBlacklist.item(currentRow, 0).setForeground(
|
||||||
currentRow, 0).setTextColor(QtGui.QApplication.palette().text().color())
|
QtWidgets.QApplication.palette().text().color())
|
||||||
self.tableWidgetBlacklist.item(
|
self.tableWidgetBlacklist.item(currentRow, 1).setForeground(
|
||||||
currentRow, 1).setTextColor(QtGui.QApplication.palette().text().color())
|
QtWidgets.QApplication.palette().text().color())
|
||||||
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'black':
|
if BMConfigParser().get(
|
||||||
|
'bitmessagesettings', 'blackwhitelist') == 'black':
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE blacklist SET enabled=1 WHERE address=?''',
|
'''UPDATE blacklist SET enabled=1 WHERE address=?''',
|
||||||
str(addressAtCurrentRow))
|
str(addressAtCurrentRow))
|
||||||
|
@ -226,11 +231,12 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
currentRow = self.tableWidgetBlacklist.currentRow()
|
currentRow = self.tableWidgetBlacklist.currentRow()
|
||||||
addressAtCurrentRow = self.tableWidgetBlacklist.item(
|
addressAtCurrentRow = self.tableWidgetBlacklist.item(
|
||||||
currentRow, 1).text()
|
currentRow, 1).text()
|
||||||
self.tableWidgetBlacklist.item(
|
self.tableWidgetBlacklist.item(currentRow, 0).setForeground(
|
||||||
currentRow, 0).setTextColor(QtGui.QColor(128, 128, 128))
|
QtGui.QColor(128, 128, 128))
|
||||||
self.tableWidgetBlacklist.item(
|
self.tableWidgetBlacklist.item(currentRow, 1).setForeground(
|
||||||
currentRow, 1).setTextColor(QtGui.QColor(128, 128, 128))
|
QtGui.QColor(128, 128, 128))
|
||||||
if BMConfigParser().get('bitmessagesettings', 'blackwhitelist') == 'black':
|
if BMConfigParser().get(
|
||||||
|
'bitmessagesettings', 'blackwhitelist') == 'black':
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE blacklist SET enabled=0 WHERE address=?''', str(addressAtCurrentRow))
|
'''UPDATE blacklist SET enabled=0 WHERE address=?''', str(addressAtCurrentRow))
|
||||||
else:
|
else:
|
||||||
|
@ -239,4 +245,3 @@ class Blacklist(QtGui.QWidget, RetranslateMixin):
|
||||||
|
|
||||||
def on_action_BlacklistSetAvatar(self):
|
def on_action_BlacklistSetAvatar(self):
|
||||||
self.window().on_action_SetAvatar(self.tableWidgetBlacklist)
|
self.window().on_action_SetAvatar(self.tableWidgetBlacklist)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from PyQt4 import QtGui
|
from qtpy import QtWidgets
|
||||||
from tr import _translate
|
from tr import _translate
|
||||||
from retranslateui import RetranslateMixin
|
from retranslateui import RetranslateMixin
|
||||||
import widgets
|
import widgets
|
||||||
|
@ -20,7 +20,7 @@ __all__ = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class AboutDialog(QtGui.QDialog, RetranslateMixin):
|
class AboutDialog(QtWidgets.QDialog, RetranslateMixin):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(AboutDialog, self).__init__(parent)
|
super(AboutDialog, self).__init__(parent)
|
||||||
widgets.load('about.ui', self)
|
widgets.load('about.ui', self)
|
||||||
|
@ -44,10 +44,10 @@ class AboutDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.setFixedSize(QtGui.QWidget.sizeHint(self))
|
self.setFixedSize(QtWidgets.QWidget.sizeHint(self))
|
||||||
|
|
||||||
|
|
||||||
class IconGlossaryDialog(QtGui.QDialog, RetranslateMixin):
|
class IconGlossaryDialog(QtWidgets.QDialog, RetranslateMixin):
|
||||||
def __init__(self, parent=None, config=None):
|
def __init__(self, parent=None, config=None):
|
||||||
super(IconGlossaryDialog, self).__init__(parent)
|
super(IconGlossaryDialog, self).__init__(parent)
|
||||||
widgets.load('iconglossary.ui', self)
|
widgets.load('iconglossary.ui', self)
|
||||||
|
@ -57,20 +57,21 @@ class IconGlossaryDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
|
|
||||||
self.labelPortNumber.setText(_translate(
|
self.labelPortNumber.setText(_translate(
|
||||||
"iconGlossaryDialog",
|
"iconGlossaryDialog",
|
||||||
"You are using TCP port %1. (This can be changed in the settings)."
|
"You are using TCP port {0}."
|
||||||
).arg(config.getint('bitmessagesettings', 'port')))
|
" (This can be changed in the settings)."
|
||||||
self.setFixedSize(QtGui.QWidget.sizeHint(self))
|
).format(config.getint('bitmessagesettings', 'port')))
|
||||||
|
self.setFixedSize(QtWidgets.QWidget.sizeHint(self))
|
||||||
|
|
||||||
|
|
||||||
class HelpDialog(QtGui.QDialog, RetranslateMixin):
|
class HelpDialog(QtWidgets.QDialog, RetranslateMixin):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(HelpDialog, self).__init__(parent)
|
super(HelpDialog, self).__init__(parent)
|
||||||
widgets.load('help.ui', self)
|
widgets.load('help.ui', self)
|
||||||
self.setFixedSize(QtGui.QWidget.sizeHint(self))
|
self.setFixedSize(QtWidgets.QWidget.sizeHint(self))
|
||||||
|
|
||||||
|
|
||||||
class ConnectDialog(QtGui.QDialog, RetranslateMixin):
|
class ConnectDialog(QtWidgets.QDialog, RetranslateMixin):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(ConnectDialog, self).__init__(parent)
|
super(ConnectDialog, self).__init__(parent)
|
||||||
widgets.load('connect.ui', self)
|
widgets.load('connect.ui', self)
|
||||||
self.setFixedSize(QtGui.QWidget.sizeHint(self))
|
self.setFixedSize(QtWidgets.QWidget.sizeHint(self))
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from qtpy import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
from tr import _translate
|
from tr import _translate
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from helper_sql import *
|
from helper_sql import sqlQuery, sqlExecute
|
||||||
from utils import avatarize
|
from utils import avatarize
|
||||||
from settingsmixin import SettingsMixin
|
from settingsmixin import SettingsMixin
|
||||||
|
|
||||||
|
@ -29,13 +29,13 @@ class AccountMixin(object):
|
||||||
elif self.type in [self.MAILINGLIST, self.SUBSCRIPTION]:
|
elif self.type in [self.MAILINGLIST, self.SUBSCRIPTION]:
|
||||||
return QtGui.QColor(137, 04, 177)
|
return QtGui.QColor(137, 04, 177)
|
||||||
else:
|
else:
|
||||||
return QtGui.QApplication.palette().text().color()
|
return QtWidgets.QApplication.palette().text().color()
|
||||||
|
|
||||||
def folderColor(self):
|
def folderColor(self):
|
||||||
if not self.parent().isEnabled:
|
if not self.parent().isEnabled:
|
||||||
return QtGui.QColor(128, 128, 128)
|
return QtGui.QColor(128, 128, 128)
|
||||||
else:
|
else:
|
||||||
return QtGui.QApplication.palette().text().color()
|
return QtWidgets.QApplication.palette().text().color()
|
||||||
|
|
||||||
def accountBrush(self):
|
def accountBrush(self):
|
||||||
brush = QtGui.QBrush(self.accountColor())
|
brush = QtGui.QBrush(self.accountColor())
|
||||||
|
@ -60,7 +60,7 @@ class AccountMixin(object):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
self.unreadCount = int(cnt)
|
self.unreadCount = int(cnt)
|
||||||
if isinstance(self, QtGui.QTreeWidgetItem):
|
if isinstance(self, QtWidgets.QTreeWidgetItem):
|
||||||
self.emitDataChanged()
|
self.emitDataChanged()
|
||||||
|
|
||||||
def setEnabled(self, enabled):
|
def setEnabled(self, enabled):
|
||||||
|
@ -73,7 +73,7 @@ class AccountMixin(object):
|
||||||
for i in range(self.childCount()):
|
for i in range(self.childCount()):
|
||||||
if isinstance(self.child(i), Ui_FolderWidget):
|
if isinstance(self.child(i), Ui_FolderWidget):
|
||||||
self.child(i).setEnabled(enabled)
|
self.child(i).setEnabled(enabled)
|
||||||
if isinstance(self, QtGui.QTreeWidgetItem):
|
if isinstance(self, QtWidgets.QTreeWidgetItem):
|
||||||
self.emitDataChanged()
|
self.emitDataChanged()
|
||||||
|
|
||||||
def setType(self):
|
def setType(self):
|
||||||
|
@ -86,7 +86,9 @@ class AccountMixin(object):
|
||||||
elif BMConfigParser().safeGetBoolean(self.address, 'mailinglist'):
|
elif BMConfigParser().safeGetBoolean(self.address, 'mailinglist'):
|
||||||
self.type = self.MAILINGLIST
|
self.type = self.MAILINGLIST
|
||||||
elif sqlQuery(
|
elif sqlQuery(
|
||||||
'''select label from subscriptions where address=?''', self.address):
|
'''select label from subscriptions where address=?''',
|
||||||
|
self.address
|
||||||
|
):
|
||||||
self.type = AccountMixin.SUBSCRIPTION
|
self.type = AccountMixin.SUBSCRIPTION
|
||||||
else:
|
else:
|
||||||
self.type = self.NORMAL
|
self.type = self.NORMAL
|
||||||
|
@ -100,20 +102,23 @@ class AccountMixin(object):
|
||||||
try:
|
try:
|
||||||
retval = unicode(
|
retval = unicode(
|
||||||
BMConfigParser().get(self.address, 'label'), 'utf-8')
|
BMConfigParser().get(self.address, 'label'), 'utf-8')
|
||||||
except Exception as e:
|
except Exception:
|
||||||
queryreturn = sqlQuery(
|
queryreturn = sqlQuery(
|
||||||
'''select label from addressbook where address=?''', self.address)
|
'''select label from addressbook where address=?''',
|
||||||
|
self.address
|
||||||
|
)
|
||||||
elif self.type == AccountMixin.SUBSCRIPTION:
|
elif self.type == AccountMixin.SUBSCRIPTION:
|
||||||
queryreturn = sqlQuery(
|
queryreturn = sqlQuery(
|
||||||
'''select label from subscriptions where address=?''', self.address)
|
'''select label from subscriptions where address=?''',
|
||||||
|
self.address
|
||||||
|
)
|
||||||
if queryreturn is not None:
|
if queryreturn is not None:
|
||||||
if queryreturn != []:
|
if queryreturn != []:
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
retval, = row
|
retval, = row
|
||||||
retval = unicode(retval, 'utf-8')
|
retval = unicode(retval, 'utf-8')
|
||||||
elif self.address is None or self.type == AccountMixin.ALL:
|
elif self.address is None or self.type == AccountMixin.ALL:
|
||||||
return unicode(
|
return _translate("MainWindow", "All accounts")
|
||||||
str(_translate("MainWindow", "All accounts")), 'utf-8')
|
|
||||||
|
|
||||||
return retval or unicode(self.address, 'utf-8')
|
return retval or unicode(self.address, 'utf-8')
|
||||||
|
|
||||||
|
@ -202,8 +207,7 @@ class Ui_AddressWidget(BMTreeWidgetItem, SettingsMixin):
|
||||||
|
|
||||||
def _getLabel(self):
|
def _getLabel(self):
|
||||||
if self.address is None:
|
if self.address is None:
|
||||||
return unicode(_translate(
|
return _translate("MainWindow", "All accounts")
|
||||||
"MainWindow", "All accounts").toUtf8(), 'utf-8', 'ignore')
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
return unicode(
|
return unicode(
|
||||||
|
@ -232,10 +236,7 @@ class Ui_AddressWidget(BMTreeWidgetItem, SettingsMixin):
|
||||||
if role == QtCore.Qt.EditRole \
|
if role == QtCore.Qt.EditRole \
|
||||||
and self.type != AccountMixin.SUBSCRIPTION:
|
and self.type != AccountMixin.SUBSCRIPTION:
|
||||||
BMConfigParser().set(
|
BMConfigParser().set(
|
||||||
str(self.address), 'label',
|
str(self.address), 'label', value.encode('utf-8'))
|
||||||
str(value).toString().toUtf8()
|
|
||||||
if isinstance(value, QtCore.QVariant) else str(value)
|
|
||||||
)
|
|
||||||
BMConfigParser().save()
|
BMConfigParser().save()
|
||||||
return super(Ui_AddressWidget, self).setData(column, role, value)
|
return super(Ui_AddressWidget, self).setData(column, role, value)
|
||||||
|
|
||||||
|
@ -260,7 +261,8 @@ class Ui_AddressWidget(BMTreeWidgetItem, SettingsMixin):
|
||||||
if self._getSortRank() < other._getSortRank() else reverse
|
if self._getSortRank() < other._getSortRank() else reverse
|
||||||
)
|
)
|
||||||
|
|
||||||
return super(QtGui.QTreeWidgetItem, self).__lt__(other)
|
return super(Ui_AddressWidget, self).__lt__(other)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Ui_SubscriptionWidget(Ui_AddressWidget):
|
class Ui_SubscriptionWidget(Ui_AddressWidget):
|
||||||
|
@ -272,7 +274,8 @@ class Ui_SubscriptionWidget(Ui_AddressWidget):
|
||||||
|
|
||||||
def _getLabel(self):
|
def _getLabel(self):
|
||||||
queryreturn = sqlQuery(
|
queryreturn = sqlQuery(
|
||||||
'''select label from subscriptions where address=?''', self.address)
|
'''select label from subscriptions where address=?''',
|
||||||
|
self.address)
|
||||||
if queryreturn != []:
|
if queryreturn != []:
|
||||||
for row in queryreturn:
|
for row in queryreturn:
|
||||||
retval, = row
|
retval, = row
|
||||||
|
@ -285,14 +288,9 @@ class Ui_SubscriptionWidget(Ui_AddressWidget):
|
||||||
|
|
||||||
def setData(self, column, role, value):
|
def setData(self, column, role, value):
|
||||||
if role == QtCore.Qt.EditRole:
|
if role == QtCore.Qt.EditRole:
|
||||||
if isinstance(value, QtCore.QVariant):
|
|
||||||
label = str(
|
|
||||||
value.toString().toUtf8()).decode('utf-8', 'ignore')
|
|
||||||
else:
|
|
||||||
label = unicode(value, 'utf-8', 'ignore')
|
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE subscriptions SET label=? WHERE address=?''',
|
'''UPDATE subscriptions SET label=? WHERE address=?''',
|
||||||
label, self.address)
|
value, self.address)
|
||||||
return super(Ui_SubscriptionWidget, self).setData(column, role, value)
|
return super(Ui_SubscriptionWidget, self).setData(column, role, value)
|
||||||
|
|
||||||
|
|
||||||
|
@ -390,7 +388,7 @@ class MessageList_AddressWidget(BMAddressWidget):
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
if isinstance(other, MessageList_AddressWidget):
|
if isinstance(other, MessageList_AddressWidget):
|
||||||
return self.label.lower() < other.label.lower()
|
return self.label.lower() < other.label.lower()
|
||||||
return super(QtGui.QTableWidgetItem, self).__lt__(other)
|
return super(MessageList_AddressWidget, self).__lt__(other)
|
||||||
|
|
||||||
|
|
||||||
class MessageList_SubjectWidget(BMTableWidgetItem):
|
class MessageList_SubjectWidget(BMTableWidgetItem):
|
||||||
|
@ -413,7 +411,7 @@ class MessageList_SubjectWidget(BMTableWidgetItem):
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
if isinstance(other, MessageList_SubjectWidget):
|
if isinstance(other, MessageList_SubjectWidget):
|
||||||
return self.label.lower() < other.label.lower()
|
return self.label.lower() < other.label.lower()
|
||||||
return super(QtGui.QTableWidgetItem, self).__lt__(other)
|
return super(MessageList_SubjectWidget, self).__lt__(other)
|
||||||
|
|
||||||
|
|
||||||
class Ui_AddressBookWidgetItem(BMAddressWidget):
|
class Ui_AddressBookWidgetItem(BMAddressWidget):
|
||||||
|
@ -428,10 +426,7 @@ class Ui_AddressBookWidgetItem(BMAddressWidget):
|
||||||
|
|
||||||
def setData(self, role, value):
|
def setData(self, role, value):
|
||||||
if role == QtCore.Qt.EditRole:
|
if role == QtCore.Qt.EditRole:
|
||||||
self.label = str(
|
self.label = value.encode('utf-8')
|
||||||
value.toString().toUtf8()
|
|
||||||
if isinstance(value, QtCore.QVariant) else value
|
|
||||||
)
|
|
||||||
if self.type in (
|
if self.type in (
|
||||||
AccountMixin.NORMAL,
|
AccountMixin.NORMAL,
|
||||||
AccountMixin.MAILINGLIST, AccountMixin.CHAN):
|
AccountMixin.MAILINGLIST, AccountMixin.CHAN):
|
||||||
|
@ -440,9 +435,14 @@ class Ui_AddressBookWidgetItem(BMAddressWidget):
|
||||||
BMConfigParser().set(self.address, 'label', self.label)
|
BMConfigParser().set(self.address, 'label', self.label)
|
||||||
BMConfigParser().save()
|
BMConfigParser().save()
|
||||||
except:
|
except:
|
||||||
sqlExecute('''UPDATE addressbook set label=? WHERE address=?''', self.label, self.address)
|
sqlExecute(
|
||||||
|
'''UPDATE addressbook set label=? WHERE address=?''',
|
||||||
|
self.label, self.address
|
||||||
|
)
|
||||||
elif self.type == AccountMixin.SUBSCRIPTION:
|
elif self.type == AccountMixin.SUBSCRIPTION:
|
||||||
sqlExecute('''UPDATE subscriptions set label=? WHERE address=?''', self.label, self.address)
|
sqlExecute(
|
||||||
|
'''UPDATE subscriptions set label=? WHERE address=?''',
|
||||||
|
self.label, self.address)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
return super(Ui_AddressBookWidgetItem, self).setData(role, value)
|
return super(Ui_AddressBookWidgetItem, self).setData(role, value)
|
||||||
|
@ -456,7 +456,7 @@ class Ui_AddressBookWidgetItem(BMAddressWidget):
|
||||||
return self.label.lower() < other.label.lower()
|
return self.label.lower() < other.label.lower()
|
||||||
else:
|
else:
|
||||||
return (not reverse if self.type < other.type else reverse)
|
return (not reverse if self.type < other.type else reverse)
|
||||||
return super(QtGui.QTableWidgetItem, self).__lt__(other)
|
return super(Ui_AddressBookWidgetItem, self).__lt__(other)
|
||||||
|
|
||||||
|
|
||||||
class Ui_AddressBookWidgetItemLabel(Ui_AddressBookWidgetItem):
|
class Ui_AddressBookWidgetItemLabel(Ui_AddressBookWidgetItem):
|
||||||
|
@ -483,7 +483,7 @@ class Ui_AddressBookWidgetItemAddress(Ui_AddressBookWidgetItem):
|
||||||
return super(Ui_AddressBookWidgetItemAddress, self).data(role)
|
return super(Ui_AddressBookWidgetItemAddress, self).data(role)
|
||||||
|
|
||||||
|
|
||||||
class AddressBookCompleter(QtGui.QCompleter):
|
class AddressBookCompleter(QtWidgets.QCompleter):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(AddressBookCompleter, self).__init__()
|
super(AddressBookCompleter, self).__init__()
|
||||||
self.cursorPos = -1
|
self.cursorPos = -1
|
||||||
|
@ -493,13 +493,11 @@ class AddressBookCompleter(QtGui.QCompleter):
|
||||||
self.cursorPos = -1
|
self.cursorPos = -1
|
||||||
|
|
||||||
def splitPath(self, path):
|
def splitPath(self, path):
|
||||||
text = unicode(path.toUtf8(), 'utf-8')
|
return [path[:self.widget().cursorPosition()].split(';')[-1].strip()]
|
||||||
return [text[:self.widget().cursorPosition()].split(';')[-1].strip()]
|
|
||||||
|
|
||||||
def pathFromIndex(self, index):
|
def pathFromIndex(self, index):
|
||||||
autoString = unicode(
|
autoString = index.data(QtCore.Qt.EditRole).toString()
|
||||||
index.data(QtCore.Qt.EditRole).toString().toUtf8(), 'utf-8')
|
text = self.widget().text()
|
||||||
text = unicode(self.widget().text().toUtf8(), 'utf-8')
|
|
||||||
|
|
||||||
# If cursor position was saved, restore it, else save it
|
# If cursor position was saved, restore it, else save it
|
||||||
if self.cursorPos != -1:
|
if self.cursorPos != -1:
|
||||||
|
@ -528,7 +526,6 @@ class AddressBookCompleter(QtGui.QCompleter):
|
||||||
|
|
||||||
# Get string value from before auto finished string is selected
|
# Get string value from before auto finished string is selected
|
||||||
# pre = text[prevDelimiterIndex + 1:curIndex - 1]
|
# pre = text[prevDelimiterIndex + 1:curIndex - 1]
|
||||||
|
|
||||||
# Get part of string that occurs AFTER cursor
|
# Get part of string that occurs AFTER cursor
|
||||||
part2 = text[nextDelimiterIndex:]
|
part2 = text[nextDelimiterIndex:]
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,48 @@
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
from PyQt4 import QtCore, QtGui
|
from qtpy import QtCore, QtWidgets
|
||||||
|
from tr import _translate
|
||||||
|
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
import paths
|
import paths
|
||||||
|
|
||||||
class LanguageBox(QtGui.QComboBox):
|
|
||||||
languageName = {"system": "System Settings", "eo": "Esperanto", "en_pirate": "Pirate English"}
|
class LanguageBox(QtWidgets.QComboBox):
|
||||||
def __init__(self, parent = None):
|
languageName = {
|
||||||
super(QtGui.QComboBox, self).__init__(parent)
|
"system": "System Settings",
|
||||||
|
"eo": "Esperanto",
|
||||||
|
"en_pirate": "Pirate English"
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super(LanguageBox, self).__init__(parent)
|
||||||
self.populate()
|
self.populate()
|
||||||
|
|
||||||
def populate(self):
|
def populate(self):
|
||||||
self.languages = []
|
self.languages = []
|
||||||
self.clear()
|
self.clear()
|
||||||
localesPath = os.path.join (paths.codePath(), 'translations')
|
localesPath = os.path.join(paths.codePath(), 'translations')
|
||||||
configuredLocale = "system"
|
configuredLocale = "system"
|
||||||
try:
|
try:
|
||||||
configuredLocale = BMConfigParser().get('bitmessagesettings', 'userlocale', "system")
|
configuredLocale = BMConfigParser().get(
|
||||||
|
'bitmessagesettings', 'userlocale', "system")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self.addItem(QtGui.QApplication.translate("settingsDialog", "System Settings", "system"), "system")
|
self.addItem(
|
||||||
|
_translate("settingsDialog", "System Settings", "system"),
|
||||||
|
"system"
|
||||||
|
)
|
||||||
self.setCurrentIndex(0)
|
self.setCurrentIndex(0)
|
||||||
self.setInsertPolicy(QtGui.QComboBox.InsertAlphabetically)
|
self.setInsertPolicy(QtWidgets.QComboBox.InsertAlphabetically)
|
||||||
for translationFile in sorted(glob.glob(os.path.join(localesPath, "bitmessage_*.qm"))):
|
for translationFile in sorted(
|
||||||
localeShort = os.path.split(translationFile)[1].split("_", 1)[1][:-3]
|
glob.glob(os.path.join(localesPath, "bitmessage_*.qm"))
|
||||||
locale = QtCore.QLocale(QtCore.QString(localeShort))
|
):
|
||||||
|
localeShort = \
|
||||||
|
os.path.split(translationFile)[1].split("_", 1)[1][:-3]
|
||||||
|
locale = QtCore.QLocale(localeShort)
|
||||||
if localeShort in LanguageBox.languageName:
|
if localeShort in LanguageBox.languageName:
|
||||||
self.addItem(LanguageBox.languageName[localeShort], localeShort)
|
self.addItem(
|
||||||
|
LanguageBox.languageName[localeShort], localeShort)
|
||||||
elif locale.nativeLanguageName() == "":
|
elif locale.nativeLanguageName() == "":
|
||||||
self.addItem(localeShort, localeShort)
|
self.addItem(localeShort, localeShort)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,20 +1,28 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from qtpy import QtCore, QtWidgets
|
||||||
|
from tr import _translate
|
||||||
|
|
||||||
class MessageCompose(QtGui.QTextEdit):
|
|
||||||
|
class MessageCompose(QtWidgets.QTextEdit):
|
||||||
def __init__(self, parent = 0):
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
super(MessageCompose, self).__init__(parent)
|
super(MessageCompose, self).__init__(parent)
|
||||||
self.setAcceptRichText(False) # we'll deal with this later when we have a new message format
|
# we'll deal with this later when we have a new message format
|
||||||
|
self.setAcceptRichText(False)
|
||||||
self.defaultFontPointSize = self.currentFont().pointSize()
|
self.defaultFontPointSize = self.currentFont().pointSize()
|
||||||
|
|
||||||
def wheelEvent(self, event):
|
def wheelEvent(self, event):
|
||||||
if (QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
|
if (
|
||||||
|
(QtWidgets.QApplication.queryKeyboardModifiers()
|
||||||
|
& QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier
|
||||||
|
and event.orientation() == QtCore.Qt.Vertical
|
||||||
|
):
|
||||||
if event.delta() > 0:
|
if event.delta() > 0:
|
||||||
self.zoomIn(1)
|
self.zoomIn(1)
|
||||||
else:
|
else:
|
||||||
self.zoomOut(1)
|
self.zoomOut(1)
|
||||||
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
|
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
|
||||||
QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg(str(zoom)))
|
QtWidgets.QApplication.activeWindow().statusbar.showMessage(
|
||||||
|
_translate("MainWindow", "Zoom level {0}%").format(zoom))
|
||||||
else:
|
else:
|
||||||
# in QTextEdit, super does not zoom, only scroll
|
# in QTextEdit, super does not zoom, only scroll
|
||||||
super(MessageCompose, self).wheelEvent(event)
|
super(MessageCompose, self).wheelEvent(event)
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from qtpy import QtCore, QtGui, QtWidgets
|
||||||
|
from tr import _translate
|
||||||
|
|
||||||
import multiprocessing
|
from safehtmlparser import SafeHTMLParser
|
||||||
import Queue
|
|
||||||
from urlparse import urlparse
|
|
||||||
from safehtmlparser import *
|
|
||||||
|
|
||||||
class MessageView(QtGui.QTextBrowser):
|
|
||||||
|
class MessageView(QtWidgets.QTextBrowser):
|
||||||
MODE_PLAIN = 0
|
MODE_PLAIN = 0
|
||||||
MODE_HTML = 1
|
MODE_HTML = 1
|
||||||
|
|
||||||
def __init__(self, parent = 0):
|
def __init__(self, parent=None):
|
||||||
super(MessageView, self).__init__(parent)
|
super(MessageView, self).__init__(parent)
|
||||||
self.mode = MessageView.MODE_PLAIN
|
self.mode = MessageView.MODE_PLAIN
|
||||||
self.html = None
|
self.html = None
|
||||||
self.setOpenExternalLinks(False)
|
self.setOpenExternalLinks(False)
|
||||||
self.setOpenLinks(False)
|
self.setOpenLinks(False)
|
||||||
|
@ -27,10 +26,14 @@ class MessageView(QtGui.QTextBrowser):
|
||||||
def resizeEvent(self, event):
|
def resizeEvent(self, event):
|
||||||
super(MessageView, self).resizeEvent(event)
|
super(MessageView, self).resizeEvent(event)
|
||||||
self.setWrappingWidth(event.size().width())
|
self.setWrappingWidth(event.size().width())
|
||||||
|
|
||||||
def mousePressEvent(self, event):
|
def mousePressEvent(self, event):
|
||||||
#text = textCursor.block().text()
|
# text = textCursor.block().text()
|
||||||
if event.button() == QtCore.Qt.LeftButton and self.html and self.html.has_html and self.cursorForPosition(event.pos()).block().blockNumber() == 0:
|
if (
|
||||||
|
event.button() == QtCore.Qt.LeftButton and self.html
|
||||||
|
and self.html.has_html
|
||||||
|
and self.cursorForPosition(event.pos()).block().blockNumber() == 0
|
||||||
|
):
|
||||||
if self.mode == MessageView.MODE_PLAIN:
|
if self.mode == MessageView.MODE_PLAIN:
|
||||||
self.showHTML()
|
self.showHTML()
|
||||||
else:
|
else:
|
||||||
|
@ -41,19 +44,24 @@ class MessageView(QtGui.QTextBrowser):
|
||||||
def wheelEvent(self, event):
|
def wheelEvent(self, event):
|
||||||
# super will actually automatically take care of zooming
|
# super will actually automatically take care of zooming
|
||||||
super(MessageView, self).wheelEvent(event)
|
super(MessageView, self).wheelEvent(event)
|
||||||
if (QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
|
if (
|
||||||
|
(QtWidgets.QApplication.queryKeyboardModifiers()
|
||||||
|
& QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier
|
||||||
|
and event.orientation() == QtCore.Qt.Vertical
|
||||||
|
):
|
||||||
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
|
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
|
||||||
QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg(str(zoom)))
|
QtWidgets.QApplication.activeWindow().statusbar.showMessage(
|
||||||
|
_translate("MainWindow", "Zoom level {0}%").format(zoom))
|
||||||
|
|
||||||
def setWrappingWidth(self, width=None):
|
def setWrappingWidth(self, width=None):
|
||||||
self.setLineWrapMode(QtGui.QTextEdit.FixedPixelWidth)
|
self.setLineWrapMode(QtWidgets.QTextEdit.FixedPixelWidth)
|
||||||
if width is None:
|
if width is None:
|
||||||
width = self.width()
|
width = self.width()
|
||||||
self.setLineWrapColumnOrWidth(width)
|
self.setLineWrapColumnOrWidth(width)
|
||||||
|
|
||||||
def confirmURL(self, link):
|
def confirmURL(self, link):
|
||||||
if link.scheme() == "mailto":
|
if link.scheme() == "mailto":
|
||||||
window = QtGui.QApplication.activeWindow()
|
window = QtWidgets.QApplication.activeWindow()
|
||||||
window.ui.lineEditTo.setText(link.path())
|
window.ui.lineEditTo.setText(link.path())
|
||||||
if link.hasQueryItem("subject"):
|
if link.hasQueryItem("subject"):
|
||||||
window.ui.lineEditSubject.setText(
|
window.ui.lineEditSubject.setText(
|
||||||
|
@ -68,27 +76,24 @@ class MessageView(QtGui.QTextBrowser):
|
||||||
)
|
)
|
||||||
window.ui.textEditMessage.setFocus()
|
window.ui.textEditMessage.setFocus()
|
||||||
return
|
return
|
||||||
reply = QtGui.QMessageBox.warning(self,
|
reply = QtWidgets.QMessageBox.warning(
|
||||||
QtGui.QApplication.translate("MessageView", "Follow external link"),
|
self, _translate("MessageView", "Follow external link"),
|
||||||
QtGui.QApplication.translate("MessageView", "The link \"%1\" will open in a browser. It may be a security risk, it could de-anonymise you or download malicious data. Are you sure?").arg(unicode(link.toString())),
|
_translate(
|
||||||
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
|
"MessageView",
|
||||||
if reply == QtGui.QMessageBox.Yes:
|
"The link \"{0}\" will open in a browser. It may be"
|
||||||
|
" a security risk, it could de-anonymise you or download"
|
||||||
|
" malicious data. Are you sure?"
|
||||||
|
).format(link.toString()),
|
||||||
|
QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)
|
||||||
|
if reply == QtWidgets.QMessageBox.Yes:
|
||||||
QtGui.QDesktopServices.openUrl(link)
|
QtGui.QDesktopServices.openUrl(link)
|
||||||
|
|
||||||
def loadResource (self, restype, name):
|
def loadResource(self, restype, name):
|
||||||
if restype == QtGui.QTextDocument.ImageResource and name.scheme() == "bmmsg":
|
if restype == QtGui.QTextDocument.ImageResource \
|
||||||
|
and name.scheme() == "bmmsg":
|
||||||
pass
|
pass
|
||||||
# QImage correctImage;
|
|
||||||
# lookup the correct QImage from a cache
|
|
||||||
# return QVariant::fromValue(correctImage);
|
|
||||||
# elif restype == QtGui.QTextDocument.HtmlResource:
|
|
||||||
# elif restype == QtGui.QTextDocument.ImageResource:
|
|
||||||
# elif restype == QtGui.QTextDocument.StyleSheetResource:
|
|
||||||
# elif restype == QtGui.QTextDocument.UserResource:
|
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
# by default, this will interpret it as a local file
|
|
||||||
# QtGui.QTextBrowser.loadResource(restype, name)
|
|
||||||
|
|
||||||
def lazyRender(self):
|
def lazyRender(self):
|
||||||
if self.rendering:
|
if self.rendering:
|
||||||
|
@ -96,7 +101,11 @@ class MessageView(QtGui.QTextBrowser):
|
||||||
self.rendering = True
|
self.rendering = True
|
||||||
position = self.verticalScrollBar().value()
|
position = self.verticalScrollBar().value()
|
||||||
cursor = QtGui.QTextCursor(self.document())
|
cursor = QtGui.QTextCursor(self.document())
|
||||||
while self.outpos < len(self.out) and self.verticalScrollBar().value() >= self.document().size().height() - 2 * self.size().height():
|
while (
|
||||||
|
self.outpos < len(self.out) and
|
||||||
|
self.verticalScrollBar().value() >=
|
||||||
|
self.document().size().height() - 2 * self.size().height()
|
||||||
|
):
|
||||||
startpos = self.outpos
|
startpos = self.outpos
|
||||||
self.outpos += 10240
|
self.outpos += 10240
|
||||||
# find next end of tag
|
# find next end of tag
|
||||||
|
@ -104,16 +113,20 @@ class MessageView(QtGui.QTextBrowser):
|
||||||
pos = self.out.find(">", self.outpos)
|
pos = self.out.find(">", self.outpos)
|
||||||
if pos > self.outpos:
|
if pos > self.outpos:
|
||||||
self.outpos = pos + 1
|
self.outpos = pos + 1
|
||||||
cursor.movePosition(QtGui.QTextCursor.End, QtGui.QTextCursor.MoveAnchor)
|
cursor.movePosition(
|
||||||
cursor.insertHtml(QtCore.QString(self.out[startpos:self.outpos]))
|
QtGui.QTextCursor.End, QtGui.QTextCursor.MoveAnchor)
|
||||||
|
cursor.insertHtml(self.out[startpos:self.outpos])
|
||||||
self.verticalScrollBar().setValue(position)
|
self.verticalScrollBar().setValue(position)
|
||||||
self.rendering = False
|
self.rendering = False
|
||||||
|
|
||||||
def showPlain(self):
|
def showPlain(self):
|
||||||
self.mode = MessageView.MODE_PLAIN
|
self.mode = MessageView.MODE_PLAIN
|
||||||
out = self.html.raw
|
out = self.html.raw
|
||||||
if self.html.has_html:
|
if self.html.has_html:
|
||||||
out = "<div align=\"center\" style=\"text-decoration: underline;\"><b>" + unicode(QtGui.QApplication.translate("MessageView", "HTML detected, click here to display")) + "</b></div><br/>" + out
|
out = "<div align=\"center\" style=\"text-decoration: underline;\"><b>" \
|
||||||
|
+ _translate(
|
||||||
|
"MessageView", "HTML detected, click here to display") \
|
||||||
|
+ "</b></div><br/>" + out
|
||||||
self.out = out
|
self.out = out
|
||||||
self.outpos = 0
|
self.outpos = 0
|
||||||
self.setHtml("")
|
self.setHtml("")
|
||||||
|
@ -122,7 +135,10 @@ class MessageView(QtGui.QTextBrowser):
|
||||||
def showHTML(self):
|
def showHTML(self):
|
||||||
self.mode = MessageView.MODE_HTML
|
self.mode = MessageView.MODE_HTML
|
||||||
out = self.html.sanitised
|
out = self.html.sanitised
|
||||||
out = "<div align=\"center\" style=\"text-decoration: underline;\"><b>" + unicode(QtGui.QApplication.translate("MessageView", "Click here to disable HTML")) + "</b></div><br/>" + out
|
out = \
|
||||||
|
"<div align=\"center\" style=\"text-decoration: underline;\"><b>" \
|
||||||
|
+ _translate("MessageView", "Click here to disable HTML") \
|
||||||
|
+ "</b></div><br/>" + out
|
||||||
self.out = out
|
self.out = out
|
||||||
self.outpos = 0
|
self.outpos = 0
|
||||||
self.setHtml("")
|
self.setHtml("")
|
||||||
|
@ -130,8 +146,6 @@ class MessageView(QtGui.QTextBrowser):
|
||||||
|
|
||||||
def setContent(self, data):
|
def setContent(self, data):
|
||||||
self.html = SafeHTMLParser()
|
self.html = SafeHTMLParser()
|
||||||
self.html.reset()
|
|
||||||
self.html.reset_safe()
|
|
||||||
self.html.allow_picture = True
|
self.html.allow_picture = True
|
||||||
self.html.feed(data)
|
self.html.feed(data)
|
||||||
self.html.close()
|
self.html.close()
|
||||||
|
|
|
@ -1,42 +1,45 @@
|
||||||
#!/usr/bin/env python2.7
|
from qtpy import QtGui, QtWidgets
|
||||||
from PyQt4 import QtCore, QtGui
|
|
||||||
|
|
||||||
class MigrationWizardIntroPage(QtGui.QWizardPage):
|
|
||||||
|
class MigrationWizardIntroPage(QtWidgets.QWizardPage):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(QtGui.QWizardPage, self).__init__()
|
super(MigrationWizardIntroPage, self).__init__()
|
||||||
self.setTitle("Migrating configuration")
|
self.setTitle("Migrating configuration")
|
||||||
|
|
||||||
label = QtGui.QLabel("This wizard will help you to migrate your configuration. "
|
label = QtWidgets.QLabel("This wizard will help you to migrate your configuration. "
|
||||||
"You can still keep using PyBitMessage once you migrate, the changes are backwards compatible.")
|
"You can still keep using PyBitMessage once you migrate, the changes are backwards compatible.")
|
||||||
label.setWordWrap(True)
|
label.setWordWrap(True)
|
||||||
|
|
||||||
layout = QtGui.QVBoxLayout()
|
layout = QtWidgets.QVBoxLayout()
|
||||||
layout.addWidget(label)
|
layout.addWidget(label)
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
def nextId(self):
|
def nextId(self):
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
class MigrationWizardAddressesPage(QtGui.QWizardPage):
|
|
||||||
|
class MigrationWizardAddressesPage(QtWidgets.QWizardPage):
|
||||||
def __init__(self, addresses):
|
def __init__(self, addresses):
|
||||||
super(QtGui.QWizardPage, self).__init__()
|
super(MigrationWizardAddressesPage, self).__init__()
|
||||||
self.setTitle("Addresses")
|
self.setTitle("Addresses")
|
||||||
|
|
||||||
label = QtGui.QLabel("Please select addresses that you are already using with mailchuck. ")
|
label = QtWidgets.QLabel(
|
||||||
|
"Please select addresses that you are already using"
|
||||||
|
" with mailchuck. "
|
||||||
|
)
|
||||||
label.setWordWrap(True)
|
label.setWordWrap(True)
|
||||||
|
|
||||||
layout = QtGui.QVBoxLayout()
|
layout = QtGui.QVBoxLayout()
|
||||||
layout.addWidget(label)
|
layout.addWidget(label)
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
def nextId(self):
|
def nextId(self):
|
||||||
return 10
|
return 10
|
||||||
|
|
||||||
|
|
||||||
class MigrationWizardGPUPage(QtGui.QWizardPage):
|
|
||||||
|
class MigrationWizardGPUPage(QtWidgets.QWizardPage):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(QtGui.QWizardPage, self).__init__()
|
super(MigrationWizardGPUPage, self).__init__()
|
||||||
self.setTitle("GPU")
|
self.setTitle("GPU")
|
||||||
|
|
||||||
label = QtGui.QLabel("Are you using a GPU? ")
|
label = QtGui.QLabel("Are you using a GPU? ")
|
||||||
|
@ -45,30 +48,30 @@ class MigrationWizardGPUPage(QtGui.QWizardPage):
|
||||||
layout = QtGui.QVBoxLayout()
|
layout = QtGui.QVBoxLayout()
|
||||||
layout.addWidget(label)
|
layout.addWidget(label)
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
def nextId(self):
|
def nextId(self):
|
||||||
return 10
|
return 10
|
||||||
|
|
||||||
|
|
||||||
class MigrationWizardConclusionPage(QtGui.QWizardPage):
|
|
||||||
|
class MigrationWizardConclusionPage(QtWidgets.QWizardPage):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(QtGui.QWizardPage, self).__init__()
|
super(MigrationWizardConclusionPage, self).__init__()
|
||||||
self.setTitle("All done!")
|
self.setTitle("All done!")
|
||||||
|
|
||||||
label = QtGui.QLabel("You successfully migrated.")
|
label = QtWidgets.QLabel("You successfully migrated.")
|
||||||
label.setWordWrap(True)
|
label.setWordWrap(True)
|
||||||
|
|
||||||
layout = QtGui.QVBoxLayout()
|
layout = QtWidgets.QVBoxLayout()
|
||||||
layout.addWidget(label)
|
layout.addWidget(label)
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
|
|
||||||
|
|
||||||
class Ui_MigrationWizard(QtGui.QWizard):
|
class Ui_MigrationWizard(QtWidgets.QWizard):
|
||||||
def __init__(self, addresses):
|
def __init__(self, addresses):
|
||||||
super(QtGui.QWizard, self).__init__()
|
super(Ui_MigrationWizard, self).__init__()
|
||||||
|
|
||||||
self.pages = {}
|
self.pages = {}
|
||||||
|
|
||||||
page = MigrationWizardIntroPage()
|
page = MigrationWizardIntroPage()
|
||||||
self.setPage(0, page)
|
self.setPage(0, page)
|
||||||
self.setStartId(0)
|
self.setStartId(0)
|
||||||
|
@ -81,4 +84,4 @@ class Ui_MigrationWizard(QtGui.QWizard):
|
||||||
|
|
||||||
self.setWindowTitle("Migration from PyBitMessage wizard")
|
self.setWindowTitle("Migration from PyBitMessage wizard")
|
||||||
self.adjustSize()
|
self.adjustSize()
|
||||||
self.show()
|
self.show()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from qtpy import QtCore, QtGui, QtWidgets
|
||||||
import time
|
import time
|
||||||
import shared
|
import shared
|
||||||
|
|
||||||
|
@ -14,36 +14,39 @@ import widgets
|
||||||
from network.connectionpool import BMConnectionPool
|
from network.connectionpool import BMConnectionPool
|
||||||
|
|
||||||
|
|
||||||
class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
class NetworkStatus(QtWidgets.QWidget, RetranslateMixin):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(NetworkStatus, self).__init__(parent)
|
super(NetworkStatus, self).__init__(parent)
|
||||||
widgets.load('networkstatus.ui', self)
|
widgets.load('networkstatus.ui', self)
|
||||||
|
|
||||||
header = self.tableWidgetConnectionCount.horizontalHeader()
|
header = self.tableWidgetConnectionCount.horizontalHeader()
|
||||||
header.setResizeMode(QtGui.QHeaderView.ResizeToContents)
|
# header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
|
||||||
|
for column in range(0, 4):
|
||||||
|
header.setSectionResizeMode(
|
||||||
|
column, QtWidgets.QHeaderView.ResizeToContents)
|
||||||
|
|
||||||
# Somehow this value was 5 when I tested
|
# Somehow this value was 5 when I tested
|
||||||
if header.sortIndicatorSection() > 4:
|
if header.sortIndicatorSection() > 4:
|
||||||
header.setSortIndicator(0, QtCore.Qt.AscendingOrder)
|
header.setSortIndicator(0, QtCore.Qt.AscendingOrder)
|
||||||
|
|
||||||
self.startup = time.localtime()
|
self.startup = time.localtime()
|
||||||
self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg(
|
self.labelStartupTime.setText(
|
||||||
l10n.formatTimestamp(self.startup)))
|
_translate("networkstatus", "Since startup on {0}").format(
|
||||||
|
l10n.formatTimestamp(self.startup))
|
||||||
|
)
|
||||||
|
|
||||||
self.UISignalThread = UISignaler.get()
|
self.UISignalThread = UISignaler.get()
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.UISignalThread.updateNumberOfMessagesProcessed.connect(
|
||||||
"updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed)
|
self.updateNumberOfMessagesProcessed)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.UISignalThread.updateNumberOfPubkeysProcessed.connect(
|
||||||
"updateNumberOfPubkeysProcessed()"), self.updateNumberOfPubkeysProcessed)
|
self.updateNumberOfPubkeysProcessed)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.UISignalThread.updateNumberOfBroadcastsProcessed.connect(
|
||||||
"updateNumberOfBroadcastsProcessed()"), self.updateNumberOfBroadcastsProcessed)
|
self.updateNumberOfBroadcastsProcessed)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
self.UISignalThread.updateNetworkStatusTab.connect(
|
||||||
"updateNetworkStatusTab(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.updateNetworkStatusTab)
|
self.updateNetworkStatusTab)
|
||||||
|
|
||||||
self.timer = QtCore.QTimer()
|
self.timer = QtCore.QTimer()
|
||||||
|
self.timer.timeout.connect(self.runEveryTwoSeconds)
|
||||||
QtCore.QObject.connect(
|
|
||||||
self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
|
|
||||||
|
|
||||||
def startUpdate(self):
|
def startUpdate(self):
|
||||||
Inventory().numberOfInventoryLookupsPerformed = 0
|
Inventory().numberOfInventoryLookupsPerformed = 0
|
||||||
|
@ -54,7 +57,10 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
||||||
self.timer.stop()
|
self.timer.stop()
|
||||||
|
|
||||||
def formatBytes(self, num):
|
def formatBytes(self, num):
|
||||||
for x in [_translate("networkstatus", "byte(s)", None, QtCore.QCoreApplication.CodecForTr, num), "kB", "MB", "GB"]:
|
for x in [
|
||||||
|
_translate("networkstatus", "byte(s)", None, num),
|
||||||
|
"kB", "MB", "GB"
|
||||||
|
]:
|
||||||
if num < 1000.0:
|
if num < 1000.0:
|
||||||
return "%3.0f %s" % (num, x)
|
return "%3.0f %s" % (num, x)
|
||||||
num /= 1000.0
|
num /= 1000.0
|
||||||
|
@ -63,24 +69,31 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
||||||
def formatByteRate(self, num):
|
def formatByteRate(self, num):
|
||||||
num /= 1000
|
num /= 1000
|
||||||
return "%4.0f kB" % num
|
return "%4.0f kB" % num
|
||||||
|
|
||||||
def updateNumberOfObjectsToBeSynced(self):
|
def updateNumberOfObjectsToBeSynced(self):
|
||||||
self.labelSyncStatus.setText(_translate("networkstatus", "Object(s) to be synced: %n", None, QtCore.QCoreApplication.CodecForTr, network.stats.pendingDownload() + network.stats.pendingUpload()))
|
self.labelSyncStatus.setText(
|
||||||
|
_translate(
|
||||||
|
"networkstatus", "Object(s) to be synced: %n", None,
|
||||||
|
network.stats.pendingDownload() + network.stats.pendingUpload()
|
||||||
|
))
|
||||||
|
|
||||||
def updateNumberOfMessagesProcessed(self):
|
def updateNumberOfMessagesProcessed(self):
|
||||||
self.updateNumberOfObjectsToBeSynced()
|
self.updateNumberOfObjectsToBeSynced()
|
||||||
self.labelMessageCount.setText(_translate(
|
self.labelMessageCount.setText(_translate(
|
||||||
"networkstatus", "Processed %n person-to-person message(s).", None, QtCore.QCoreApplication.CodecForTr, shared.numberOfMessagesProcessed))
|
"networkstatus", "Processed %n person-to-person message(s).",
|
||||||
|
None, shared.numberOfMessagesProcessed))
|
||||||
|
|
||||||
def updateNumberOfBroadcastsProcessed(self):
|
def updateNumberOfBroadcastsProcessed(self):
|
||||||
self.updateNumberOfObjectsToBeSynced()
|
self.updateNumberOfObjectsToBeSynced()
|
||||||
self.labelBroadcastCount.setText(_translate(
|
self.labelBroadcastCount.setText(_translate(
|
||||||
"networkstatus", "Processed %n broadcast message(s).", None, QtCore.QCoreApplication.CodecForTr, shared.numberOfBroadcastsProcessed))
|
"networkstatus", "Processed %n broadcast message(s).", None,
|
||||||
|
shared.numberOfBroadcastsProcessed))
|
||||||
|
|
||||||
def updateNumberOfPubkeysProcessed(self):
|
def updateNumberOfPubkeysProcessed(self):
|
||||||
self.updateNumberOfObjectsToBeSynced()
|
self.updateNumberOfObjectsToBeSynced()
|
||||||
self.labelPubkeyCount.setText(_translate(
|
self.labelPubkeyCount.setText(_translate(
|
||||||
"networkstatus", "Processed %n public key(s).", None, QtCore.QCoreApplication.CodecForTr, shared.numberOfPubkeysProcessed))
|
"networkstatus", "Processed %n public key(s).", None,
|
||||||
|
shared.numberOfPubkeysProcessed))
|
||||||
|
|
||||||
def updateNumberOfBytes(self):
|
def updateNumberOfBytes(self):
|
||||||
"""
|
"""
|
||||||
|
@ -88,9 +101,16 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
||||||
sent and received by 2.
|
sent and received by 2.
|
||||||
"""
|
"""
|
||||||
self.labelBytesRecvCount.setText(_translate(
|
self.labelBytesRecvCount.setText(_translate(
|
||||||
"networkstatus", "Down: %1/s Total: %2").arg(self.formatByteRate(network.stats.downloadSpeed()), self.formatBytes(network.stats.receivedBytes())))
|
"networkstatus", "Down: {0}/s Total: {1}"
|
||||||
|
).format(
|
||||||
|
self.formatByteRate(network.stats.downloadSpeed()),
|
||||||
|
self.formatBytes(network.stats.receivedBytes())
|
||||||
|
))
|
||||||
self.labelBytesSentCount.setText(_translate(
|
self.labelBytesSentCount.setText(_translate(
|
||||||
"networkstatus", "Up: %1/s Total: %2").arg(self.formatByteRate(network.stats.uploadSpeed()), self.formatBytes(network.stats.sentBytes())))
|
"networkstatus", "Up: {0}/s Total: {1}").format(
|
||||||
|
self.formatByteRate(network.stats.uploadSpeed()),
|
||||||
|
self.formatBytes(network.stats.sentBytes())
|
||||||
|
))
|
||||||
|
|
||||||
def updateNetworkStatusTab(self, outbound, add, destination):
|
def updateNetworkStatusTab(self, outbound, add, destination):
|
||||||
if outbound:
|
if outbound:
|
||||||
|
@ -114,16 +134,16 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
||||||
if add:
|
if add:
|
||||||
self.tableWidgetConnectionCount.insertRow(0)
|
self.tableWidgetConnectionCount.insertRow(0)
|
||||||
self.tableWidgetConnectionCount.setItem(0, 0,
|
self.tableWidgetConnectionCount.setItem(0, 0,
|
||||||
QtGui.QTableWidgetItem("%s:%i" % (destination.host, destination.port))
|
QtWidgets.QTableWidgetItem("%s:%i" % (destination.host, destination.port))
|
||||||
)
|
)
|
||||||
self.tableWidgetConnectionCount.setItem(0, 2,
|
self.tableWidgetConnectionCount.setItem(0, 2,
|
||||||
QtGui.QTableWidgetItem("%s" % (c.userAgent))
|
QtWidgets.QTableWidgetItem("%s" % (c.userAgent))
|
||||||
)
|
)
|
||||||
self.tableWidgetConnectionCount.setItem(0, 3,
|
self.tableWidgetConnectionCount.setItem(0, 3,
|
||||||
QtGui.QTableWidgetItem("%s" % (c.tlsVersion))
|
QtWidgets.QTableWidgetItem("%s" % (c.tlsVersion))
|
||||||
)
|
)
|
||||||
self.tableWidgetConnectionCount.setItem(0, 4,
|
self.tableWidgetConnectionCount.setItem(0, 4,
|
||||||
QtGui.QTableWidgetItem("%s" % (",".join(map(str,c.streams))))
|
QtWidgets.QTableWidgetItem("%s" % (",".join(map(str,c.streams))))
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
# FIXME hard coded stream no
|
# FIXME hard coded stream no
|
||||||
|
@ -131,7 +151,7 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
rating = "-"
|
rating = "-"
|
||||||
self.tableWidgetConnectionCount.setItem(0, 1,
|
self.tableWidgetConnectionCount.setItem(0, 1,
|
||||||
QtGui.QTableWidgetItem("%s" % (rating))
|
QtWidgets.QTableWidgetItem("%s" % (rating))
|
||||||
)
|
)
|
||||||
if outbound:
|
if outbound:
|
||||||
brush = QtGui.QBrush(QtGui.QColor("yellow"), QtCore.Qt.SolidPattern)
|
brush = QtGui.QBrush(QtGui.QColor("yellow"), QtCore.Qt.SolidPattern)
|
||||||
|
@ -143,15 +163,17 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
||||||
self.tableWidgetConnectionCount.item(0, 1).setData(QtCore.Qt.UserRole, outbound)
|
self.tableWidgetConnectionCount.item(0, 1).setData(QtCore.Qt.UserRole, outbound)
|
||||||
else:
|
else:
|
||||||
for i in range(self.tableWidgetConnectionCount.rowCount()):
|
for i in range(self.tableWidgetConnectionCount.rowCount()):
|
||||||
if self.tableWidgetConnectionCount.item(i, 0).data(QtCore.Qt.UserRole).toPyObject() != destination:
|
if self.tableWidgetConnectionCount.item(i, 0).data(QtCore.Qt.UserRole) != destination:
|
||||||
continue
|
continue
|
||||||
if self.tableWidgetConnectionCount.item(i, 1).data(QtCore.Qt.UserRole).toPyObject() == outbound:
|
if self.tableWidgetConnectionCount.item(i, 1).data(QtCore.Qt.UserRole) == outbound:
|
||||||
self.tableWidgetConnectionCount.removeRow(i)
|
self.tableWidgetConnectionCount.removeRow(i)
|
||||||
break
|
break
|
||||||
self.tableWidgetConnectionCount.setUpdatesEnabled(True)
|
self.tableWidgetConnectionCount.setUpdatesEnabled(True)
|
||||||
self.tableWidgetConnectionCount.setSortingEnabled(True)
|
self.tableWidgetConnectionCount.setSortingEnabled(True)
|
||||||
self.labelTotalConnections.setText(_translate(
|
self.labelTotalConnections.setText(_translate(
|
||||||
"networkstatus", "Total Connections: %1").arg(str(self.tableWidgetConnectionCount.rowCount())))
|
"networkstatus", "Total Connections: {0}").format(
|
||||||
|
self.tableWidgetConnectionCount.rowCount()
|
||||||
|
))
|
||||||
# FYI: The 'singlelistener' thread sets the icon color to green when it receives an incoming connection, meaning that the user's firewall is configured correctly.
|
# FYI: The 'singlelistener' thread sets the icon color to green when it receives an incoming connection, meaning that the user's firewall is configured correctly.
|
||||||
if self.tableWidgetConnectionCount.rowCount() and shared.statusIconColor == 'red':
|
if self.tableWidgetConnectionCount.rowCount() and shared.statusIconColor == 'red':
|
||||||
self.window().setStatusIcon('yellow')
|
self.window().setStatusIcon('yellow')
|
||||||
|
@ -161,12 +183,16 @@ class NetworkStatus(QtGui.QWidget, RetranslateMixin):
|
||||||
# timer driven
|
# timer driven
|
||||||
def runEveryTwoSeconds(self):
|
def runEveryTwoSeconds(self):
|
||||||
self.labelLookupsPerSecond.setText(_translate(
|
self.labelLookupsPerSecond.setText(_translate(
|
||||||
"networkstatus", "Inventory lookups per second: %1").arg(str(Inventory().numberOfInventoryLookupsPerformed/2)))
|
"networkstatus", "Inventory lookups per second: {0}").format(
|
||||||
|
Inventory().numberOfInventoryLookupsPerformed/2
|
||||||
|
))
|
||||||
Inventory().numberOfInventoryLookupsPerformed = 0
|
Inventory().numberOfInventoryLookupsPerformed = 0
|
||||||
self.updateNumberOfBytes()
|
self.updateNumberOfBytes()
|
||||||
self.updateNumberOfObjectsToBeSynced()
|
self.updateNumberOfObjectsToBeSynced()
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
super(NetworkStatus, self).retranslateUi()
|
super(NetworkStatus, self).retranslateUi()
|
||||||
self.labelStartupTime.setText(_translate("networkstatus", "Since startup on %1").arg(
|
self.labelStartupTime.setText(
|
||||||
l10n.formatTimestamp(self.startup)))
|
_translate("networkstatus", "Since startup on {0}").format(
|
||||||
|
l10n.formatTimestamp(self.startup)
|
||||||
|
))
|
||||||
|
|
|
@ -375,7 +375,7 @@ The 'Random Number' option is selected by default but deterministic addresses ha
|
||||||
<sender>radioButtonDeterministicAddress</sender>
|
<sender>radioButtonDeterministicAddress</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
<receiver>groupBoxDeterministic</receiver>
|
<receiver>groupBoxDeterministic</receiver>
|
||||||
<slot>setShown(bool)</slot>
|
<slot>setVisible(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>92</x>
|
<x>92</x>
|
||||||
|
@ -391,7 +391,7 @@ The 'Random Number' option is selected by default but deterministic addresses ha
|
||||||
<sender>radioButtonRandomAddress</sender>
|
<sender>radioButtonRandomAddress</sender>
|
||||||
<signal>toggled(bool)</signal>
|
<signal>toggled(bool)</signal>
|
||||||
<receiver>groupBox</receiver>
|
<receiver>groupBox</receiver>
|
||||||
<slot>setShown(bool)</slot>
|
<slot>setVisible(bool)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>72</x>
|
<x>72</x>
|
||||||
|
|
|
@ -1,24 +1,39 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from qtpy import QtCore, QtWidgets
|
||||||
|
|
||||||
from addresses import addBMIfNotPresent
|
from addresses import addBMIfNotPresent
|
||||||
from addressvalidator import AddressValidator, PassPhraseValidator
|
from addressvalidator import AddressValidator, PassPhraseValidator
|
||||||
from queues import apiAddressGeneratorReturnQueue, addressGeneratorQueue, UISignalQueue
|
from queues import (
|
||||||
|
apiAddressGeneratorReturnQueue, addressGeneratorQueue, UISignalQueue)
|
||||||
from retranslateui import RetranslateMixin
|
from retranslateui import RetranslateMixin
|
||||||
from tr import _translate
|
from tr import _translate
|
||||||
from utils import str_chan
|
from utils import str_chan
|
||||||
import widgets
|
import widgets
|
||||||
|
|
||||||
class NewChanDialog(QtGui.QDialog, RetranslateMixin):
|
from debug import logger
|
||||||
|
|
||||||
|
|
||||||
|
class NewChanDialog(QtWidgets.QDialog, RetranslateMixin):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(NewChanDialog, self).__init__(parent)
|
super(NewChanDialog, self).__init__(parent)
|
||||||
widgets.load('newchandialog.ui', self)
|
widgets.load('newchandialog.ui', self)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.chanAddress.setValidator(AddressValidator(self.chanAddress, self.chanPassPhrase, self.validatorFeedback, self.buttonBox, False))
|
validator = AddressValidator(
|
||||||
self.chanPassPhrase.setValidator(PassPhraseValidator(self.chanPassPhrase, self.chanAddress, self.validatorFeedback, self.buttonBox, False))
|
self.chanAddress, self.chanPassPhrase,
|
||||||
|
self.validatorFeedback, self.buttonBox, False)
|
||||||
|
try:
|
||||||
|
validator.checkData()
|
||||||
|
except:
|
||||||
|
logger.warning("NewChanDialog.__init__", exc_info=True)
|
||||||
|
# logger.warning("NewChanDialog.__init__, validator.checkData()")
|
||||||
|
|
||||||
|
self.chanAddress.setValidator(validator)
|
||||||
|
self.chanPassPhrase.setValidator(PassPhraseValidator(
|
||||||
|
self.chanPassPhrase, self.chanAddress, self.validatorFeedback,
|
||||||
|
self.buttonBox, False))
|
||||||
|
|
||||||
self.timer = QtCore.QTimer()
|
self.timer = QtCore.QTimer()
|
||||||
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.delayedUpdateStatus)
|
self.timer.timeout.connect(self.delayedUpdateStatus)
|
||||||
self.timer.start(500) # milliseconds
|
self.timer.start(500) # milliseconds
|
||||||
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
@ -29,23 +44,47 @@ class NewChanDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
self.timer.stop()
|
self.timer.stop()
|
||||||
self.hide()
|
self.hide()
|
||||||
apiAddressGeneratorReturnQueue.queue.clear()
|
apiAddressGeneratorReturnQueue.queue.clear()
|
||||||
if self.chanAddress.text().toUtf8() == "":
|
if self.chanAddress.text() == "":
|
||||||
addressGeneratorQueue.put(('createChan', 4, 1, str_chan + ' ' + str(self.chanPassPhrase.text().toUtf8()), self.chanPassPhrase.text().toUtf8(), True))
|
addressGeneratorQueue.put((
|
||||||
|
'createChan', 4, 1,
|
||||||
|
str_chan + ' ' + str(self.chanPassPhrase.text()),
|
||||||
|
self.chanPassPhrase.text(), True
|
||||||
|
))
|
||||||
else:
|
else:
|
||||||
addressGeneratorQueue.put(('joinChan', addBMIfNotPresent(self.chanAddress.text().toUtf8()), str_chan + ' ' + str(self.chanPassPhrase.text().toUtf8()), self.chanPassPhrase.text().toUtf8(), True))
|
addressGeneratorQueue.put((
|
||||||
|
'joinChan', addBMIfNotPresent(self.chanAddress.text()),
|
||||||
|
str_chan + ' ' + str(self.chanPassPhrase.text()),
|
||||||
|
self.chanPassPhrase.text(), True
|
||||||
|
))
|
||||||
addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True)
|
addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True)
|
||||||
if len(addressGeneratorReturnValue) > 0 and addressGeneratorReturnValue[0] != 'chan name does not match address':
|
if (len(addressGeneratorReturnValue) > 0
|
||||||
UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Successfully created / joined chan %1").arg(unicode(self.chanPassPhrase.text()))))
|
and addressGeneratorReturnValue[0] !=
|
||||||
|
'chan name does not match address'):
|
||||||
|
UISignalQueue.put((
|
||||||
|
'updateStatusBar',
|
||||||
|
_translate(
|
||||||
|
"newchandialog",
|
||||||
|
"Successfully created / joined chan {0}"
|
||||||
|
).format(self.chanPassPhrase.text())
|
||||||
|
))
|
||||||
self.parent.ui.tabWidget.setCurrentIndex(
|
self.parent.ui.tabWidget.setCurrentIndex(
|
||||||
self.parent.ui.tabWidget.indexOf(self.parent.ui.chans)
|
self.parent.ui.tabWidget.indexOf(self.parent.ui.chans)
|
||||||
)
|
)
|
||||||
self.done(QtGui.QDialog.Accepted)
|
self.done(QtWidgets.QDialog.Accepted)
|
||||||
else:
|
else:
|
||||||
UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Chan creation / joining failed")))
|
UISignalQueue.put((
|
||||||
self.done(QtGui.QDialog.Rejected)
|
'updateStatusBar',
|
||||||
|
_translate(
|
||||||
|
"newchandialog", "Chan creation / joining failed")
|
||||||
|
))
|
||||||
|
self.done(QtWidgets.QDialog.Rejected)
|
||||||
|
|
||||||
def reject(self):
|
def reject(self):
|
||||||
self.timer.stop()
|
self.timer.stop()
|
||||||
self.hide()
|
self.hide()
|
||||||
UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Chan creation / joining cancelled")))
|
UISignalQueue.put((
|
||||||
self.done(QtGui.QDialog.Rejected)
|
'updateStatusBar',
|
||||||
|
_translate(
|
||||||
|
"newchandialog", "Chan creation / joining cancelled")
|
||||||
|
))
|
||||||
|
self.done(QtWidgets.QDialog.Rejected)
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
from os import path
|
from qtpy import QtWidgets
|
||||||
from PyQt4 import QtGui
|
|
||||||
from debug import logger
|
|
||||||
import widgets
|
import widgets
|
||||||
|
|
||||||
|
|
||||||
class RetranslateMixin(object):
|
class RetranslateMixin(object):
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
defaults = QtGui.QWidget()
|
defaults = QtWidgets.QWidget()
|
||||||
widgets.load(self.__class__.__name__.lower() + '.ui', defaults)
|
widgets.load(self.__class__.__name__.lower() + '.ui', defaults)
|
||||||
for attr, value in defaults.__dict__.iteritems():
|
for attr, value in defaults.__dict__.iteritems():
|
||||||
setTextMethod = getattr(value, "setText", None)
|
setTextMethod = getattr(value, "setText", None)
|
||||||
if callable(setTextMethod):
|
if callable(setTextMethod):
|
||||||
getattr(self, attr).setText(getattr(defaults, attr).text())
|
getattr(self, attr).setText(getattr(defaults, attr).text())
|
||||||
elif isinstance(value, QtGui.QTableWidget):
|
elif isinstance(value, QtWidgets.QTableWidget):
|
||||||
for i in range (value.columnCount()):
|
for i in range(value.columnCount()):
|
||||||
getattr(self, attr).horizontalHeaderItem(i).setText(getattr(defaults, attr).horizontalHeaderItem(i).text())
|
getattr(self, attr).horizontalHeaderItem(i).setText(
|
||||||
for i in range (value.rowCount()):
|
getattr(defaults, attr).horizontalHeaderItem(i).text())
|
||||||
getattr(self, attr).verticalHeaderItem(i).setText(getattr(defaults, attr).verticalHeaderItem(i).text())
|
for i in range(value.rowCount()):
|
||||||
|
getattr(self, attr).verticalHeaderItem(i).setText(
|
||||||
|
getattr(defaults, attr).verticalHeaderItem(i).text())
|
||||||
|
|
|
@ -1,31 +1,38 @@
|
||||||
from HTMLParser import HTMLParser
|
from HTMLParser import HTMLParser
|
||||||
import inspect
|
import inspect
|
||||||
import re
|
import re
|
||||||
from urllib import quote, quote_plus
|
from urllib import quote_plus
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
|
||||||
|
|
||||||
class SafeHTMLParser(HTMLParser):
|
class SafeHTMLParser(HTMLParser):
|
||||||
# from html5lib.sanitiser
|
# from html5lib.sanitiser
|
||||||
acceptable_elements = ['a', 'abbr', 'acronym', 'address', 'area',
|
acceptable_elements = [
|
||||||
'article', 'aside', 'audio', 'b', 'big', 'blockquote', 'br', 'button',
|
'a', 'abbr', 'acronym', 'address', 'area',
|
||||||
'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup',
|
'article', 'aside', 'audio', 'b', 'big', 'blockquote', 'br', 'button',
|
||||||
'command', 'datagrid', 'datalist', 'dd', 'del', 'details', 'dfn',
|
'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup',
|
||||||
'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'event-source', 'fieldset',
|
'command', 'datagrid', 'datalist', 'dd', 'del', 'details', 'dfn',
|
||||||
'figcaption', 'figure', 'footer', 'font', 'header', 'h1',
|
'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'event-source', 'fieldset',
|
||||||
'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'ins',
|
'figcaption', 'figure', 'footer', 'font', 'header', 'h1',
|
||||||
'keygen', 'kbd', 'label', 'legend', 'li', 'm', 'map', 'menu', 'meter',
|
'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'ins',
|
||||||
'multicol', 'nav', 'nextid', 'ol', 'output', 'optgroup', 'option',
|
'keygen', 'kbd', 'label', 'legend', 'li', 'm', 'map', 'menu', 'meter',
|
||||||
'p', 'pre', 'progress', 'q', 's', 'samp', 'section', 'select',
|
'multicol', 'nav', 'nextid', 'ol', 'output', 'optgroup', 'option',
|
||||||
'small', 'sound', 'source', 'spacer', 'span', 'strike', 'strong',
|
'p', 'pre', 'progress', 'q', 's', 'samp', 'section', 'select',
|
||||||
'sub', 'sup', 'table', 'tbody', 'td', 'textarea', 'time', 'tfoot',
|
'small', 'sound', 'source', 'spacer', 'span', 'strike', 'strong',
|
||||||
'th', 'thead', 'tr', 'tt', 'u', 'ul', 'var', 'video']
|
'sub', 'sup', 'table', 'tbody', 'td', 'textarea', 'time', 'tfoot',
|
||||||
replaces_pre = [["&", "&"], ["\"", """], ["<", "<"], [">", ">"]]
|
'th', 'thead', 'tr', 'tt', 'u', 'ul', 'var', 'video'
|
||||||
replaces_post = [["\n", "<br/>"], ["\t", " "], [" ", " "], [" ", " "], ["<br/> ", "<br/> "]]
|
]
|
||||||
src_schemes = [ "data" ]
|
replaces_pre = [
|
||||||
|
["&", "&"], ["\"", """], ["<", "<"], [">", ">"]]
|
||||||
|
replaces_post = [
|
||||||
|
["\n", "<br/>"], ["\t", " "], [" ", " "],
|
||||||
|
[" ", " "], ["<br/> ", "<br/> "]]
|
||||||
|
src_schemes = ["data"]
|
||||||
#uriregex1 = re.compile(r'(?i)\b((?:(https?|ftp|bitcoin):(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?]))')
|
#uriregex1 = re.compile(r'(?i)\b((?:(https?|ftp|bitcoin):(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:\'".,<>?]))')
|
||||||
uriregex1 = re.compile(r'((https?|ftp|bitcoin):(?:/{1,3}|[a-z0-9%])(?:[a-zA-Z]|[0-9]|[$-_@.&+#]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)')
|
uriregex1 = re.compile(r'((https?|ftp|bitcoin):(?:/{1,3}|[a-z0-9%])(?:[a-zA-Z]|[0-9]|[$-_@.&+#]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)')
|
||||||
uriregex2 = re.compile(r'<a href="([^"]+)&')
|
uriregex2 = re.compile(r'<a href="([^"]+)&')
|
||||||
emailregex = re.compile(r'\b([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,})\b')
|
emailregex = re.compile(
|
||||||
|
r'\b([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,})\b')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def replace_pre(text):
|
def replace_pre(text):
|
||||||
|
@ -43,8 +50,9 @@ class SafeHTMLParser(HTMLParser):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
HTMLParser.__init__(self, *args, **kwargs)
|
HTMLParser.__init__(self, *args, **kwargs)
|
||||||
|
self.reset()
|
||||||
self.reset_safe()
|
self.reset_safe()
|
||||||
|
|
||||||
def reset_safe(self):
|
def reset_safe(self):
|
||||||
self.elements = set()
|
self.elements = set()
|
||||||
self.raw = u""
|
self.raw = u""
|
||||||
|
@ -53,8 +61,8 @@ class SafeHTMLParser(HTMLParser):
|
||||||
self.allow_picture = False
|
self.allow_picture = False
|
||||||
self.allow_external_src = False
|
self.allow_external_src = False
|
||||||
|
|
||||||
def add_if_acceptable(self, tag, attrs = None):
|
def add_if_acceptable(self, tag, attrs=None):
|
||||||
if tag not in SafeHTMLParser.acceptable_elements:
|
if tag not in self.acceptable_elements:
|
||||||
return
|
return
|
||||||
self.sanitised += "<"
|
self.sanitised += "<"
|
||||||
if inspect.stack()[1][3] == "handle_endtag":
|
if inspect.stack()[1][3] == "handle_endtag":
|
||||||
|
@ -66,7 +74,7 @@ class SafeHTMLParser(HTMLParser):
|
||||||
val = ""
|
val = ""
|
||||||
elif attr == "src" and not self.allow_external_src:
|
elif attr == "src" and not self.allow_external_src:
|
||||||
url = urlparse(val)
|
url = urlparse(val)
|
||||||
if url.scheme not in SafeHTMLParser.src_schemes:
|
if url.scheme not in self.src_schemes:
|
||||||
val = ""
|
val = ""
|
||||||
self.sanitised += " " + quote_plus(attr)
|
self.sanitised += " " + quote_plus(attr)
|
||||||
if not (val is None):
|
if not (val is None):
|
||||||
|
@ -74,45 +82,40 @@ class SafeHTMLParser(HTMLParser):
|
||||||
if inspect.stack()[1][3] == "handle_startendtag":
|
if inspect.stack()[1][3] == "handle_startendtag":
|
||||||
self.sanitised += "/"
|
self.sanitised += "/"
|
||||||
self.sanitised += ">"
|
self.sanitised += ">"
|
||||||
|
|
||||||
def handle_starttag(self, tag, attrs):
|
def handle_starttag(self, tag, attrs):
|
||||||
if tag in SafeHTMLParser.acceptable_elements:
|
if tag in self.acceptable_elements:
|
||||||
self.has_html = True
|
self.has_html = True
|
||||||
self.add_if_acceptable(tag, attrs)
|
self.add_if_acceptable(tag, attrs)
|
||||||
|
|
||||||
def handle_endtag(self, tag):
|
def handle_endtag(self, tag):
|
||||||
self.add_if_acceptable(tag)
|
self.add_if_acceptable(tag)
|
||||||
|
|
||||||
def handle_startendtag(self, tag, attrs):
|
def handle_startendtag(self, tag, attrs):
|
||||||
if tag in SafeHTMLParser.acceptable_elements:
|
if tag in self.acceptable_elements:
|
||||||
self.has_html = True
|
self.has_html = True
|
||||||
self.add_if_acceptable(tag, attrs)
|
self.add_if_acceptable(tag, attrs)
|
||||||
|
|
||||||
def handle_data(self, data):
|
def handle_data(self, data):
|
||||||
|
# print("got data of type %r: %r" % (type(data), data))
|
||||||
self.sanitised += data
|
self.sanitised += data
|
||||||
|
|
||||||
def handle_charref(self, name):
|
def handle_charref(self, name):
|
||||||
self.sanitised += "&#" + name + ";"
|
self.sanitised += "&#" + name + ";"
|
||||||
|
|
||||||
def handle_entityref(self, name):
|
def handle_entityref(self, name):
|
||||||
self.sanitised += "&" + name + ";"
|
self.sanitised += "&" + name + ";"
|
||||||
|
|
||||||
def feed(self, data):
|
def feed(self, data):
|
||||||
try:
|
|
||||||
data = unicode(data, 'utf-8')
|
|
||||||
except UnicodeDecodeError:
|
|
||||||
data = unicode(data, 'utf-8', errors='replace')
|
|
||||||
HTMLParser.feed(self, data)
|
HTMLParser.feed(self, data)
|
||||||
tmp = SafeHTMLParser.replace_pre(data)
|
tmp = SafeHTMLParser.replace_pre(data)
|
||||||
tmp = SafeHTMLParser.uriregex1.sub(
|
tmp = self.uriregex1.sub(r'<a href="\1">\1</a>', tmp)
|
||||||
r'<a href="\1">\1</a>',
|
tmp = self.uriregex2.sub(r'<a href="\1&', tmp)
|
||||||
tmp)
|
tmp = self.emailregex.sub(r'<a href="mailto:\1">\1</a>', tmp)
|
||||||
tmp = SafeHTMLParser.uriregex2.sub(r'<a href="\1&', tmp)
|
|
||||||
tmp = SafeHTMLParser.emailregex.sub(r'<a href="mailto:\1">\1</a>', tmp)
|
|
||||||
tmp = SafeHTMLParser.replace_post(tmp)
|
tmp = SafeHTMLParser.replace_post(tmp)
|
||||||
self.raw += tmp
|
self.raw += tmp
|
||||||
|
|
||||||
def is_html(self, text = None, allow_picture = False):
|
def is_html(self, text=None, allow_picture=False):
|
||||||
if text:
|
if text:
|
||||||
self.reset()
|
self.reset()
|
||||||
self.reset_safe()
|
self.reset_safe()
|
||||||
|
|
|
@ -1,441 +1,426 @@
|
||||||
# -*- coding: utf-8 -*-
|
from qtpy import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'settings.ui'
|
|
||||||
#
|
|
||||||
# Created: Thu Dec 25 23:21:20 2014
|
|
||||||
# by: PyQt4 UI code generator 4.10.3
|
|
||||||
#
|
|
||||||
# WARNING! All changes made in this file will be lost!
|
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
|
||||||
from languagebox import LanguageBox
|
from languagebox import LanguageBox
|
||||||
from sys import platform
|
from sys import platform
|
||||||
|
|
||||||
try:
|
from tr import _translate
|
||||||
_fromUtf8 = QtCore.QString.fromUtf8
|
|
||||||
except AttributeError:
|
|
||||||
def _fromUtf8(s):
|
|
||||||
return s
|
|
||||||
|
|
||||||
try:
|
|
||||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
|
||||||
def _translate(context, text, disambig):
|
|
||||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
|
||||||
except AttributeError:
|
|
||||||
def _translate(context, text, disambig):
|
|
||||||
return QtGui.QApplication.translate(context, text, disambig)
|
|
||||||
|
|
||||||
class Ui_settingsDialog(object):
|
class Ui_settingsDialog(object):
|
||||||
def setupUi(self, settingsDialog):
|
def setupUi(self, settingsDialog):
|
||||||
settingsDialog.setObjectName(_fromUtf8("settingsDialog"))
|
settingsDialog.setObjectName("settingsDialog")
|
||||||
settingsDialog.resize(521, 413)
|
settingsDialog.resize(521, 413)
|
||||||
self.gridLayout = QtGui.QGridLayout(settingsDialog)
|
self.gridLayout = QtWidgets.QGridLayout(settingsDialog)
|
||||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
self.gridLayout.setObjectName("gridLayout")
|
||||||
self.buttonBox = QtGui.QDialogButtonBox(settingsDialog)
|
self.buttonBox = QtWidgets.QDialogButtonBox(settingsDialog)
|
||||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
|
||||||
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
|
self.buttonBox.setObjectName("buttonBox")
|
||||||
self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1)
|
self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1)
|
||||||
self.tabWidgetSettings = QtGui.QTabWidget(settingsDialog)
|
self.tabWidgetSettings = QtWidgets.QTabWidget(settingsDialog)
|
||||||
self.tabWidgetSettings.setObjectName(_fromUtf8("tabWidgetSettings"))
|
self.tabWidgetSettings.setObjectName("tabWidgetSettings")
|
||||||
self.tabUserInterface = QtGui.QWidget()
|
self.tabUserInterface = QtWidgets.QWidget()
|
||||||
self.tabUserInterface.setEnabled(True)
|
self.tabUserInterface.setEnabled(True)
|
||||||
self.tabUserInterface.setObjectName(_fromUtf8("tabUserInterface"))
|
self.tabUserInterface.setObjectName("tabUserInterface")
|
||||||
self.formLayout = QtGui.QFormLayout(self.tabUserInterface)
|
self.formLayout = QtWidgets.QFormLayout(self.tabUserInterface)
|
||||||
self.formLayout.setObjectName(_fromUtf8("formLayout"))
|
self.formLayout.setObjectName("formLayout")
|
||||||
self.checkBoxStartOnLogon = QtGui.QCheckBox(self.tabUserInterface)
|
self.checkBoxStartOnLogon = QtWidgets.QCheckBox(self.tabUserInterface)
|
||||||
self.checkBoxStartOnLogon.setObjectName(_fromUtf8("checkBoxStartOnLogon"))
|
self.checkBoxStartOnLogon.setObjectName("checkBoxStartOnLogon")
|
||||||
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.checkBoxStartOnLogon)
|
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.checkBoxStartOnLogon)
|
||||||
self.groupBoxTray = QtGui.QGroupBox(self.tabUserInterface)
|
self.groupBoxTray = QtWidgets.QGroupBox(self.tabUserInterface)
|
||||||
self.groupBoxTray.setObjectName(_fromUtf8("groupBoxTray"))
|
self.groupBoxTray.setObjectName("groupBoxTray")
|
||||||
self.formLayoutTray = QtGui.QFormLayout(self.groupBoxTray)
|
self.formLayoutTray = QtWidgets.QFormLayout(self.groupBoxTray)
|
||||||
self.formLayoutTray.setObjectName(_fromUtf8("formLayoutTray"))
|
self.formLayoutTray.setObjectName("formLayoutTray")
|
||||||
self.checkBoxStartInTray = QtGui.QCheckBox(self.groupBoxTray)
|
self.checkBoxStartInTray = QtWidgets.QCheckBox(self.groupBoxTray)
|
||||||
self.checkBoxStartInTray.setObjectName(_fromUtf8("checkBoxStartInTray"))
|
self.checkBoxStartInTray.setObjectName("checkBoxStartInTray")
|
||||||
self.formLayoutTray.setWidget(0, QtGui.QFormLayout.SpanningRole, self.checkBoxStartInTray)
|
self.formLayoutTray.setWidget(0, QtWidgets.QFormLayout.SpanningRole, self.checkBoxStartInTray)
|
||||||
self.checkBoxMinimizeToTray = QtGui.QCheckBox(self.groupBoxTray)
|
self.checkBoxMinimizeToTray = QtWidgets.QCheckBox(self.groupBoxTray)
|
||||||
self.checkBoxMinimizeToTray.setChecked(True)
|
self.checkBoxMinimizeToTray.setChecked(True)
|
||||||
self.checkBoxMinimizeToTray.setObjectName(_fromUtf8("checkBoxMinimizeToTray"))
|
self.checkBoxMinimizeToTray.setObjectName("checkBoxMinimizeToTray")
|
||||||
self.formLayoutTray.setWidget(1, QtGui.QFormLayout.LabelRole, self.checkBoxMinimizeToTray)
|
self.formLayoutTray.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.checkBoxMinimizeToTray)
|
||||||
self.checkBoxTrayOnClose = QtGui.QCheckBox(self.groupBoxTray)
|
self.checkBoxTrayOnClose = QtWidgets.QCheckBox(self.groupBoxTray)
|
||||||
self.checkBoxTrayOnClose.setChecked(True)
|
self.checkBoxTrayOnClose.setChecked(True)
|
||||||
self.checkBoxTrayOnClose.setObjectName(_fromUtf8("checkBoxTrayOnClose"))
|
self.checkBoxTrayOnClose.setObjectName("checkBoxTrayOnClose")
|
||||||
self.formLayoutTray.setWidget(2, QtGui.QFormLayout.LabelRole, self.checkBoxTrayOnClose)
|
self.formLayoutTray.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.checkBoxTrayOnClose)
|
||||||
self.formLayout.setWidget(1, QtGui.QFormLayout.SpanningRole, self.groupBoxTray)
|
self.formLayout.setWidget(1, QtWidgets.QFormLayout.SpanningRole, self.groupBoxTray)
|
||||||
self.checkBoxHideTrayConnectionNotifications = QtGui.QCheckBox(self.tabUserInterface)
|
self.checkBoxHideTrayConnectionNotifications = QtWidgets.QCheckBox(self.tabUserInterface)
|
||||||
self.checkBoxHideTrayConnectionNotifications.setChecked(False)
|
self.checkBoxHideTrayConnectionNotifications.setChecked(False)
|
||||||
self.checkBoxHideTrayConnectionNotifications.setObjectName(_fromUtf8("checkBoxHideTrayConnectionNotifications"))
|
self.checkBoxHideTrayConnectionNotifications.setObjectName("checkBoxHideTrayConnectionNotifications")
|
||||||
self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.checkBoxHideTrayConnectionNotifications)
|
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.checkBoxHideTrayConnectionNotifications)
|
||||||
self.checkBoxShowTrayNotifications = QtGui.QCheckBox(self.tabUserInterface)
|
self.checkBoxShowTrayNotifications = QtWidgets.QCheckBox(self.tabUserInterface)
|
||||||
self.checkBoxShowTrayNotifications.setObjectName(_fromUtf8("checkBoxShowTrayNotifications"))
|
self.checkBoxShowTrayNotifications.setObjectName("checkBoxShowTrayNotifications")
|
||||||
self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.checkBoxShowTrayNotifications)
|
self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.checkBoxShowTrayNotifications)
|
||||||
self.checkBoxPortableMode = QtGui.QCheckBox(self.tabUserInterface)
|
self.checkBoxPortableMode = QtWidgets.QCheckBox(self.tabUserInterface)
|
||||||
self.checkBoxPortableMode.setObjectName(_fromUtf8("checkBoxPortableMode"))
|
self.checkBoxPortableMode.setObjectName("checkBoxPortableMode")
|
||||||
self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.checkBoxPortableMode)
|
self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.checkBoxPortableMode)
|
||||||
self.PortableModeDescription = QtGui.QLabel(self.tabUserInterface)
|
self.PortableModeDescription = QtWidgets.QLabel(self.tabUserInterface)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.PortableModeDescription.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.PortableModeDescription.sizePolicy().hasHeightForWidth())
|
||||||
self.PortableModeDescription.setSizePolicy(sizePolicy)
|
self.PortableModeDescription.setSizePolicy(sizePolicy)
|
||||||
self.PortableModeDescription.setWordWrap(True)
|
self.PortableModeDescription.setWordWrap(True)
|
||||||
self.PortableModeDescription.setObjectName(_fromUtf8("PortableModeDescription"))
|
self.PortableModeDescription.setObjectName("PortableModeDescription")
|
||||||
self.formLayout.setWidget(5, QtGui.QFormLayout.SpanningRole, self.PortableModeDescription)
|
self.formLayout.setWidget(5, QtWidgets.QFormLayout.SpanningRole, self.PortableModeDescription)
|
||||||
self.checkBoxWillinglySendToMobile = QtGui.QCheckBox(self.tabUserInterface)
|
self.checkBoxWillinglySendToMobile = QtWidgets.QCheckBox(self.tabUserInterface)
|
||||||
self.checkBoxWillinglySendToMobile.setObjectName(_fromUtf8("checkBoxWillinglySendToMobile"))
|
self.checkBoxWillinglySendToMobile.setObjectName("checkBoxWillinglySendToMobile")
|
||||||
self.formLayout.setWidget(6, QtGui.QFormLayout.SpanningRole, self.checkBoxWillinglySendToMobile)
|
self.formLayout.setWidget(6, QtWidgets.QFormLayout.SpanningRole, self.checkBoxWillinglySendToMobile)
|
||||||
self.checkBoxUseIdenticons = QtGui.QCheckBox(self.tabUserInterface)
|
self.checkBoxUseIdenticons = QtWidgets.QCheckBox(self.tabUserInterface)
|
||||||
self.checkBoxUseIdenticons.setObjectName(_fromUtf8("checkBoxUseIdenticons"))
|
self.checkBoxUseIdenticons.setObjectName("checkBoxUseIdenticons")
|
||||||
self.formLayout.setWidget(7, QtGui.QFormLayout.LabelRole, self.checkBoxUseIdenticons)
|
self.formLayout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.checkBoxUseIdenticons)
|
||||||
self.checkBoxReplyBelow = QtGui.QCheckBox(self.tabUserInterface)
|
self.checkBoxReplyBelow = QtWidgets.QCheckBox(self.tabUserInterface)
|
||||||
self.checkBoxReplyBelow.setObjectName(_fromUtf8("checkBoxReplyBelow"))
|
self.checkBoxReplyBelow.setObjectName("checkBoxReplyBelow")
|
||||||
self.formLayout.setWidget(8, QtGui.QFormLayout.LabelRole, self.checkBoxReplyBelow)
|
self.formLayout.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.checkBoxReplyBelow)
|
||||||
self.groupBox = QtGui.QGroupBox(self.tabUserInterface)
|
self.groupBox = QtWidgets.QGroupBox(self.tabUserInterface)
|
||||||
self.groupBox.setObjectName(_fromUtf8("groupBox"))
|
self.groupBox.setObjectName("groupBox")
|
||||||
self.formLayout_2 = QtGui.QFormLayout(self.groupBox)
|
self.formLayout_2 = QtWidgets.QFormLayout(self.groupBox)
|
||||||
self.formLayout_2.setObjectName(_fromUtf8("formLayout_2"))
|
self.formLayout_2.setObjectName("formLayout_2")
|
||||||
self.languageComboBox = LanguageBox(self.groupBox)
|
self.languageComboBox = LanguageBox(self.groupBox)
|
||||||
self.languageComboBox.setMinimumSize(QtCore.QSize(100, 0))
|
self.languageComboBox.setMinimumSize(QtCore.QSize(100, 0))
|
||||||
self.languageComboBox.setObjectName(_fromUtf8("languageComboBox"))
|
self.languageComboBox.setObjectName("languageComboBox")
|
||||||
self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.languageComboBox)
|
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.languageComboBox)
|
||||||
self.formLayout.setWidget(9, QtGui.QFormLayout.FieldRole, self.groupBox)
|
self.formLayout.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.groupBox)
|
||||||
self.tabWidgetSettings.addTab(self.tabUserInterface, _fromUtf8(""))
|
self.tabWidgetSettings.addTab(self.tabUserInterface, "")
|
||||||
self.tabNetworkSettings = QtGui.QWidget()
|
self.tabNetworkSettings = QtWidgets.QWidget()
|
||||||
self.tabNetworkSettings.setObjectName(_fromUtf8("tabNetworkSettings"))
|
self.tabNetworkSettings.setObjectName("tabNetworkSettings")
|
||||||
self.gridLayout_4 = QtGui.QGridLayout(self.tabNetworkSettings)
|
self.gridLayout_4 = QtWidgets.QGridLayout(self.tabNetworkSettings)
|
||||||
self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))
|
self.gridLayout_4.setObjectName("gridLayout_4")
|
||||||
self.groupBox1 = QtGui.QGroupBox(self.tabNetworkSettings)
|
self.groupBox1 = QtWidgets.QGroupBox(self.tabNetworkSettings)
|
||||||
self.groupBox1.setObjectName(_fromUtf8("groupBox1"))
|
self.groupBox1.setObjectName("groupBox1")
|
||||||
self.gridLayout_3 = QtGui.QGridLayout(self.groupBox1)
|
self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox1)
|
||||||
self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
|
self.gridLayout_3.setObjectName("gridLayout_3")
|
||||||
#spacerItem = QtGui.QSpacerItem(125, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
#spacerItem = QtWidgets.QSpacerItem(125, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
#self.gridLayout_3.addItem(spacerItem, 0, 0, 1, 1)
|
#self.gridLayout_3.addItem(spacerItem, 0, 0, 1, 1)
|
||||||
self.label = QtGui.QLabel(self.groupBox1)
|
self.label = QtWidgets.QLabel(self.groupBox1)
|
||||||
self.label.setObjectName(_fromUtf8("label"))
|
self.label.setObjectName("label")
|
||||||
self.gridLayout_3.addWidget(self.label, 0, 0, 1, 1, QtCore.Qt.AlignRight)
|
self.gridLayout_3.addWidget(self.label, 0, 0, 1, 1, QtCore.Qt.AlignRight)
|
||||||
self.lineEditTCPPort = QtGui.QLineEdit(self.groupBox1)
|
self.lineEditTCPPort = QtWidgets.QLineEdit(self.groupBox1)
|
||||||
self.lineEditTCPPort.setMaximumSize(QtCore.QSize(70, 16777215))
|
self.lineEditTCPPort.setMaximumSize(QtCore.QSize(70, 16777215))
|
||||||
self.lineEditTCPPort.setObjectName(_fromUtf8("lineEditTCPPort"))
|
self.lineEditTCPPort.setObjectName("lineEditTCPPort")
|
||||||
self.gridLayout_3.addWidget(self.lineEditTCPPort, 0, 1, 1, 1, QtCore.Qt.AlignLeft)
|
self.gridLayout_3.addWidget(self.lineEditTCPPort, 0, 1, 1, 1, QtCore.Qt.AlignLeft)
|
||||||
self.labelUPnP = QtGui.QLabel(self.groupBox1)
|
self.labelUPnP = QtWidgets.QLabel(self.groupBox1)
|
||||||
self.labelUPnP.setObjectName(_fromUtf8("labelUPnP"))
|
self.labelUPnP.setObjectName("labelUPnP")
|
||||||
self.gridLayout_3.addWidget(self.labelUPnP, 0, 2, 1, 1, QtCore.Qt.AlignRight)
|
self.gridLayout_3.addWidget(self.labelUPnP, 0, 2, 1, 1, QtCore.Qt.AlignRight)
|
||||||
self.checkBoxUPnP = QtGui.QCheckBox(self.groupBox1)
|
self.checkBoxUPnP = QtWidgets.QCheckBox(self.groupBox1)
|
||||||
self.checkBoxUPnP.setObjectName(_fromUtf8("checkBoxUPnP"))
|
self.checkBoxUPnP.setObjectName("checkBoxUPnP")
|
||||||
self.gridLayout_3.addWidget(self.checkBoxUPnP, 0, 3, 1, 1, QtCore.Qt.AlignLeft)
|
self.gridLayout_3.addWidget(self.checkBoxUPnP, 0, 3, 1, 1, QtCore.Qt.AlignLeft)
|
||||||
self.gridLayout_4.addWidget(self.groupBox1, 0, 0, 1, 1)
|
self.gridLayout_4.addWidget(self.groupBox1, 0, 0, 1, 1)
|
||||||
self.groupBox_3 = QtGui.QGroupBox(self.tabNetworkSettings)
|
self.groupBox_3 = QtWidgets.QGroupBox(self.tabNetworkSettings)
|
||||||
self.groupBox_3.setObjectName(_fromUtf8("groupBox_3"))
|
self.groupBox_3.setObjectName("groupBox_3")
|
||||||
self.gridLayout_9 = QtGui.QGridLayout(self.groupBox_3)
|
self.gridLayout_9 = QtWidgets.QGridLayout(self.groupBox_3)
|
||||||
self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9"))
|
self.gridLayout_9.setObjectName("gridLayout_9")
|
||||||
spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.gridLayout_9.addItem(spacerItem1, 0, 0, 2, 1)
|
self.gridLayout_9.addItem(spacerItem1, 0, 0, 2, 1)
|
||||||
self.label_24 = QtGui.QLabel(self.groupBox_3)
|
self.label_24 = QtWidgets.QLabel(self.groupBox_3)
|
||||||
self.label_24.setObjectName(_fromUtf8("label_24"))
|
self.label_24.setObjectName("label_24")
|
||||||
self.gridLayout_9.addWidget(self.label_24, 0, 1, 1, 1)
|
self.gridLayout_9.addWidget(self.label_24, 0, 1, 1, 1)
|
||||||
self.lineEditMaxDownloadRate = QtGui.QLineEdit(self.groupBox_3)
|
self.lineEditMaxDownloadRate = QtWidgets.QLineEdit(self.groupBox_3)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.lineEditMaxDownloadRate.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.lineEditMaxDownloadRate.sizePolicy().hasHeightForWidth())
|
||||||
self.lineEditMaxDownloadRate.setSizePolicy(sizePolicy)
|
self.lineEditMaxDownloadRate.setSizePolicy(sizePolicy)
|
||||||
self.lineEditMaxDownloadRate.setMaximumSize(QtCore.QSize(60, 16777215))
|
self.lineEditMaxDownloadRate.setMaximumSize(QtCore.QSize(60, 16777215))
|
||||||
self.lineEditMaxDownloadRate.setObjectName(_fromUtf8("lineEditMaxDownloadRate"))
|
self.lineEditMaxDownloadRate.setObjectName("lineEditMaxDownloadRate")
|
||||||
self.gridLayout_9.addWidget(self.lineEditMaxDownloadRate, 0, 2, 1, 1)
|
self.gridLayout_9.addWidget(self.lineEditMaxDownloadRate, 0, 2, 1, 1)
|
||||||
self.label_25 = QtGui.QLabel(self.groupBox_3)
|
self.label_25 = QtWidgets.QLabel(self.groupBox_3)
|
||||||
self.label_25.setObjectName(_fromUtf8("label_25"))
|
self.label_25.setObjectName("label_25")
|
||||||
self.gridLayout_9.addWidget(self.label_25, 1, 1, 1, 1)
|
self.gridLayout_9.addWidget(self.label_25, 1, 1, 1, 1)
|
||||||
self.lineEditMaxUploadRate = QtGui.QLineEdit(self.groupBox_3)
|
self.lineEditMaxUploadRate = QtWidgets.QLineEdit(self.groupBox_3)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.lineEditMaxUploadRate.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.lineEditMaxUploadRate.sizePolicy().hasHeightForWidth())
|
||||||
self.lineEditMaxUploadRate.setSizePolicy(sizePolicy)
|
self.lineEditMaxUploadRate.setSizePolicy(sizePolicy)
|
||||||
self.lineEditMaxUploadRate.setMaximumSize(QtCore.QSize(60, 16777215))
|
self.lineEditMaxUploadRate.setMaximumSize(QtCore.QSize(60, 16777215))
|
||||||
self.lineEditMaxUploadRate.setObjectName(_fromUtf8("lineEditMaxUploadRate"))
|
self.lineEditMaxUploadRate.setObjectName("lineEditMaxUploadRate")
|
||||||
self.gridLayout_9.addWidget(self.lineEditMaxUploadRate, 1, 2, 1, 1)
|
self.gridLayout_9.addWidget(self.lineEditMaxUploadRate, 1, 2, 1, 1)
|
||||||
self.label_26 = QtGui.QLabel(self.groupBox_3)
|
self.label_26 = QtWidgets.QLabel(self.groupBox_3)
|
||||||
self.label_26.setObjectName(_fromUtf8("label_26"))
|
self.label_26.setObjectName("label_26")
|
||||||
self.gridLayout_9.addWidget(self.label_26, 2, 1, 1, 1)
|
self.gridLayout_9.addWidget(self.label_26, 2, 1, 1, 1)
|
||||||
self.lineEditMaxOutboundConnections = QtGui.QLineEdit(self.groupBox_3)
|
self.lineEditMaxOutboundConnections = QtWidgets.QLineEdit(self.groupBox_3)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.lineEditMaxOutboundConnections.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.lineEditMaxOutboundConnections.sizePolicy().hasHeightForWidth())
|
||||||
self.lineEditMaxOutboundConnections.setSizePolicy(sizePolicy)
|
self.lineEditMaxOutboundConnections.setSizePolicy(sizePolicy)
|
||||||
self.lineEditMaxOutboundConnections.setMaximumSize(QtCore.QSize(60, 16777215))
|
self.lineEditMaxOutboundConnections.setMaximumSize(QtCore.QSize(60, 16777215))
|
||||||
self.lineEditMaxOutboundConnections.setObjectName(_fromUtf8("lineEditMaxOutboundConnections"))
|
self.lineEditMaxOutboundConnections.setObjectName("lineEditMaxOutboundConnections")
|
||||||
self.lineEditMaxOutboundConnections.setValidator(QtGui.QIntValidator(0, 8, self.lineEditMaxOutboundConnections))
|
self.lineEditMaxOutboundConnections.setValidator(QtGui.QIntValidator(0, 8, self.lineEditMaxOutboundConnections))
|
||||||
self.gridLayout_9.addWidget(self.lineEditMaxOutboundConnections, 2, 2, 1, 1)
|
self.gridLayout_9.addWidget(self.lineEditMaxOutboundConnections, 2, 2, 1, 1)
|
||||||
self.gridLayout_4.addWidget(self.groupBox_3, 2, 0, 1, 1)
|
self.gridLayout_4.addWidget(self.groupBox_3, 2, 0, 1, 1)
|
||||||
self.groupBox_2 = QtGui.QGroupBox(self.tabNetworkSettings)
|
self.groupBox_2 = QtWidgets.QGroupBox(self.tabNetworkSettings)
|
||||||
self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
|
self.groupBox_2.setObjectName("groupBox_2")
|
||||||
self.gridLayout_2 = QtGui.QGridLayout(self.groupBox_2)
|
self.gridLayout_2 = QtWidgets.QGridLayout(self.groupBox_2)
|
||||||
self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2"))
|
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||||
self.label_2 = QtGui.QLabel(self.groupBox_2)
|
self.label_2 = QtWidgets.QLabel(self.groupBox_2)
|
||||||
self.label_2.setObjectName(_fromUtf8("label_2"))
|
self.label_2.setObjectName("label_2")
|
||||||
self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1)
|
self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1)
|
||||||
self.label_3 = QtGui.QLabel(self.groupBox_2)
|
self.label_3 = QtWidgets.QLabel(self.groupBox_2)
|
||||||
self.label_3.setObjectName(_fromUtf8("label_3"))
|
self.label_3.setObjectName("label_3")
|
||||||
self.gridLayout_2.addWidget(self.label_3, 1, 1, 1, 1)
|
self.gridLayout_2.addWidget(self.label_3, 1, 1, 1, 1)
|
||||||
self.lineEditSocksHostname = QtGui.QLineEdit(self.groupBox_2)
|
self.lineEditSocksHostname = QtWidgets.QLineEdit(self.groupBox_2)
|
||||||
self.lineEditSocksHostname.setObjectName(_fromUtf8("lineEditSocksHostname"))
|
self.lineEditSocksHostname.setObjectName("lineEditSocksHostname")
|
||||||
self.lineEditSocksHostname.setPlaceholderText(_fromUtf8("127.0.0.1"))
|
self.lineEditSocksHostname.setPlaceholderText("127.0.0.1")
|
||||||
self.gridLayout_2.addWidget(self.lineEditSocksHostname, 1, 2, 1, 2)
|
self.gridLayout_2.addWidget(self.lineEditSocksHostname, 1, 2, 1, 2)
|
||||||
self.label_4 = QtGui.QLabel(self.groupBox_2)
|
self.label_4 = QtWidgets.QLabel(self.groupBox_2)
|
||||||
self.label_4.setObjectName(_fromUtf8("label_4"))
|
self.label_4.setObjectName("label_4")
|
||||||
self.gridLayout_2.addWidget(self.label_4, 1, 4, 1, 1)
|
self.gridLayout_2.addWidget(self.label_4, 1, 4, 1, 1)
|
||||||
self.lineEditSocksPort = QtGui.QLineEdit(self.groupBox_2)
|
self.lineEditSocksPort = QtWidgets.QLineEdit(self.groupBox_2)
|
||||||
self.lineEditSocksPort.setObjectName(_fromUtf8("lineEditSocksPort"))
|
self.lineEditSocksPort.setObjectName("lineEditSocksPort")
|
||||||
if platform in ['darwin', 'win32', 'win64']:
|
if platform in ['darwin', 'win32', 'win64']:
|
||||||
self.lineEditSocksPort.setPlaceholderText(_fromUtf8("9150"))
|
self.lineEditSocksPort.setPlaceholderText("9150")
|
||||||
else:
|
else:
|
||||||
self.lineEditSocksPort.setPlaceholderText(_fromUtf8("9050"))
|
self.lineEditSocksPort.setPlaceholderText("9050")
|
||||||
self.gridLayout_2.addWidget(self.lineEditSocksPort, 1, 5, 1, 1)
|
self.gridLayout_2.addWidget(self.lineEditSocksPort, 1, 5, 1, 1)
|
||||||
self.checkBoxAuthentication = QtGui.QCheckBox(self.groupBox_2)
|
self.checkBoxAuthentication = QtWidgets.QCheckBox(self.groupBox_2)
|
||||||
self.checkBoxAuthentication.setObjectName(_fromUtf8("checkBoxAuthentication"))
|
self.checkBoxAuthentication.setObjectName("checkBoxAuthentication")
|
||||||
self.gridLayout_2.addWidget(self.checkBoxAuthentication, 2, 1, 1, 1)
|
self.gridLayout_2.addWidget(self.checkBoxAuthentication, 2, 1, 1, 1)
|
||||||
self.label_5 = QtGui.QLabel(self.groupBox_2)
|
self.label_5 = QtWidgets.QLabel(self.groupBox_2)
|
||||||
self.label_5.setObjectName(_fromUtf8("label_5"))
|
self.label_5.setObjectName("label_5")
|
||||||
self.gridLayout_2.addWidget(self.label_5, 2, 2, 1, 1)
|
self.gridLayout_2.addWidget(self.label_5, 2, 2, 1, 1)
|
||||||
self.lineEditSocksUsername = QtGui.QLineEdit(self.groupBox_2)
|
self.lineEditSocksUsername = QtWidgets.QLineEdit(self.groupBox_2)
|
||||||
self.lineEditSocksUsername.setEnabled(False)
|
self.lineEditSocksUsername.setEnabled(False)
|
||||||
self.lineEditSocksUsername.setObjectName(_fromUtf8("lineEditSocksUsername"))
|
self.lineEditSocksUsername.setObjectName("lineEditSocksUsername")
|
||||||
self.gridLayout_2.addWidget(self.lineEditSocksUsername, 2, 3, 1, 1)
|
self.gridLayout_2.addWidget(self.lineEditSocksUsername, 2, 3, 1, 1)
|
||||||
self.label_6 = QtGui.QLabel(self.groupBox_2)
|
self.label_6 = QtWidgets.QLabel(self.groupBox_2)
|
||||||
self.label_6.setObjectName(_fromUtf8("label_6"))
|
self.label_6.setObjectName("label_6")
|
||||||
self.gridLayout_2.addWidget(self.label_6, 2, 4, 1, 1)
|
self.gridLayout_2.addWidget(self.label_6, 2, 4, 1, 1)
|
||||||
self.lineEditSocksPassword = QtGui.QLineEdit(self.groupBox_2)
|
self.lineEditSocksPassword = QtWidgets.QLineEdit(self.groupBox_2)
|
||||||
self.lineEditSocksPassword.setEnabled(False)
|
self.lineEditSocksPassword.setEnabled(False)
|
||||||
self.lineEditSocksPassword.setInputMethodHints(QtCore.Qt.ImhHiddenText|QtCore.Qt.ImhNoAutoUppercase|QtCore.Qt.ImhNoPredictiveText)
|
self.lineEditSocksPassword.setInputMethodHints(QtCore.Qt.ImhHiddenText|QtCore.Qt.ImhNoAutoUppercase|QtCore.Qt.ImhNoPredictiveText)
|
||||||
self.lineEditSocksPassword.setEchoMode(QtGui.QLineEdit.Password)
|
self.lineEditSocksPassword.setEchoMode(QtWidgets.QLineEdit.Password)
|
||||||
self.lineEditSocksPassword.setObjectName(_fromUtf8("lineEditSocksPassword"))
|
self.lineEditSocksPassword.setObjectName("lineEditSocksPassword")
|
||||||
self.gridLayout_2.addWidget(self.lineEditSocksPassword, 2, 5, 1, 1)
|
self.gridLayout_2.addWidget(self.lineEditSocksPassword, 2, 5, 1, 1)
|
||||||
self.checkBoxSocksListen = QtGui.QCheckBox(self.groupBox_2)
|
self.checkBoxSocksListen = QtWidgets.QCheckBox(self.groupBox_2)
|
||||||
self.checkBoxSocksListen.setObjectName(_fromUtf8("checkBoxSocksListen"))
|
self.checkBoxSocksListen.setObjectName("checkBoxSocksListen")
|
||||||
self.gridLayout_2.addWidget(self.checkBoxSocksListen, 3, 1, 1, 4)
|
self.gridLayout_2.addWidget(self.checkBoxSocksListen, 3, 1, 1, 4)
|
||||||
self.comboBoxProxyType = QtGui.QComboBox(self.groupBox_2)
|
self.comboBoxProxyType = QtWidgets.QComboBox(self.groupBox_2)
|
||||||
self.comboBoxProxyType.setObjectName(_fromUtf8("comboBoxProxyType"))
|
self.comboBoxProxyType.setObjectName("comboBoxProxyType")
|
||||||
self.comboBoxProxyType.addItem(_fromUtf8(""))
|
self.comboBoxProxyType.addItem("")
|
||||||
self.comboBoxProxyType.addItem(_fromUtf8(""))
|
self.comboBoxProxyType.addItem("")
|
||||||
self.comboBoxProxyType.addItem(_fromUtf8(""))
|
self.comboBoxProxyType.addItem("")
|
||||||
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)
|
||||||
spacerItem2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
self.gridLayout_4.addItem(spacerItem2, 3, 0, 1, 1)
|
self.gridLayout_4.addItem(spacerItem2, 3, 0, 1, 1)
|
||||||
self.tabWidgetSettings.addTab(self.tabNetworkSettings, _fromUtf8(""))
|
self.tabWidgetSettings.addTab(self.tabNetworkSettings, "")
|
||||||
self.tabDemandedDifficulty = QtGui.QWidget()
|
self.tabDemandedDifficulty = QtWidgets.QWidget()
|
||||||
self.tabDemandedDifficulty.setObjectName(_fromUtf8("tabDemandedDifficulty"))
|
self.tabDemandedDifficulty.setObjectName("tabDemandedDifficulty")
|
||||||
self.gridLayout_6 = QtGui.QGridLayout(self.tabDemandedDifficulty)
|
self.gridLayout_6 = QtWidgets.QGridLayout(self.tabDemandedDifficulty)
|
||||||
self.gridLayout_6.setObjectName(_fromUtf8("gridLayout_6"))
|
self.gridLayout_6.setObjectName("gridLayout_6")
|
||||||
self.label_9 = QtGui.QLabel(self.tabDemandedDifficulty)
|
self.label_9 = QtWidgets.QLabel(self.tabDemandedDifficulty)
|
||||||
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("label_9")
|
||||||
self.gridLayout_6.addWidget(self.label_9, 1, 1, 1, 1)
|
self.gridLayout_6.addWidget(self.label_9, 1, 1, 1, 1)
|
||||||
self.label_10 = QtGui.QLabel(self.tabDemandedDifficulty)
|
self.label_10 = QtWidgets.QLabel(self.tabDemandedDifficulty)
|
||||||
self.label_10.setWordWrap(True)
|
self.label_10.setWordWrap(True)
|
||||||
self.label_10.setObjectName(_fromUtf8("label_10"))
|
self.label_10.setObjectName("label_10")
|
||||||
self.gridLayout_6.addWidget(self.label_10, 2, 0, 1, 3)
|
self.gridLayout_6.addWidget(self.label_10, 2, 0, 1, 3)
|
||||||
self.label_11 = QtGui.QLabel(self.tabDemandedDifficulty)
|
self.label_11 = QtWidgets.QLabel(self.tabDemandedDifficulty)
|
||||||
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("label_11")
|
||||||
self.gridLayout_6.addWidget(self.label_11, 3, 1, 1, 1)
|
self.gridLayout_6.addWidget(self.label_11, 3, 1, 1, 1)
|
||||||
self.label_8 = QtGui.QLabel(self.tabDemandedDifficulty)
|
self.label_8 = QtWidgets.QLabel(self.tabDemandedDifficulty)
|
||||||
self.label_8.setWordWrap(True)
|
self.label_8.setWordWrap(True)
|
||||||
self.label_8.setObjectName(_fromUtf8("label_8"))
|
self.label_8.setObjectName("label_8")
|
||||||
self.gridLayout_6.addWidget(self.label_8, 0, 0, 1, 3)
|
self.gridLayout_6.addWidget(self.label_8, 0, 0, 1, 3)
|
||||||
spacerItem3 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
spacerItem3 = QtWidgets.QSpacerItem(203, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.gridLayout_6.addItem(spacerItem3, 1, 0, 1, 1)
|
self.gridLayout_6.addItem(spacerItem3, 1, 0, 1, 1)
|
||||||
self.label_12 = QtGui.QLabel(self.tabDemandedDifficulty)
|
self.label_12 = QtWidgets.QLabel(self.tabDemandedDifficulty)
|
||||||
self.label_12.setWordWrap(True)
|
self.label_12.setWordWrap(True)
|
||||||
self.label_12.setObjectName(_fromUtf8("label_12"))
|
self.label_12.setObjectName("label_12")
|
||||||
self.gridLayout_6.addWidget(self.label_12, 4, 0, 1, 3)
|
self.gridLayout_6.addWidget(self.label_12, 4, 0, 1, 3)
|
||||||
self.lineEditSmallMessageDifficulty = QtGui.QLineEdit(self.tabDemandedDifficulty)
|
self.lineEditSmallMessageDifficulty = QtWidgets.QLineEdit(self.tabDemandedDifficulty)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.lineEditSmallMessageDifficulty.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.lineEditSmallMessageDifficulty.sizePolicy().hasHeightForWidth())
|
||||||
self.lineEditSmallMessageDifficulty.setSizePolicy(sizePolicy)
|
self.lineEditSmallMessageDifficulty.setSizePolicy(sizePolicy)
|
||||||
self.lineEditSmallMessageDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
self.lineEditSmallMessageDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
||||||
self.lineEditSmallMessageDifficulty.setObjectName(_fromUtf8("lineEditSmallMessageDifficulty"))
|
self.lineEditSmallMessageDifficulty.setObjectName("lineEditSmallMessageDifficulty")
|
||||||
self.gridLayout_6.addWidget(self.lineEditSmallMessageDifficulty, 3, 2, 1, 1)
|
self.gridLayout_6.addWidget(self.lineEditSmallMessageDifficulty, 3, 2, 1, 1)
|
||||||
self.lineEditTotalDifficulty = QtGui.QLineEdit(self.tabDemandedDifficulty)
|
self.lineEditTotalDifficulty = QtWidgets.QLineEdit(self.tabDemandedDifficulty)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.lineEditTotalDifficulty.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.lineEditTotalDifficulty.sizePolicy().hasHeightForWidth())
|
||||||
self.lineEditTotalDifficulty.setSizePolicy(sizePolicy)
|
self.lineEditTotalDifficulty.setSizePolicy(sizePolicy)
|
||||||
self.lineEditTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
self.lineEditTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
||||||
self.lineEditTotalDifficulty.setObjectName(_fromUtf8("lineEditTotalDifficulty"))
|
self.lineEditTotalDifficulty.setObjectName("lineEditTotalDifficulty")
|
||||||
self.gridLayout_6.addWidget(self.lineEditTotalDifficulty, 1, 2, 1, 1)
|
self.gridLayout_6.addWidget(self.lineEditTotalDifficulty, 1, 2, 1, 1)
|
||||||
spacerItem4 = QtGui.QSpacerItem(203, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
spacerItem4 = QtWidgets.QSpacerItem(203, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.gridLayout_6.addItem(spacerItem4, 3, 0, 1, 1)
|
self.gridLayout_6.addItem(spacerItem4, 3, 0, 1, 1)
|
||||||
spacerItem5 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
spacerItem5 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
self.gridLayout_6.addItem(spacerItem5, 5, 0, 1, 1)
|
self.gridLayout_6.addItem(spacerItem5, 5, 0, 1, 1)
|
||||||
self.tabWidgetSettings.addTab(self.tabDemandedDifficulty, _fromUtf8(""))
|
self.tabWidgetSettings.addTab(self.tabDemandedDifficulty, "")
|
||||||
self.tabMaxAcceptableDifficulty = QtGui.QWidget()
|
self.tabMaxAcceptableDifficulty = QtWidgets.QWidget()
|
||||||
self.tabMaxAcceptableDifficulty.setObjectName(_fromUtf8("tabMaxAcceptableDifficulty"))
|
self.tabMaxAcceptableDifficulty.setObjectName("tabMaxAcceptableDifficulty")
|
||||||
self.gridLayout_7 = QtGui.QGridLayout(self.tabMaxAcceptableDifficulty)
|
self.gridLayout_7 = QtWidgets.QGridLayout(self.tabMaxAcceptableDifficulty)
|
||||||
self.gridLayout_7.setObjectName(_fromUtf8("gridLayout_7"))
|
self.gridLayout_7.setObjectName("gridLayout_7")
|
||||||
self.label_15 = QtGui.QLabel(self.tabMaxAcceptableDifficulty)
|
self.label_15 = QtWidgets.QLabel(self.tabMaxAcceptableDifficulty)
|
||||||
self.label_15.setWordWrap(True)
|
self.label_15.setWordWrap(True)
|
||||||
self.label_15.setObjectName(_fromUtf8("label_15"))
|
self.label_15.setObjectName("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)
|
spacerItem6 = QtWidgets.QSpacerItem(102, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.gridLayout_7.addItem(spacerItem6, 1, 0, 1, 1)
|
self.gridLayout_7.addItem(spacerItem6, 1, 0, 1, 1)
|
||||||
self.label_13 = QtGui.QLabel(self.tabMaxAcceptableDifficulty)
|
self.label_13 = QtWidgets.QLabel(self.tabMaxAcceptableDifficulty)
|
||||||
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)
|
||||||
self.label_13.setObjectName(_fromUtf8("label_13"))
|
self.label_13.setObjectName("label_13")
|
||||||
self.gridLayout_7.addWidget(self.label_13, 1, 1, 1, 1)
|
self.gridLayout_7.addWidget(self.label_13, 1, 1, 1, 1)
|
||||||
self.lineEditMaxAcceptableTotalDifficulty = QtGui.QLineEdit(self.tabMaxAcceptableDifficulty)
|
self.lineEditMaxAcceptableTotalDifficulty = QtWidgets.QLineEdit(self.tabMaxAcceptableDifficulty)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.lineEditMaxAcceptableTotalDifficulty.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.lineEditMaxAcceptableTotalDifficulty.sizePolicy().hasHeightForWidth())
|
||||||
self.lineEditMaxAcceptableTotalDifficulty.setSizePolicy(sizePolicy)
|
self.lineEditMaxAcceptableTotalDifficulty.setSizePolicy(sizePolicy)
|
||||||
self.lineEditMaxAcceptableTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
self.lineEditMaxAcceptableTotalDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
||||||
self.lineEditMaxAcceptableTotalDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableTotalDifficulty"))
|
self.lineEditMaxAcceptableTotalDifficulty.setObjectName("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)
|
spacerItem7 = QtWidgets.QSpacerItem(102, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.gridLayout_7.addItem(spacerItem7, 2, 0, 1, 1)
|
self.gridLayout_7.addItem(spacerItem7, 2, 0, 1, 1)
|
||||||
self.label_14 = QtGui.QLabel(self.tabMaxAcceptableDifficulty)
|
self.label_14 = QtWidgets.QLabel(self.tabMaxAcceptableDifficulty)
|
||||||
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("label_14")
|
||||||
self.gridLayout_7.addWidget(self.label_14, 2, 1, 1, 1)
|
self.gridLayout_7.addWidget(self.label_14, 2, 1, 1, 1)
|
||||||
self.lineEditMaxAcceptableSmallMessageDifficulty = QtGui.QLineEdit(self.tabMaxAcceptableDifficulty)
|
self.lineEditMaxAcceptableSmallMessageDifficulty = QtWidgets.QLineEdit(self.tabMaxAcceptableDifficulty)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(self.lineEditMaxAcceptableSmallMessageDifficulty.sizePolicy().hasHeightForWidth())
|
sizePolicy.setHeightForWidth(self.lineEditMaxAcceptableSmallMessageDifficulty.sizePolicy().hasHeightForWidth())
|
||||||
self.lineEditMaxAcceptableSmallMessageDifficulty.setSizePolicy(sizePolicy)
|
self.lineEditMaxAcceptableSmallMessageDifficulty.setSizePolicy(sizePolicy)
|
||||||
self.lineEditMaxAcceptableSmallMessageDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
self.lineEditMaxAcceptableSmallMessageDifficulty.setMaximumSize(QtCore.QSize(70, 16777215))
|
||||||
self.lineEditMaxAcceptableSmallMessageDifficulty.setObjectName(_fromUtf8("lineEditMaxAcceptableSmallMessageDifficulty"))
|
self.lineEditMaxAcceptableSmallMessageDifficulty.setObjectName("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)
|
spacerItem8 = QtWidgets.QSpacerItem(20, 147, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
self.gridLayout_7.addItem(spacerItem8, 3, 1, 1, 1)
|
self.gridLayout_7.addItem(spacerItem8, 3, 1, 1, 1)
|
||||||
self.labelOpenCL = QtGui.QLabel(self.tabMaxAcceptableDifficulty)
|
self.labelOpenCL = QtWidgets.QLabel(self.tabMaxAcceptableDifficulty)
|
||||||
self.labelOpenCL.setObjectName(_fromUtf8("labelOpenCL"))
|
self.labelOpenCL.setObjectName("labelOpenCL")
|
||||||
self.gridLayout_7.addWidget(self.labelOpenCL, 4, 0, 1, 1)
|
self.gridLayout_7.addWidget(self.labelOpenCL, 4, 0, 1, 1)
|
||||||
self.comboBoxOpenCL = QtGui.QComboBox(self.tabMaxAcceptableDifficulty)
|
self.comboBoxOpenCL = QtWidgets.QComboBox(self.tabMaxAcceptableDifficulty)
|
||||||
self.comboBoxOpenCL.setObjectName = (_fromUtf8("comboBoxOpenCL"))
|
self.comboBoxOpenCL.setObjectName = ("comboBoxOpenCL")
|
||||||
self.gridLayout_7.addWidget(self.comboBoxOpenCL, 4, 1, 1, 1)
|
self.gridLayout_7.addWidget(self.comboBoxOpenCL, 4, 1, 1, 1)
|
||||||
self.tabWidgetSettings.addTab(self.tabMaxAcceptableDifficulty, _fromUtf8(""))
|
self.tabWidgetSettings.addTab(self.tabMaxAcceptableDifficulty, "")
|
||||||
self.tabNamecoin = QtGui.QWidget()
|
self.tabNamecoin = QtWidgets.QWidget()
|
||||||
self.tabNamecoin.setObjectName(_fromUtf8("tabNamecoin"))
|
self.tabNamecoin.setObjectName("tabNamecoin")
|
||||||
self.gridLayout_8 = QtGui.QGridLayout(self.tabNamecoin)
|
self.gridLayout_8 = QtWidgets.QGridLayout(self.tabNamecoin)
|
||||||
self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8"))
|
self.gridLayout_8.setObjectName("gridLayout_8")
|
||||||
spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.gridLayout_8.addItem(spacerItem9, 2, 0, 1, 1)
|
self.gridLayout_8.addItem(spacerItem9, 2, 0, 1, 1)
|
||||||
self.label_16 = QtGui.QLabel(self.tabNamecoin)
|
self.label_16 = QtWidgets.QLabel(self.tabNamecoin)
|
||||||
self.label_16.setWordWrap(True)
|
self.label_16.setWordWrap(True)
|
||||||
self.label_16.setObjectName(_fromUtf8("label_16"))
|
self.label_16.setObjectName("label_16")
|
||||||
self.gridLayout_8.addWidget(self.label_16, 0, 0, 1, 3)
|
self.gridLayout_8.addWidget(self.label_16, 0, 0, 1, 3)
|
||||||
self.label_17 = QtGui.QLabel(self.tabNamecoin)
|
self.label_17 = QtWidgets.QLabel(self.tabNamecoin)
|
||||||
self.label_17.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
self.label_17.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||||
self.label_17.setObjectName(_fromUtf8("label_17"))
|
self.label_17.setObjectName("label_17")
|
||||||
self.gridLayout_8.addWidget(self.label_17, 2, 1, 1, 1)
|
self.gridLayout_8.addWidget(self.label_17, 2, 1, 1, 1)
|
||||||
self.lineEditNamecoinHost = QtGui.QLineEdit(self.tabNamecoin)
|
self.lineEditNamecoinHost = QtWidgets.QLineEdit(self.tabNamecoin)
|
||||||
self.lineEditNamecoinHost.setObjectName(_fromUtf8("lineEditNamecoinHost"))
|
self.lineEditNamecoinHost.setObjectName("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)
|
spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.gridLayout_8.addItem(spacerItem10, 3, 0, 1, 1)
|
self.gridLayout_8.addItem(spacerItem10, 3, 0, 1, 1)
|
||||||
spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.gridLayout_8.addItem(spacerItem11, 4, 0, 1, 1)
|
self.gridLayout_8.addItem(spacerItem11, 4, 0, 1, 1)
|
||||||
self.label_18 = QtGui.QLabel(self.tabNamecoin)
|
self.label_18 = QtWidgets.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)
|
||||||
self.label_18.setObjectName(_fromUtf8("label_18"))
|
self.label_18.setObjectName("label_18")
|
||||||
self.gridLayout_8.addWidget(self.label_18, 3, 1, 1, 1)
|
self.gridLayout_8.addWidget(self.label_18, 3, 1, 1, 1)
|
||||||
self.lineEditNamecoinPort = QtGui.QLineEdit(self.tabNamecoin)
|
self.lineEditNamecoinPort = QtWidgets.QLineEdit(self.tabNamecoin)
|
||||||
self.lineEditNamecoinPort.setObjectName(_fromUtf8("lineEditNamecoinPort"))
|
self.lineEditNamecoinPort.setObjectName("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)
|
spacerItem12 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
self.gridLayout_8.addItem(spacerItem12, 8, 1, 1, 1)
|
self.gridLayout_8.addItem(spacerItem12, 8, 1, 1, 1)
|
||||||
self.labelNamecoinUser = QtGui.QLabel(self.tabNamecoin)
|
self.labelNamecoinUser = QtWidgets.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("labelNamecoinUser")
|
||||||
self.gridLayout_8.addWidget(self.labelNamecoinUser, 4, 1, 1, 1)
|
self.gridLayout_8.addWidget(self.labelNamecoinUser, 4, 1, 1, 1)
|
||||||
self.lineEditNamecoinUser = QtGui.QLineEdit(self.tabNamecoin)
|
self.lineEditNamecoinUser = QtWidgets.QLineEdit(self.tabNamecoin)
|
||||||
self.lineEditNamecoinUser.setObjectName(_fromUtf8("lineEditNamecoinUser"))
|
self.lineEditNamecoinUser.setObjectName("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)
|
spacerItem13 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.gridLayout_8.addItem(spacerItem13, 5, 0, 1, 1)
|
self.gridLayout_8.addItem(spacerItem13, 5, 0, 1, 1)
|
||||||
self.labelNamecoinPassword = QtGui.QLabel(self.tabNamecoin)
|
self.labelNamecoinPassword = QtWidgets.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("labelNamecoinPassword")
|
||||||
self.gridLayout_8.addWidget(self.labelNamecoinPassword, 5, 1, 1, 1)
|
self.gridLayout_8.addWidget(self.labelNamecoinPassword, 5, 1, 1, 1)
|
||||||
self.lineEditNamecoinPassword = QtGui.QLineEdit(self.tabNamecoin)
|
self.lineEditNamecoinPassword = QtWidgets.QLineEdit(self.tabNamecoin)
|
||||||
self.lineEditNamecoinPassword.setInputMethodHints(QtCore.Qt.ImhHiddenText|QtCore.Qt.ImhNoAutoUppercase|QtCore.Qt.ImhNoPredictiveText)
|
self.lineEditNamecoinPassword.setInputMethodHints(QtCore.Qt.ImhHiddenText|QtCore.Qt.ImhNoAutoUppercase|QtCore.Qt.ImhNoPredictiveText)
|
||||||
self.lineEditNamecoinPassword.setEchoMode(QtGui.QLineEdit.Password)
|
self.lineEditNamecoinPassword.setEchoMode(QtWidgets.QLineEdit.Password)
|
||||||
self.lineEditNamecoinPassword.setObjectName(_fromUtf8("lineEditNamecoinPassword"))
|
self.lineEditNamecoinPassword.setObjectName("lineEditNamecoinPassword")
|
||||||
self.gridLayout_8.addWidget(self.lineEditNamecoinPassword, 5, 2, 1, 1)
|
self.gridLayout_8.addWidget(self.lineEditNamecoinPassword, 5, 2, 1, 1)
|
||||||
self.labelNamecoinTestResult = QtGui.QLabel(self.tabNamecoin)
|
self.labelNamecoinTestResult = QtWidgets.QLabel(self.tabNamecoin)
|
||||||
self.labelNamecoinTestResult.setText(_fromUtf8(""))
|
self.labelNamecoinTestResult.setText("")
|
||||||
self.labelNamecoinTestResult.setObjectName(_fromUtf8("labelNamecoinTestResult"))
|
self.labelNamecoinTestResult.setObjectName("labelNamecoinTestResult")
|
||||||
self.gridLayout_8.addWidget(self.labelNamecoinTestResult, 7, 0, 1, 2)
|
self.gridLayout_8.addWidget(self.labelNamecoinTestResult, 7, 0, 1, 2)
|
||||||
self.pushButtonNamecoinTest = QtGui.QPushButton(self.tabNamecoin)
|
self.pushButtonNamecoinTest = QtWidgets.QPushButton(self.tabNamecoin)
|
||||||
self.pushButtonNamecoinTest.setObjectName(_fromUtf8("pushButtonNamecoinTest"))
|
self.pushButtonNamecoinTest.setObjectName("pushButtonNamecoinTest")
|
||||||
self.gridLayout_8.addWidget(self.pushButtonNamecoinTest, 7, 2, 1, 1)
|
self.gridLayout_8.addWidget(self.pushButtonNamecoinTest, 7, 2, 1, 1)
|
||||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
self.label_21 = QtGui.QLabel(self.tabNamecoin)
|
self.label_21 = QtWidgets.QLabel(self.tabNamecoin)
|
||||||
self.label_21.setObjectName(_fromUtf8("label_21"))
|
self.label_21.setObjectName("label_21")
|
||||||
self.horizontalLayout.addWidget(self.label_21)
|
self.horizontalLayout.addWidget(self.label_21)
|
||||||
self.radioButtonNamecoinNamecoind = QtGui.QRadioButton(self.tabNamecoin)
|
self.radioButtonNamecoinNamecoind = QtWidgets.QRadioButton(self.tabNamecoin)
|
||||||
self.radioButtonNamecoinNamecoind.setObjectName(_fromUtf8("radioButtonNamecoinNamecoind"))
|
self.radioButtonNamecoinNamecoind.setObjectName("radioButtonNamecoinNamecoind")
|
||||||
self.horizontalLayout.addWidget(self.radioButtonNamecoinNamecoind)
|
self.horizontalLayout.addWidget(self.radioButtonNamecoinNamecoind)
|
||||||
self.radioButtonNamecoinNmcontrol = QtGui.QRadioButton(self.tabNamecoin)
|
self.radioButtonNamecoinNmcontrol = QtWidgets.QRadioButton(self.tabNamecoin)
|
||||||
self.radioButtonNamecoinNmcontrol.setObjectName(_fromUtf8("radioButtonNamecoinNmcontrol"))
|
self.radioButtonNamecoinNmcontrol.setObjectName("radioButtonNamecoinNmcontrol")
|
||||||
self.horizontalLayout.addWidget(self.radioButtonNamecoinNmcontrol)
|
self.horizontalLayout.addWidget(self.radioButtonNamecoinNmcontrol)
|
||||||
self.gridLayout_8.addLayout(self.horizontalLayout, 1, 0, 1, 3)
|
self.gridLayout_8.addLayout(self.horizontalLayout, 1, 0, 1, 3)
|
||||||
self.tabWidgetSettings.addTab(self.tabNamecoin, _fromUtf8(""))
|
self.tabWidgetSettings.addTab(self.tabNamecoin, "")
|
||||||
self.tabResendsExpire = QtGui.QWidget()
|
self.tabResendsExpire = QtWidgets.QWidget()
|
||||||
self.tabResendsExpire.setObjectName(_fromUtf8("tabResendsExpire"))
|
self.tabResendsExpire.setObjectName("tabResendsExpire")
|
||||||
self.gridLayout_5 = QtGui.QGridLayout(self.tabResendsExpire)
|
self.gridLayout_5 = QtWidgets.QGridLayout(self.tabResendsExpire)
|
||||||
self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
|
self.gridLayout_5.setObjectName("gridLayout_5")
|
||||||
self.label_7 = QtGui.QLabel(self.tabResendsExpire)
|
self.label_7 = QtWidgets.QLabel(self.tabResendsExpire)
|
||||||
self.label_7.setWordWrap(True)
|
self.label_7.setWordWrap(True)
|
||||||
self.label_7.setObjectName(_fromUtf8("label_7"))
|
self.label_7.setObjectName("label_7")
|
||||||
self.gridLayout_5.addWidget(self.label_7, 0, 0, 1, 3)
|
self.gridLayout_5.addWidget(self.label_7, 0, 0, 1, 3)
|
||||||
spacerItem14 = QtGui.QSpacerItem(212, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
spacerItem14 = QtWidgets.QSpacerItem(212, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
self.gridLayout_5.addItem(spacerItem14, 1, 0, 1, 1)
|
self.gridLayout_5.addItem(spacerItem14, 1, 0, 1, 1)
|
||||||
self.widget = QtGui.QWidget(self.tabResendsExpire)
|
self.widget = QtWidgets.QWidget(self.tabResendsExpire)
|
||||||
self.widget.setMinimumSize(QtCore.QSize(231, 75))
|
self.widget.setMinimumSize(QtCore.QSize(231, 75))
|
||||||
self.widget.setObjectName(_fromUtf8("widget"))
|
self.widget.setObjectName("widget")
|
||||||
self.label_19 = QtGui.QLabel(self.widget)
|
self.label_19 = QtWidgets.QLabel(self.widget)
|
||||||
self.label_19.setGeometry(QtCore.QRect(10, 20, 101, 20))
|
self.label_19.setGeometry(QtCore.QRect(10, 20, 101, 20))
|
||||||
self.label_19.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
self.label_19.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||||
self.label_19.setObjectName(_fromUtf8("label_19"))
|
self.label_19.setObjectName("label_19")
|
||||||
self.label_20 = QtGui.QLabel(self.widget)
|
self.label_20 = QtWidgets.QLabel(self.widget)
|
||||||
self.label_20.setGeometry(QtCore.QRect(30, 40, 80, 16))
|
self.label_20.setGeometry(QtCore.QRect(30, 40, 80, 16))
|
||||||
self.label_20.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
self.label_20.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||||
self.label_20.setObjectName(_fromUtf8("label_20"))
|
self.label_20.setObjectName("label_20")
|
||||||
self.lineEditDays = QtGui.QLineEdit(self.widget)
|
self.lineEditDays = QtWidgets.QLineEdit(self.widget)
|
||||||
self.lineEditDays.setGeometry(QtCore.QRect(113, 20, 51, 20))
|
self.lineEditDays.setGeometry(QtCore.QRect(113, 20, 51, 20))
|
||||||
self.lineEditDays.setObjectName(_fromUtf8("lineEditDays"))
|
self.lineEditDays.setObjectName("lineEditDays")
|
||||||
self.lineEditMonths = QtGui.QLineEdit(self.widget)
|
self.lineEditMonths = QtWidgets.QLineEdit(self.widget)
|
||||||
self.lineEditMonths.setGeometry(QtCore.QRect(113, 40, 51, 20))
|
self.lineEditMonths.setGeometry(QtCore.QRect(113, 40, 51, 20))
|
||||||
self.lineEditMonths.setObjectName(_fromUtf8("lineEditMonths"))
|
self.lineEditMonths.setObjectName("lineEditMonths")
|
||||||
self.label_22 = QtGui.QLabel(self.widget)
|
self.label_22 = QtWidgets.QLabel(self.widget)
|
||||||
self.label_22.setGeometry(QtCore.QRect(169, 23, 61, 16))
|
self.label_22.setGeometry(QtCore.QRect(169, 23, 61, 16))
|
||||||
self.label_22.setObjectName(_fromUtf8("label_22"))
|
self.label_22.setObjectName("label_22")
|
||||||
self.label_23 = QtGui.QLabel(self.widget)
|
self.label_23 = QtWidgets.QLabel(self.widget)
|
||||||
self.label_23.setGeometry(QtCore.QRect(170, 41, 71, 16))
|
self.label_23.setGeometry(QtCore.QRect(170, 41, 71, 16))
|
||||||
self.label_23.setObjectName(_fromUtf8("label_23"))
|
self.label_23.setObjectName("label_23")
|
||||||
self.gridLayout_5.addWidget(self.widget, 1, 2, 1, 1)
|
self.gridLayout_5.addWidget(self.widget, 1, 2, 1, 1)
|
||||||
spacerItem15 = QtGui.QSpacerItem(20, 129, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
spacerItem15 = QtWidgets.QSpacerItem(20, 129, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
self.gridLayout_5.addItem(spacerItem15, 2, 1, 1, 1)
|
self.gridLayout_5.addItem(spacerItem15, 2, 1, 1, 1)
|
||||||
self.tabWidgetSettings.addTab(self.tabResendsExpire, _fromUtf8(""))
|
self.tabWidgetSettings.addTab(self.tabResendsExpire, "")
|
||||||
self.gridLayout.addWidget(self.tabWidgetSettings, 0, 0, 1, 1)
|
self.gridLayout.addWidget(self.tabWidgetSettings, 0, 0, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(settingsDialog)
|
self.retranslateUi(settingsDialog)
|
||||||
self.tabWidgetSettings.setCurrentIndex(0)
|
self.tabWidgetSettings.setCurrentIndex(0)
|
||||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), settingsDialog.accept)
|
|
||||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), settingsDialog.reject)
|
self.buttonBox.accepted.connect(settingsDialog.accept)
|
||||||
QtCore.QObject.connect(self.checkBoxAuthentication, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.lineEditSocksUsername.setEnabled)
|
self.buttonBox.rejected.connect(settingsDialog.reject)
|
||||||
QtCore.QObject.connect(self.checkBoxAuthentication, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.lineEditSocksPassword.setEnabled)
|
self.checkBoxAuthentication.toggled.connect(
|
||||||
|
self.lineEditSocksUsername.setEnabled)
|
||||||
|
self.checkBoxAuthentication.toggled.connect(
|
||||||
|
self.lineEditSocksPassword.setEnabled)
|
||||||
|
|
||||||
QtCore.QMetaObject.connectSlotsByName(settingsDialog)
|
QtCore.QMetaObject.connectSlotsByName(settingsDialog)
|
||||||
|
|
||||||
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)
|
||||||
|
@ -512,5 +497,3 @@ class Ui_settingsDialog(object):
|
||||||
self.label_22.setText(_translate("settingsDialog", "days", None))
|
self.label_22.setText(_translate("settingsDialog", "days", None))
|
||||||
self.label_23.setText(_translate("settingsDialog", "months.", None))
|
self.label_23.setText(_translate("settingsDialog", "months.", None))
|
||||||
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabResendsExpire), _translate("settingsDialog", "Resends Expire", None))
|
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabResendsExpire), _translate("settingsDialog", "Resends Expire", None))
|
||||||
|
|
||||||
import bitmessage_icons_rc
|
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
#!/usr/bin/python2.7
|
from qtpy import QtCore, QtWidgets
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
|
||||||
|
|
||||||
class SettingsMixin(object):
|
class SettingsMixin(object):
|
||||||
def warnIfNoObjectName(self):
|
def warnIfNoObjectName(self):
|
||||||
if self.objectName() == "":
|
if self.objectName() == "":
|
||||||
# TODO: logger
|
# TODO: logger
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def writeState(self, source):
|
def writeState(self, source):
|
||||||
self.warnIfNoObjectName()
|
self.warnIfNoObjectName()
|
||||||
settings = QtCore.QSettings()
|
settings = QtCore.QSettings()
|
||||||
settings.beginGroup(self.objectName())
|
settings.beginGroup(self.objectName())
|
||||||
settings.setValue("state", source.saveState())
|
settings.setValue("state", source.saveState())
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
def writeGeometry(self, source):
|
def writeGeometry(self, source):
|
||||||
self.warnIfNoObjectName()
|
self.warnIfNoObjectName()
|
||||||
settings = QtCore.QSettings()
|
settings = QtCore.QSettings()
|
||||||
settings.beginGroup(self.objectName())
|
settings.beginGroup(self.objectName())
|
||||||
settings.setValue("geometry", source.saveGeometry())
|
settings.setValue("geometry", source.saveGeometry())
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
def readGeometry(self, target):
|
def readGeometry(self, target):
|
||||||
self.warnIfNoObjectName()
|
self.warnIfNoObjectName()
|
||||||
settings = QtCore.QSettings()
|
settings = QtCore.QSettings()
|
||||||
try:
|
try:
|
||||||
geom = settings.value("/".join([str(self.objectName()), "geometry"]))
|
geom = settings.value(
|
||||||
target.restoreGeometry(geom.toByteArray() if hasattr(geom, 'toByteArray') else geom)
|
"/".join([str(self.objectName()), "geometry"]))
|
||||||
except Exception as e:
|
target.restoreGeometry(geom)
|
||||||
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def readState(self, target):
|
def readState(self, target):
|
||||||
|
@ -36,44 +36,44 @@ class SettingsMixin(object):
|
||||||
settings = QtCore.QSettings()
|
settings = QtCore.QSettings()
|
||||||
try:
|
try:
|
||||||
state = settings.value("/".join([str(self.objectName()), "state"]))
|
state = settings.value("/".join([str(self.objectName()), "state"]))
|
||||||
target.restoreState(state.toByteArray() if hasattr(state, 'toByteArray') else state)
|
target.restoreState(state)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SMainWindow(QtGui.QMainWindow, SettingsMixin):
|
class SMainWindow(QtWidgets.QMainWindow, SettingsMixin):
|
||||||
def loadSettings(self):
|
def loadSettings(self):
|
||||||
self.readGeometry(self)
|
self.readGeometry(self)
|
||||||
self.readState(self)
|
self.readState(self)
|
||||||
|
|
||||||
def saveSettings(self):
|
def saveSettings(self):
|
||||||
self.writeState(self)
|
self.writeState(self)
|
||||||
self.writeGeometry(self)
|
self.writeGeometry(self)
|
||||||
|
|
||||||
|
|
||||||
class STableWidget(QtGui.QTableWidget, SettingsMixin):
|
class STableWidget(QtWidgets.QTableWidget, SettingsMixin):
|
||||||
def loadSettings(self):
|
def loadSettings(self):
|
||||||
self.readState(self.horizontalHeader())
|
self.readState(self.horizontalHeader())
|
||||||
|
|
||||||
def saveSettings(self):
|
def saveSettings(self):
|
||||||
self.writeState(self.horizontalHeader())
|
self.writeState(self.horizontalHeader())
|
||||||
|
|
||||||
|
|
||||||
class SSplitter(QtGui.QSplitter, SettingsMixin):
|
class SSplitter(QtWidgets.QSplitter, SettingsMixin):
|
||||||
def loadSettings(self):
|
def loadSettings(self):
|
||||||
self.readState(self)
|
self.readState(self)
|
||||||
|
|
||||||
def saveSettings(self):
|
def saveSettings(self):
|
||||||
self.writeState(self)
|
self.writeState(self)
|
||||||
|
|
||||||
|
|
||||||
class STreeWidget(QtGui.QTreeWidget, SettingsMixin):
|
|
||||||
|
class STreeWidget(QtWidgets.QTreeWidget, SettingsMixin):
|
||||||
def loadSettings(self):
|
def loadSettings(self):
|
||||||
#recurse children
|
# recurse children
|
||||||
#self.readState(self)
|
# self.readState(self)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def saveSettings(self):
|
def saveSettings(self):
|
||||||
#recurse children
|
# recurse children
|
||||||
#self.writeState(self)
|
# self.writeState(self)
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from PyQt4 import QtCore, QtGui
|
from qtpy import QtWidgets
|
||||||
from Queue import Queue
|
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
class BMStatusBar(QtGui.QStatusBar):
|
|
||||||
|
class BMStatusBar(QtWidgets.QStatusBar):
|
||||||
duration = 10000
|
duration = 10000
|
||||||
deleteAfter = 60
|
deleteAfter = 60
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import ctypes
|
import ctypes
|
||||||
from PyQt4 import QtCore, QtGui
|
|
||||||
import ssl
|
import ssl
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import account
|
import account
|
||||||
|
from qtpy import QtCore
|
||||||
|
from tr import _translate
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from debug import logger
|
|
||||||
import defaults
|
import defaults
|
||||||
from foldertree import AccountMixin
|
from foldertree import AccountMixin
|
||||||
from helper_sql import *
|
from helper_sql import sqlQuery, sqlExecute
|
||||||
from l10n import getTranslationLanguage
|
from l10n import getTranslationLanguage
|
||||||
from openclpow import openclAvailable, openclEnabled
|
from openclpow import openclEnabled
|
||||||
import paths
|
import paths
|
||||||
import proofofwork
|
import proofofwork
|
||||||
from pyelliptic.openssl import OpenSSL
|
from pyelliptic.openssl import OpenSSL
|
||||||
|
@ -53,37 +53,56 @@ UPnP: {}
|
||||||
Connected hosts: {}
|
Connected hosts: {}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
def checkAddressBook(myapp):
|
def checkAddressBook(myapp):
|
||||||
sqlExecute('''DELETE from addressbook WHERE address=?''', OLD_SUPPORT_ADDRESS)
|
sqlExecute(
|
||||||
queryreturn = sqlQuery('''SELECT * FROM addressbook WHERE address=?''', SUPPORT_ADDRESS)
|
'''DELETE from addressbook WHERE address=?''', OLD_SUPPORT_ADDRESS)
|
||||||
|
queryreturn = sqlQuery(
|
||||||
|
'''SELECT * FROM addressbook WHERE address=?''', SUPPORT_ADDRESS)
|
||||||
if queryreturn == []:
|
if queryreturn == []:
|
||||||
sqlExecute('''INSERT INTO addressbook VALUES (?,?)''', str(QtGui.QApplication.translate("Support", SUPPORT_LABEL)), SUPPORT_ADDRESS)
|
sqlExecute(
|
||||||
|
'''INSERT INTO addressbook VALUES (?,?)''',
|
||||||
|
str(_translate("Support", SUPPORT_LABEL)), SUPPORT_ADDRESS
|
||||||
|
)
|
||||||
myapp.rerenderAddressBook()
|
myapp.rerenderAddressBook()
|
||||||
|
|
||||||
|
|
||||||
def checkHasNormalAddress():
|
def checkHasNormalAddress():
|
||||||
for address in account.getSortedAccounts():
|
for address in account.getSortedAccounts():
|
||||||
acct = account.accountClass(address)
|
acct = account.accountClass(address)
|
||||||
if acct.type == AccountMixin.NORMAL and BMConfigParser().safeGetBoolean(address, 'enabled'):
|
if acct.type == AccountMixin.NORMAL \
|
||||||
|
and BMConfigParser().safeGetBoolean(address, 'enabled'):
|
||||||
return address
|
return address
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def createAddressIfNeeded(myapp):
|
def createAddressIfNeeded(myapp):
|
||||||
if not checkHasNormalAddress():
|
if not checkHasNormalAddress():
|
||||||
queues.addressGeneratorQueue.put(('createRandomAddress', 4, 1, str(QtGui.QApplication.translate("Support", SUPPORT_MY_LABEL)), 1, "", False, defaults.networkDefaultProofOfWorkNonceTrialsPerByte, defaults.networkDefaultPayloadLengthExtraBytes))
|
queues.addressGeneratorQueue.put((
|
||||||
|
'createRandomAddress', 4, 1,
|
||||||
|
str(_translate("Support", SUPPORT_MY_LABEL)), 1, "", False,
|
||||||
|
defaults.networkDefaultProofOfWorkNonceTrialsPerByte,
|
||||||
|
defaults.networkDefaultPayloadLengthExtraBytes
|
||||||
|
))
|
||||||
while state.shutdown == 0 and not checkHasNormalAddress():
|
while state.shutdown == 0 and not checkHasNormalAddress():
|
||||||
time.sleep(.2)
|
time.sleep(.2)
|
||||||
myapp.rerenderComboBoxSendFrom()
|
myapp.rerenderComboBoxSendFrom()
|
||||||
return checkHasNormalAddress()
|
return checkHasNormalAddress()
|
||||||
|
|
||||||
|
|
||||||
def createSupportMessage(myapp):
|
def createSupportMessage(myapp):
|
||||||
checkAddressBook(myapp)
|
checkAddressBook(myapp)
|
||||||
address = createAddressIfNeeded(myapp)
|
address = createAddressIfNeeded(myapp)
|
||||||
if state.shutdown:
|
if state.shutdown:
|
||||||
return
|
return
|
||||||
|
|
||||||
myapp.ui.lineEditSubject.setText(str(QtGui.QApplication.translate("Support", SUPPORT_SUBJECT)))
|
myapp.ui.lineEditSubject.setText(
|
||||||
addrIndex = myapp.ui.comboBoxSendFrom.findData(address, QtCore.Qt.UserRole, QtCore.Qt.MatchFixedString | QtCore.Qt.MatchCaseSensitive)
|
str(_translate("Support", SUPPORT_SUBJECT)))
|
||||||
if addrIndex == -1: # something is very wrong
|
addrIndex = myapp.ui.comboBoxSendFrom.findData(
|
||||||
|
address, QtCore.Qt.UserRole,
|
||||||
|
QtCore.Qt.MatchFixedString | QtCore.Qt.MatchCaseSensitive
|
||||||
|
)
|
||||||
|
if addrIndex == -1: # something is very wrong
|
||||||
return
|
return
|
||||||
myapp.ui.comboBoxSendFrom.setCurrentIndex(addrIndex)
|
myapp.ui.comboBoxSendFrom.setCurrentIndex(addrIndex)
|
||||||
myapp.ui.lineEditTo.setText(SUPPORT_ADDRESS)
|
myapp.ui.lineEditTo.setText(SUPPORT_ADDRESS)
|
||||||
|
@ -93,10 +112,8 @@ def createSupportMessage(myapp):
|
||||||
if commit:
|
if commit:
|
||||||
version += " GIT " + commit
|
version += " GIT " + commit
|
||||||
|
|
||||||
os = sys.platform
|
if sys.platform == "win32":
|
||||||
if os == "win32":
|
os = "Windows %s.%s" % sys.getwindowsversion()
|
||||||
windowsversion = sys.getwindowsversion()
|
|
||||||
os = "Windows " + str(windowsversion[0]) + "." + str(windowsversion[1])
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
from os import uname
|
from os import uname
|
||||||
|
@ -106,17 +123,18 @@ def createSupportMessage(myapp):
|
||||||
pass
|
pass
|
||||||
architecture = "32" if ctypes.sizeof(ctypes.c_voidp) == 4 else "64"
|
architecture = "32" if ctypes.sizeof(ctypes.c_voidp) == 4 else "64"
|
||||||
pythonversion = sys.version
|
pythonversion = sys.version
|
||||||
|
|
||||||
opensslversion = "%s (Python internal), %s (external for PyElliptic)" % (ssl.OPENSSL_VERSION, OpenSSL._version)
|
opensslversion = "%s (Python internal), %s (external for PyElliptic)" % (ssl.OPENSSL_VERSION, OpenSSL._version)
|
||||||
|
|
||||||
frozen = "N/A"
|
frozen = "N/A"
|
||||||
if paths.frozen:
|
if paths.frozen:
|
||||||
frozen = paths.frozen
|
frozen = paths.frozen
|
||||||
portablemode = "True" if state.appdata == paths.lookupExeFolder() else "False"
|
portablemode = "True" \
|
||||||
|
if state.appdata == paths.lookupExeFolder() else "False"
|
||||||
cpow = "True" if proofofwork.bmpow else "False"
|
cpow = "True" if proofofwork.bmpow else "False"
|
||||||
#cpow = QtGui.QApplication.translate("Support", cpow)
|
# cpow = QtGui.QApplication.translate("Support", cpow)
|
||||||
openclpow = str(BMConfigParser().safeGet('bitmessagesettings', 'opencl')) if openclEnabled() else "None"
|
openclpow = str(BMConfigParser().safeGet('bitmessagesettings', 'opencl')) if openclEnabled() else "None"
|
||||||
#openclpow = QtGui.QApplication.translate("Support", openclpow)
|
# openclpow = QtGui.QApplication.translate("Support", openclpow)
|
||||||
locale = getTranslationLanguage()
|
locale = getTranslationLanguage()
|
||||||
try:
|
try:
|
||||||
socks = BMConfigParser().get('bitmessagesettings', 'socksproxytype')
|
socks = BMConfigParser().get('bitmessagesettings', 'socksproxytype')
|
||||||
|
@ -128,7 +146,12 @@ def createSupportMessage(myapp):
|
||||||
upnp = "N/A"
|
upnp = "N/A"
|
||||||
connectedhosts = len(network.stats.connectedHostsList())
|
connectedhosts = len(network.stats.connectedHostsList())
|
||||||
|
|
||||||
myapp.ui.textEditMessage.setText(str(QtGui.QApplication.translate("Support", SUPPORT_MESSAGE)).format(version, os, architecture, pythonversion, opensslversion, frozen, portablemode, cpow, openclpow, locale, socks, upnp, connectedhosts))
|
myapp.ui.textEditMessage.setText(
|
||||||
|
str(_translate("Support", SUPPORT_MESSAGE)).format(
|
||||||
|
version, os, architecture, pythonversion, opensslversion,
|
||||||
|
frozen, portablemode, cpow, openclpow, locale, socks, upnp,
|
||||||
|
connectedhosts
|
||||||
|
))
|
||||||
|
|
||||||
# single msg tab
|
# single msg tab
|
||||||
myapp.ui.tabWidgetSend.setCurrentIndex(
|
myapp.ui.tabWidgetSend.setCurrentIndex(
|
||||||
|
|
|
@ -1,15 +1,33 @@
|
||||||
|
from qtpy import QtCore
|
||||||
from PyQt4.QtCore import QThread, SIGNAL
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import queues
|
import queues
|
||||||
|
import state
|
||||||
|
|
||||||
|
|
||||||
class UISignaler(QThread):
|
class UISignaler(QtCore.QThread):
|
||||||
_instance = None
|
_instance = None
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
writeNewAddressToTable = QtCore.Signal(str, str, str)
|
||||||
QThread.__init__(self, parent)
|
updateStatusBar = QtCore.Signal(str)
|
||||||
|
updateSentItemStatusByToAddress = QtCore.Signal(object, str)
|
||||||
|
updateSentItemStatusByAckdata = QtCore.Signal(object, str)
|
||||||
|
displayNewInboxMessage = QtCore.Signal(object, str, str, object, str)
|
||||||
|
displayNewSentMessage = QtCore.Signal(object, str, str, str, object, str)
|
||||||
|
updateNetworkStatusTab = QtCore.Signal(bool, bool, state.Peer)
|
||||||
|
updateNumberOfMessagesProcessed = QtCore.Signal()
|
||||||
|
updateNumberOfPubkeysProcessed = QtCore.Signal()
|
||||||
|
updateNumberOfBroadcastsProcessed = QtCore.Signal()
|
||||||
|
setStatusIcon = QtCore.Signal(str)
|
||||||
|
changedInboxUnread = QtCore.Signal(str)
|
||||||
|
rerenderMessagelistFromLabels = QtCore.Signal()
|
||||||
|
rerenderMessagelistToLabels = QtCore.Signal()
|
||||||
|
rerenderAddressBook = QtCore.Signal()
|
||||||
|
rerenderSubscriptions = QtCore.Signal()
|
||||||
|
rerenderBlackWhiteList = QtCore.Signal()
|
||||||
|
removeInboxRowByMsgid = QtCore.Signal(str)
|
||||||
|
newVersionAvailable = QtCore.Signal(str)
|
||||||
|
displayAlert = QtCore.Signal(str, str, bool)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get(cls):
|
def get(cls):
|
||||||
|
@ -22,58 +40,58 @@ class UISignaler(QThread):
|
||||||
command, data = queues.UISignalQueue.get()
|
command, data = queues.UISignalQueue.get()
|
||||||
if command == 'writeNewAddressToTable':
|
if command == 'writeNewAddressToTable':
|
||||||
label, address, streamNumber = data
|
label, address, streamNumber = data
|
||||||
self.emit(SIGNAL(
|
self.writeNewAddressToTable.emit(
|
||||||
"writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), label, address, str(streamNumber))
|
label, address, str(streamNumber))
|
||||||
elif command == 'updateStatusBar':
|
elif command == 'updateStatusBar':
|
||||||
self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"), data)
|
self.updateStatusBar.emit(data)
|
||||||
elif command == 'updateSentItemStatusByToAddress':
|
elif command == 'updateSentItemStatusByToAddress':
|
||||||
toAddress, message = data
|
toAddress, message = data
|
||||||
self.emit(SIGNAL(
|
self.updateSentItemStatusByToAddress.emit(toAddress, message)
|
||||||
"updateSentItemStatusByToAddress(PyQt_PyObject,PyQt_PyObject)"), toAddress, message)
|
|
||||||
elif command == 'updateSentItemStatusByAckdata':
|
elif command == 'updateSentItemStatusByAckdata':
|
||||||
ackData, message = data
|
ackData, message = data
|
||||||
self.emit(SIGNAL(
|
self.updateSentItemStatusByAckdata.emit(ackData, message)
|
||||||
"updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), ackData, message)
|
|
||||||
elif command == 'displayNewInboxMessage':
|
elif command == 'displayNewInboxMessage':
|
||||||
inventoryHash, toAddress, fromAddress, subject, body = data
|
inventoryHash, toAddress, fromAddress, subject, body = data
|
||||||
self.emit(SIGNAL(
|
self.displayNewInboxMessage.emit(
|
||||||
"displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"),
|
inventoryHash, toAddress, fromAddress,
|
||||||
inventoryHash, toAddress, fromAddress, subject, body)
|
unicode(subject, 'utf-8'), body)
|
||||||
elif command == 'displayNewSentMessage':
|
elif command == 'displayNewSentMessage':
|
||||||
toAddress, fromLabel, fromAddress, subject, message, ackdata = data
|
toAddress, fromLabel, fromAddress, subject, message, ackdata = data
|
||||||
self.emit(SIGNAL(
|
self.displayNewSentMessage.emit(
|
||||||
"displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"),
|
toAddress, fromLabel, fromAddress,
|
||||||
toAddress, fromLabel, fromAddress, subject, message, ackdata)
|
unicode(subject, 'utf-8'), message, ackdata)
|
||||||
elif command == 'updateNetworkStatusTab':
|
elif command == 'updateNetworkStatusTab':
|
||||||
outbound, add, destination = data
|
outbound, add, destination = data
|
||||||
self.emit(SIGNAL("updateNetworkStatusTab(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), outbound, add, destination)
|
self.updateNetworkStatusTab.emit(outbound, add, destination)
|
||||||
elif command == 'updateNumberOfMessagesProcessed':
|
elif command == 'updateNumberOfMessagesProcessed':
|
||||||
self.emit(SIGNAL("updateNumberOfMessagesProcessed()"))
|
self.updateNumberOfMessagesProcessed.emit()
|
||||||
elif command == 'updateNumberOfPubkeysProcessed':
|
elif command == 'updateNumberOfPubkeysProcessed':
|
||||||
self.emit(SIGNAL("updateNumberOfPubkeysProcessed()"))
|
self.updateNumberOfPubkeysProcessed.emit()
|
||||||
elif command == 'updateNumberOfBroadcastsProcessed':
|
elif command == 'updateNumberOfBroadcastsProcessed':
|
||||||
self.emit(SIGNAL("updateNumberOfBroadcastsProcessed()"))
|
self.updateNumberOfBroadcastsProcessed.emit()
|
||||||
elif command == 'setStatusIcon':
|
elif command == 'setStatusIcon':
|
||||||
self.emit(SIGNAL("setStatusIcon(PyQt_PyObject)"), data)
|
self.setStatusIcon.emit(data)
|
||||||
elif command == 'changedInboxUnread':
|
elif command == 'changedInboxUnread':
|
||||||
self.emit(SIGNAL("changedInboxUnread(PyQt_PyObject)"), data)
|
self.changedInboxUnread.emit(data)
|
||||||
elif command == 'rerenderMessagelistFromLabels':
|
elif command == 'rerenderMessagelistFromLabels':
|
||||||
self.emit(SIGNAL("rerenderMessagelistFromLabels()"))
|
self.rerenderMessagelistFromLabels.emit()
|
||||||
elif command == 'rerenderMessagelistToLabels':
|
elif command == 'rerenderMessagelistToLabels':
|
||||||
self.emit(SIGNAL("rerenderMessagelistToLabels()"))
|
self.rerenderMessagelistToLabels.emit()
|
||||||
elif command == 'rerenderAddressBook':
|
elif command == 'rerenderAddressBook':
|
||||||
self.emit(SIGNAL("rerenderAddressBook()"))
|
self.rerenderAddressBook.emit()
|
||||||
elif command == 'rerenderSubscriptions':
|
elif command == 'rerenderSubscriptions':
|
||||||
self.emit(SIGNAL("rerenderSubscriptions()"))
|
self.rerenderSubscriptions.emit()
|
||||||
elif command == 'rerenderBlackWhiteList':
|
elif command == 'rerenderBlackWhiteList':
|
||||||
self.emit(SIGNAL("rerenderBlackWhiteList()"))
|
self.rerenderBlackWhiteList.emit()
|
||||||
elif command == 'removeInboxRowByMsgid':
|
elif command == 'removeInboxRowByMsgid':
|
||||||
self.emit(SIGNAL("removeInboxRowByMsgid(PyQt_PyObject)"), data)
|
self.removeInboxRowByMsgid.emit(data)
|
||||||
elif command == 'newVersionAvailable':
|
elif command == 'newVersionAvailable':
|
||||||
self.emit(SIGNAL("newVersionAvailable(PyQt_PyObject)"), data)
|
self.newVersionAvailable.emit(data)
|
||||||
elif command == 'alert':
|
elif command == 'alert':
|
||||||
title, text, exitAfterUserClicksOk = data
|
title, text, exitAfterUserClicksOk = data
|
||||||
self.emit(SIGNAL("displayAlert(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)"), title, text, exitAfterUserClicksOk)
|
self.displayAlert.emit(title, text, exitAfterUserClicksOk)
|
||||||
else:
|
else:
|
||||||
sys.stderr.write(
|
sys.stderr.write(
|
||||||
'Command sent to UISignaler not recognized: %s\n' % command)
|
'Command sent to UISignaler not recognized: %s\n'
|
||||||
|
% command
|
||||||
|
)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from PyQt4 import QtGui
|
from qtpy import QtGui
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
from addresses import addBMIfNotPresent
|
from addresses import addBMIfNotPresent
|
||||||
|
@ -8,15 +8,17 @@ import state
|
||||||
str_broadcast_subscribers = '[Broadcast subscribers]'
|
str_broadcast_subscribers = '[Broadcast subscribers]'
|
||||||
str_chan = '[chan]'
|
str_chan = '[chan]'
|
||||||
|
|
||||||
|
|
||||||
def identiconize(address):
|
def identiconize(address):
|
||||||
size = 48
|
size = 48
|
||||||
|
|
||||||
# If you include another identicon library, please generate an
|
# If you include another identicon library, please generate an
|
||||||
# example identicon with the following md5 hash:
|
# example identicon with the following md5 hash:
|
||||||
# 3fd4bf901b9d4ea1394f0fb358725b28
|
# 3fd4bf901b9d4ea1394f0fb358725b28
|
||||||
|
|
||||||
try:
|
try:
|
||||||
identicon_lib = BMConfigParser().get('bitmessagesettings', 'identiconlib')
|
identicon_lib = BMConfigParser().get(
|
||||||
|
'bitmessagesettings', 'identiconlib')
|
||||||
except:
|
except:
|
||||||
# default to qidenticon_two_x
|
# default to qidenticon_two_x
|
||||||
identicon_lib = 'qidenticon_two_x'
|
identicon_lib = 'qidenticon_two_x'
|
||||||
|
@ -25,11 +27,11 @@ def identiconize(address):
|
||||||
# It can be used as a pseudo-password to salt the generation of the identicons to decrease the risk
|
# 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.
|
# of attacks where someone creates an address to mimic someone else's identicon.
|
||||||
identiconsuffix = BMConfigParser().get('bitmessagesettings', 'identiconsuffix')
|
identiconsuffix = BMConfigParser().get('bitmessagesettings', 'identiconsuffix')
|
||||||
|
|
||||||
if not BMConfigParser().getboolean('bitmessagesettings', 'useidenticons'):
|
if not BMConfigParser().getboolean('bitmessagesettings', 'useidenticons'):
|
||||||
idcon = QtGui.QIcon()
|
idcon = QtGui.QIcon()
|
||||||
return idcon
|
return idcon
|
||||||
|
|
||||||
if (identicon_lib[:len('qidenticon')] == 'qidenticon'):
|
if (identicon_lib[:len('qidenticon')] == 'qidenticon'):
|
||||||
# print identicon_lib
|
# print identicon_lib
|
||||||
# originally by:
|
# originally by:
|
||||||
|
@ -64,6 +66,7 @@ def identiconize(address):
|
||||||
idcon.addPixmap(pix, QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
idcon.addPixmap(pix, QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
return idcon
|
return idcon
|
||||||
|
|
||||||
|
|
||||||
def avatarize(address):
|
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
|
||||||
|
@ -97,11 +100,11 @@ def avatarize(address):
|
||||||
lower_default = state.appdata + 'avatars/' + 'default.' + ext.lower()
|
lower_default = state.appdata + 'avatars/' + 'default.' + ext.lower()
|
||||||
upper_default = state.appdata + 'avatars/' + 'default.' + ext.upper()
|
upper_default = state.appdata + 'avatars/' + 'default.' + ext.upper()
|
||||||
if os.path.isfile(lower_default):
|
if os.path.isfile(lower_default):
|
||||||
default = lower_default
|
# default = lower_default
|
||||||
idcon.addFile(lower_default)
|
idcon.addFile(lower_default)
|
||||||
return idcon
|
return idcon
|
||||||
elif os.path.isfile(upper_default):
|
elif os.path.isfile(upper_default):
|
||||||
default = upper_default
|
# default = upper_default
|
||||||
idcon.addFile(upper_default)
|
idcon.addFile(upper_default)
|
||||||
return idcon
|
return idcon
|
||||||
# If no avatar is found
|
# If no avatar is found
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
from PyQt4 import uic
|
from qtpy import uic
|
||||||
import os.path
|
import os
|
||||||
import paths
|
import paths
|
||||||
import sys
|
|
||||||
|
|
||||||
def resource_path(resFile):
|
def resource_path(resFile):
|
||||||
baseDir = paths.codePath()
|
baseDir = paths.codePath()
|
||||||
for subDir in ["ui", "bitmessageqt"]:
|
for subDir in ["ui", "bitmessageqt"]:
|
||||||
if os.path.isdir(os.path.join(baseDir, subDir)) and os.path.isfile(os.path.join(baseDir, subDir, resFile)):
|
if (
|
||||||
|
os.path.isdir(os.path.join(baseDir, subDir))
|
||||||
|
and os.path.isfile(os.path.join(baseDir, subDir, resFile))
|
||||||
|
):
|
||||||
return os.path.join(baseDir, subDir, resFile)
|
return os.path.join(baseDir, subDir, resFile)
|
||||||
|
|
||||||
|
|
||||||
def load(resFile, widget):
|
def load(resFile, widget):
|
||||||
uic.loadUi(resource_path(resFile), widget)
|
uic.loadUi(resource_path(resFile), widget)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import datetime
|
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from singleton import Singleton
|
from singleton import Singleton
|
||||||
import state
|
import state
|
||||||
|
@ -36,6 +36,7 @@ BMConfigDefaults = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class BMConfigParser(ConfigParser.SafeConfigParser):
|
class BMConfigParser(ConfigParser.SafeConfigParser):
|
||||||
def set(self, section, option, value=None):
|
def set(self, section, option, value=None):
|
||||||
|
@ -49,10 +50,13 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
|
||||||
def get(self, section, option, raw=False, variables=None):
|
def get(self, section, option, raw=False, variables=None):
|
||||||
try:
|
try:
|
||||||
if section == "bitmessagesettings" and option == "timeformat":
|
if section == "bitmessagesettings" and option == "timeformat":
|
||||||
return ConfigParser.ConfigParser.get(self, section, option, raw, variables)
|
return ConfigParser.ConfigParser.get(
|
||||||
return ConfigParser.ConfigParser.get(self, section, option, True, variables)
|
self, section, option, raw, variables)
|
||||||
|
return ConfigParser.ConfigParser.get(
|
||||||
|
self, section, option, True, variables)
|
||||||
except ConfigParser.InterpolationError:
|
except ConfigParser.InterpolationError:
|
||||||
return ConfigParser.ConfigParser.get(self, section, option, True, variables)
|
return ConfigParser.ConfigParser.get(
|
||||||
|
self, section, option, True, variables)
|
||||||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) as e:
|
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError) as e:
|
||||||
try:
|
try:
|
||||||
return BMConfigDefaults[section][option]
|
return BMConfigDefaults[section][option]
|
||||||
|
@ -62,51 +66,63 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
|
||||||
def safeGetBoolean(self, section, field):
|
def safeGetBoolean(self, section, field):
|
||||||
try:
|
try:
|
||||||
return self.getboolean(section, field)
|
return self.getboolean(section, field)
|
||||||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError, ValueError, AttributeError):
|
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError,
|
||||||
|
ValueError, AttributeError):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def safeGetInt(self, section, field, default=0):
|
def safeGetInt(self, section, field, default=0):
|
||||||
try:
|
try:
|
||||||
return self.getint(section, field)
|
return self.getint(section, field)
|
||||||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError, ValueError, AttributeError):
|
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError,
|
||||||
|
ValueError, AttributeError):
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def safeGet(self, section, option, default = None):
|
def safeGet(self, section, option, default=None):
|
||||||
try:
|
try:
|
||||||
return self.get(section, option)
|
return self.get(section, option)
|
||||||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError, ValueError, AttributeError):
|
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError,
|
||||||
|
ValueError, AttributeError):
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def items(self, section, raw=False, variables=None):
|
def items(self, section, raw=False, variables=None):
|
||||||
return ConfigParser.ConfigParser.items(self, section, True, variables)
|
return ConfigParser.ConfigParser.items(self, section, True, variables)
|
||||||
|
|
||||||
def addresses(self):
|
def addresses(self):
|
||||||
return filter(lambda x: x.startswith('BM-'), BMConfigParser().sections())
|
return filter(
|
||||||
|
lambda x: x.startswith('BM-'), BMConfigParser().sections())
|
||||||
|
|
||||||
def read(self, filenames):
|
def read(self, filenames):
|
||||||
ConfigParser.ConfigParser.read(self, filenames)
|
ConfigParser.ConfigParser.read(self, filenames)
|
||||||
for section in self.sections():
|
for section in self.sections():
|
||||||
for option in self.options(section):
|
for option in self.options(section):
|
||||||
try:
|
try:
|
||||||
if not self.validate(section, option, ConfigParser.ConfigParser.get(self, section, option)):
|
if not self.validate(
|
||||||
|
section, option,
|
||||||
|
ConfigParser.ConfigParser.get(self, section, option)
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
newVal = BMConfigDefaults[section][option]
|
newVal = BMConfigDefaults[section][option]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
ConfigParser.ConfigParser.set(self, section, option, newVal)
|
ConfigParser.ConfigParser.set(
|
||||||
|
self, section, option, newVal)
|
||||||
except ConfigParser.InterpolationError:
|
except ConfigParser.InterpolationError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
fileName = os.path.join(state.appdata, 'keys.dat')
|
fileName = os.path.join(state.appdata, 'keys.dat')
|
||||||
fileNameBak = fileName + "." + datetime.datetime.now().strftime("%Y%j%H%M%S%f") + '.bak'
|
fileNameBak = ".".join([
|
||||||
# create a backup copy to prevent the accidental loss due to the disk write failure
|
fileName, datetime.now().strftime("%Y%j%H%M%S%f"), 'bak'
|
||||||
|
])
|
||||||
|
# create a backup copy to prevent the accidental loss due to
|
||||||
|
# the disk write failure
|
||||||
try:
|
try:
|
||||||
shutil.copyfile(fileName, fileNameBak)
|
shutil.copyfile(fileName, fileNameBak)
|
||||||
# The backup succeeded.
|
# The backup succeeded.
|
||||||
fileNameExisted = True
|
fileNameExisted = True
|
||||||
except (IOError, Exception):
|
except (IOError, Exception):
|
||||||
# The backup failed. This can happen if the file didn't exist before.
|
# The backup failed.
|
||||||
|
# This can happen if the file didn't exist before.
|
||||||
fileNameExisted = False
|
fileNameExisted = False
|
||||||
# write the file
|
# write the file
|
||||||
with open(fileName, 'wb') as configfile:
|
with open(fileName, 'wb') as configfile:
|
||||||
|
|
|
@ -208,9 +208,10 @@ class addressGenerator(threading.Thread, StoppableThread):
|
||||||
queues.workerQueue.put((
|
queues.workerQueue.put((
|
||||||
'sendOutOrStoreMyV4Pubkey', address))
|
'sendOutOrStoreMyV4Pubkey', address))
|
||||||
|
|
||||||
elif command == 'createDeterministicAddresses' \
|
elif command in (
|
||||||
or command == 'getDeterministicAddress' \
|
'createDeterministicAddresses',
|
||||||
or command == 'createChan' or command == 'joinChan':
|
'getDeterministicAddress', 'createChan', 'joinChan'
|
||||||
|
):
|
||||||
if len(deterministicPassphrase) == 0:
|
if len(deterministicPassphrase) == 0:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
'You are creating deterministic'
|
'You are creating deterministic'
|
||||||
|
@ -220,9 +221,8 @@ class addressGenerator(threading.Thread, StoppableThread):
|
||||||
queues.UISignalQueue.put((
|
queues.UISignalQueue.put((
|
||||||
'updateStatusBar',
|
'updateStatusBar',
|
||||||
tr._translate(
|
tr._translate(
|
||||||
"MainWindow",
|
"MainWindow", "Generating {0} new addresses."
|
||||||
"Generating %1 new addresses."
|
).format(str(numberOfAddressesToMake))
|
||||||
).arg(str(numberOfAddressesToMake))
|
|
||||||
))
|
))
|
||||||
signingKeyNonce = 0
|
signingKeyNonce = 0
|
||||||
encryptionKeyNonce = 1
|
encryptionKeyNonce = 1
|
||||||
|
@ -325,9 +325,9 @@ class addressGenerator(threading.Thread, StoppableThread):
|
||||||
'updateStatusBar',
|
'updateStatusBar',
|
||||||
tr._translate(
|
tr._translate(
|
||||||
"MainWindow",
|
"MainWindow",
|
||||||
"%1 is already in 'Your Identities'."
|
"{0} is already in 'Your Identities'."
|
||||||
" Not adding it again."
|
" Not adding it again."
|
||||||
).arg(address)
|
).format(address)
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
logger.debug('label: %s', label)
|
logger.debug('label: %s', label)
|
||||||
|
|
39
src/debug.py
39
src/debug.py
|
@ -24,27 +24,37 @@ import helper_startup
|
||||||
import state
|
import state
|
||||||
helper_startup.loadConfig()
|
helper_startup.loadConfig()
|
||||||
|
|
||||||
# Now can be overriden from a config file, which uses standard python logging.config.fileConfig interface
|
# Now can be overriden from a config file, which uses standard python
|
||||||
# examples are here: https://bitmessage.org/forum/index.php/topic,4820.msg11163.html#msg11163
|
# logging.config.fileConfig interface examples are here:
|
||||||
|
# https://bitmessage.org/forum/index.php/topic,4820.msg11163.html#msg11163
|
||||||
log_level = 'WARNING'
|
log_level = 'WARNING'
|
||||||
|
|
||||||
|
|
||||||
def log_uncaught_exceptions(ex_cls, ex, tb):
|
def log_uncaught_exceptions(ex_cls, ex, tb):
|
||||||
logging.critical('Unhandled exception', exc_info=(ex_cls, ex, tb))
|
logging.critical('Unhandled exception', exc_info=(ex_cls, ex, tb))
|
||||||
|
# logging.critical(
|
||||||
|
# 'Unhandled exception of type %s: %s,\ntraceback: %s', ex_cls, ex, tb)
|
||||||
|
|
||||||
|
|
||||||
def configureLogging():
|
def configureLogging():
|
||||||
have_logging = False
|
have_logging = False
|
||||||
|
config_path = os.path.join(state.appdata, 'logging.dat')
|
||||||
try:
|
try:
|
||||||
logging.config.fileConfig(os.path.join (state.appdata, 'logging.dat'))
|
logging.config.fileConfig(config_path)
|
||||||
have_logging = True
|
have_logging = True
|
||||||
print "Loaded logger configuration from %s" % (os.path.join(state.appdata, 'logging.dat'))
|
print "Loaded logger configuration from %s" % config_path
|
||||||
except:
|
except:
|
||||||
if os.path.isfile(os.path.join(state.appdata, 'logging.dat')):
|
if os.path.isfile(config_path):
|
||||||
print "Failed to load logger configuration from %s, using default logging config" % (os.path.join(state.appdata, 'logging.dat'))
|
print(
|
||||||
|
"Failed to load logger configuration from %s,"
|
||||||
|
" using default logging config" % config_path
|
||||||
|
)
|
||||||
print sys.exc_info()
|
print sys.exc_info()
|
||||||
else:
|
else:
|
||||||
# no need to confuse the user if the logger config is missing entirely
|
# no need to confuse the user if the logger config
|
||||||
|
# is missing entirely
|
||||||
print "Using default logger configuration"
|
print "Using default logger configuration"
|
||||||
|
|
||||||
sys.excepthook = log_uncaught_exceptions
|
sys.excepthook = log_uncaught_exceptions
|
||||||
|
|
||||||
if have_logging:
|
if have_logging:
|
||||||
|
@ -69,7 +79,7 @@ def configureLogging():
|
||||||
'formatter': 'default',
|
'formatter': 'default',
|
||||||
'level': log_level,
|
'level': log_level,
|
||||||
'filename': state.appdata + 'debug.log',
|
'filename': state.appdata + 'debug.log',
|
||||||
'maxBytes': 2097152, # 2 MiB
|
'maxBytes': 2097152, # 2 MiB
|
||||||
'backupCount': 1,
|
'backupCount': 1,
|
||||||
'encoding': 'UTF-8',
|
'encoding': 'UTF-8',
|
||||||
}
|
}
|
||||||
|
@ -77,15 +87,15 @@ def configureLogging():
|
||||||
'loggers': {
|
'loggers': {
|
||||||
'console_only': {
|
'console_only': {
|
||||||
'handlers': ['console'],
|
'handlers': ['console'],
|
||||||
'propagate' : 0
|
'propagate': 0
|
||||||
},
|
},
|
||||||
'file_only': {
|
'file_only': {
|
||||||
'handlers': ['file'],
|
'handlers': ['file'],
|
||||||
'propagate' : 0
|
'propagate': 0
|
||||||
},
|
},
|
||||||
'both': {
|
'both': {
|
||||||
'handlers': ['console', 'file'],
|
'handlers': ['console', 'file'],
|
||||||
'propagate' : 0
|
'propagate': 0
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'root': {
|
'root': {
|
||||||
|
@ -95,8 +105,9 @@ def configureLogging():
|
||||||
})
|
})
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# TODO (xj9): Get from a config file.
|
# TODO (xj9): Get from a config file.
|
||||||
#logger = logging.getLogger('console_only')
|
# logger = logging.getLogger('console_only')
|
||||||
if configureLogging():
|
if configureLogging():
|
||||||
if '-c' in sys.argv:
|
if '-c' in sys.argv:
|
||||||
logger = logging.getLogger('file_only')
|
logger = logging.getLogger('file_only')
|
||||||
|
@ -105,6 +116,7 @@ if configureLogging():
|
||||||
else:
|
else:
|
||||||
logger = logging.getLogger('default')
|
logger = logging.getLogger('default')
|
||||||
|
|
||||||
|
|
||||||
def restartLoggingInUpdatedAppdataLocation():
|
def restartLoggingInUpdatedAppdataLocation():
|
||||||
global logger
|
global logger
|
||||||
for i in list(logger.handlers):
|
for i in list(logger.handlers):
|
||||||
|
@ -118,4 +130,3 @@ def restartLoggingInUpdatedAppdataLocation():
|
||||||
logger = logging.getLogger('both')
|
logger = logging.getLogger('both')
|
||||||
else:
|
else:
|
||||||
logger = logging.getLogger('default')
|
logger = logging.getLogger('default')
|
||||||
|
|
||||||
|
|
|
@ -193,45 +193,48 @@ def check_curses():
|
||||||
logger.info('dialog Utility Version' + unicode(dialog_util_version))
|
logger.info('dialog Utility Version' + unicode(dialog_util_version))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def check_pyqt():
|
def check_pyqt():
|
||||||
"""Do pyqt dependency check.
|
"""Do pyqt dependency check.
|
||||||
|
|
||||||
Here we are checking for PyQt4 with its version, as for it require
|
Here we are checking for PyQt4 with its version, as for it require
|
||||||
PyQt 4.7 or later.
|
PyQt 4.7 or later.
|
||||||
"""
|
"""
|
||||||
try:
|
return True
|
||||||
import PyQt4.QtCore
|
# try:
|
||||||
except ImportError:
|
# import PyQt4.QtCore
|
||||||
logger.error('The PyQt4 package is not available. PyBitmessage requires PyQt 4.8 or later and Qt 4.7 or later.')
|
# except ImportError:
|
||||||
if sys.platform.startswith('openbsd'):
|
# logger.error('The PyQt4 package is not available. PyBitmessage requires PyQt 4.8 or later and Qt 4.7 or later.')
|
||||||
logger.error('On OpenBSD, try running "pkg_add py-qt4" as root.')
|
# if sys.platform.startswith('openbsd'):
|
||||||
elif sys.platform.startswith('freebsd'):
|
# logger.error('On OpenBSD, try running "pkg_add py-qt4" as root.')
|
||||||
logger.error('On FreeBSD, try running "pkg install py27-qt4" as root.')
|
# elif sys.platform.startswith('freebsd'):
|
||||||
elif os.path.isfile("/etc/os-release"):
|
# logger.error('On FreeBSD, try running "pkg install py27-qt4" as root.')
|
||||||
with open("/etc/os-release", 'rt') as osRelease:
|
# elif os.path.isfile("/etc/os-release"):
|
||||||
for line in osRelease:
|
# with open("/etc/os-release", 'rt') as osRelease:
|
||||||
if line.startswith("NAME="):
|
# for line in osRelease:
|
||||||
if "fedora" in line.lower():
|
# if line.startswith("NAME="):
|
||||||
logger.error('On Fedora, try running "dnf install PyQt4" as root.')
|
# if "fedora" in line.lower():
|
||||||
elif "opensuse" in line.lower():
|
# logger.error('On Fedora, try running "dnf install PyQt4" as root.')
|
||||||
logger.error('On openSUSE, try running "zypper install python-qt" as root.')
|
# elif "opensuse" in line.lower():
|
||||||
elif "ubuntu" in line.lower():
|
# logger.error('On openSUSE, try running "zypper install python-qt" as root.')
|
||||||
logger.error('On Ubuntu, try running "apt-get install python-qt4" as root.')
|
# elif "ubuntu" in line.lower():
|
||||||
elif "debian" in line.lower():
|
# logger.error('On Ubuntu, try running "apt-get install python-qt4" as root.')
|
||||||
logger.error('On Debian, try running "apt-get install python-qt4" as root.')
|
# elif "debian" in line.lower():
|
||||||
else:
|
# logger.error('On Debian, try running "apt-get install python-qt4" as root.')
|
||||||
logger.error('If your package manager does not have this package, try running "pip install PyQt4".')
|
# else:
|
||||||
return False
|
# logger.error('If your package manager does not have this package, try running "pip install PyQt4".')
|
||||||
logger.info('PyQt Version: ' + PyQt4.QtCore.PYQT_VERSION_STR)
|
# return False
|
||||||
logger.info('Qt Version: ' + PyQt4.QtCore.QT_VERSION_STR)
|
# logger.info('PyQt Version: ' + PyQt4.QtCore.PYQT_VERSION_STR)
|
||||||
passed = True
|
# logger.info('Qt Version: ' + PyQt4.QtCore.QT_VERSION_STR)
|
||||||
if PyQt4.QtCore.PYQT_VERSION < 0x40800:
|
# passed = True
|
||||||
logger.error('This version of PyQt is too old. PyBitmessage requries PyQt 4.8 or later.')
|
# if PyQt4.QtCore.PYQT_VERSION < 0x40800:
|
||||||
passed = False
|
# logger.error('This version of PyQt is too old. PyBitmessage requries PyQt 4.8 or later.')
|
||||||
if PyQt4.QtCore.QT_VERSION < 0x40700:
|
# passed = False
|
||||||
logger.error('This version of Qt is too old. PyBitmessage requries Qt 4.7 or later.')
|
# if PyQt4.QtCore.QT_VERSION < 0x40700:
|
||||||
passed = False
|
# logger.error('This version of Qt is too old. PyBitmessage requries Qt 4.7 or later.')
|
||||||
return passed
|
# passed = False
|
||||||
|
# return passed
|
||||||
|
|
||||||
|
|
||||||
def check_msgpack():
|
def check_msgpack():
|
||||||
"""Do sgpack module check.
|
"""Do sgpack module check.
|
||||||
|
|
|
@ -1,29 +1,19 @@
|
||||||
#!/usr/bin/python2.7
|
from helper_sql import sqlQuery
|
||||||
|
from tr import _translate
|
||||||
|
|
||||||
from helper_sql import *
|
|
||||||
|
|
||||||
try:
|
def search_sql(
|
||||||
from PyQt4 import QtCore, QtGui
|
xAddress="toaddress", account=None, folder="inbox", where=None,
|
||||||
haveQt = True
|
what=None, unreadOnly=False):
|
||||||
except:
|
|
||||||
haveQt = False
|
|
||||||
|
|
||||||
def search_translate (context, text):
|
|
||||||
if haveQt:
|
|
||||||
return QtGui.QApplication.translate(context, text)
|
|
||||||
else:
|
|
||||||
return text.lower()
|
|
||||||
|
|
||||||
def search_sql(xAddress = "toaddress", account = None, folder = "inbox", where = None, what = None, unreadOnly = False):
|
|
||||||
if what is not None and what != "":
|
if what is not None and what != "":
|
||||||
what = "%" + what + "%"
|
what = "%" + what + "%"
|
||||||
if where == search_translate("MainWindow", "To"):
|
if where == _translate("MainWindow", "To"):
|
||||||
where = "toaddress"
|
where = "toaddress"
|
||||||
elif where == search_translate("MainWindow", "From"):
|
elif where == _translate("MainWindow", "From"):
|
||||||
where = "fromaddress"
|
where = "fromaddress"
|
||||||
elif where == search_translate("MainWindow", "Subject"):
|
elif where == _translate("MainWindow", "Subject"):
|
||||||
where = "subject"
|
where = "subject"
|
||||||
elif where == search_translate("MainWindow", "Message"):
|
elif where == _translate("MainWindow", "Message"):
|
||||||
where = "message"
|
where = "message"
|
||||||
else:
|
else:
|
||||||
where = "toaddress || fromaddress || subject || message"
|
where = "toaddress || fromaddress || subject || message"
|
||||||
|
@ -68,18 +58,30 @@ def search_sql(xAddress = "toaddress", account = None, folder = "inbox", where =
|
||||||
sqlStatementBase += " ORDER BY lastactiontime"
|
sqlStatementBase += " ORDER BY lastactiontime"
|
||||||
return sqlQuery(sqlStatementBase, sqlArguments)
|
return sqlQuery(sqlStatementBase, sqlArguments)
|
||||||
|
|
||||||
def check_match(toAddress, fromAddress, subject, message, where = None, what = None):
|
|
||||||
|
def check_match(
|
||||||
|
toAddress, fromAddress, subject, message, where=None, what=None):
|
||||||
if what is not None and what != "":
|
if what is not None and what != "":
|
||||||
if where in (search_translate("MainWindow", "To"), search_translate("MainWindow", "All")):
|
if where in (
|
||||||
|
_translate("MainWindow", "To"), _translate("MainWindow", "All")
|
||||||
|
):
|
||||||
if what.lower() not in toAddress.lower():
|
if what.lower() not in toAddress.lower():
|
||||||
return False
|
return False
|
||||||
elif where in (search_translate("MainWindow", "From"), search_translate("MainWindow", "All")):
|
elif where in (
|
||||||
|
_translate("MainWindow", "From"), _translate("MainWindow", "All")
|
||||||
|
):
|
||||||
if what.lower() not in fromAddress.lower():
|
if what.lower() not in fromAddress.lower():
|
||||||
return False
|
return False
|
||||||
elif where in (search_translate("MainWindow", "Subject"), search_translate("MainWindow", "All")):
|
elif where in (
|
||||||
|
_translate("MainWindow", "Subject"),
|
||||||
|
_translate("MainWindow", "All")
|
||||||
|
):
|
||||||
if what.lower() not in subject.lower():
|
if what.lower() not in subject.lower():
|
||||||
return False
|
return False
|
||||||
elif where in (search_translate("MainWindow", "Message"), search_translate("MainWindow", "All")):
|
elif where in (
|
||||||
|
_translate("MainWindow", "Message"),
|
||||||
|
_translate("MainWindow", "All")
|
||||||
|
):
|
||||||
if what.lower() not in message.lower():
|
if what.lower() not in message.lower():
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -20,6 +20,7 @@ def get_plugins(group, point='', name=None, fallback=None):
|
||||||
except (AttributeError,
|
except (AttributeError,
|
||||||
ImportError,
|
ImportError,
|
||||||
ValueError,
|
ValueError,
|
||||||
|
RuntimeError, # PyQt for example
|
||||||
pkg_resources.DistributionNotFound,
|
pkg_resources.DistributionNotFound,
|
||||||
pkg_resources.UnknownExtra):
|
pkg_resources.UnknownExtra):
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -49,16 +49,14 @@ Return a PIL Image class instance which have generated identicon image.
|
||||||
```size``` specifies `patch size`. Generated image size is 3 * ```size```.
|
```size``` specifies `patch size`. Generated image size is 3 * ```size```.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# we probably don't need all of them, but i don't want to check now
|
from qtpy import QtCore, QtGui
|
||||||
from PyQt4 import QtCore, QtGui
|
|
||||||
from PyQt4.QtCore import *
|
|
||||||
from PyQt4.QtGui import *
|
|
||||||
|
|
||||||
__all__ = ['render_identicon', 'IdenticonRendererBase']
|
__all__ = ['render_identicon', 'IdenticonRendererBase']
|
||||||
|
|
||||||
|
|
||||||
class IdenticonRendererBase(object):
|
class IdenticonRendererBase(object):
|
||||||
PATH_SET = []
|
PATH_SET = []
|
||||||
|
|
||||||
def __init__(self, code):
|
def __init__(self, code):
|
||||||
"""
|
"""
|
||||||
@param code code for icon
|
@param code code for icon
|
||||||
|
@ -66,53 +64,56 @@ class IdenticonRendererBase(object):
|
||||||
if not isinstance(code, int):
|
if not isinstance(code, int):
|
||||||
code = int(code)
|
code = int(code)
|
||||||
self.code = code
|
self.code = code
|
||||||
|
|
||||||
def render(self, size, twoColor, opacity, penwidth):
|
def render(self, size, twoColor, opacity, penwidth):
|
||||||
"""
|
"""
|
||||||
render identicon to QPicture
|
render identicon to QPicture
|
||||||
|
|
||||||
@param size identicon patchsize. (image size is 3 * [size])
|
@param size identicon patchsize. (image size is 3 * [size])
|
||||||
@return QPicture
|
@return QPicture
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# decode the code
|
# decode the code
|
||||||
middle, corner, side, foreColor, secondColor, swap_cross = self.decode(self.code, twoColor)
|
middle, corner, side, foreColor, secondColor, swap_cross = \
|
||||||
|
self.decode(self.code, twoColor)
|
||||||
|
|
||||||
# make image
|
# make image
|
||||||
image = QPixmap(QSize(size * 3 +penwidth, size * 3 +penwidth))
|
image = QtGui.QPixmap(
|
||||||
|
QtCore.QSize(size * 3 + penwidth, size * 3 + penwidth))
|
||||||
|
|
||||||
# fill background
|
# fill background
|
||||||
backColor = QtGui.QColor(255,255,255,opacity)
|
backColor = QtGui.QColor(255, 255, 255, opacity)
|
||||||
image.fill(backColor)
|
image.fill(backColor)
|
||||||
|
|
||||||
kwds = {
|
kwds = {
|
||||||
'image': image,
|
'image': image,
|
||||||
'size': size,
|
'size': size,
|
||||||
'foreColor': foreColor if swap_cross else secondColor,
|
'foreColor': foreColor if swap_cross else secondColor,
|
||||||
'penwidth': penwidth,
|
'penwidth': penwidth,
|
||||||
'backColor': backColor}
|
'backColor': backColor}
|
||||||
|
|
||||||
# middle patch
|
# middle patch
|
||||||
image = self.drawPatchQt((1, 1), middle[2], middle[1], middle[0], **kwds)
|
image = self.drawPatchQt(
|
||||||
|
(1, 1), middle[2], middle[1], middle[0], **kwds)
|
||||||
|
|
||||||
# side patch
|
# side patch
|
||||||
kwds['foreColor'] = foreColor
|
kwds['foreColor'] = foreColor
|
||||||
kwds['type'] = side[0]
|
kwds['type'] = side[0]
|
||||||
for i in xrange(4):
|
for i in xrange(4):
|
||||||
pos = [(1, 0), (2, 1), (1, 2), (0, 1)][i]
|
pos = [(1, 0), (2, 1), (1, 2), (0, 1)][i]
|
||||||
image = self.drawPatchQt(pos, side[2] + 1 + i, side[1], **kwds)
|
image = self.drawPatchQt(pos, side[2] + 1 + i, side[1], **kwds)
|
||||||
|
|
||||||
# corner patch
|
# corner patch
|
||||||
kwds['foreColor'] = secondColor
|
kwds['foreColor'] = secondColor
|
||||||
kwds['type'] = corner[0]
|
kwds['type'] = corner[0]
|
||||||
for i in xrange(4):
|
for i in xrange(4):
|
||||||
pos = [(0, 0), (2, 0), (2, 2), (0, 2)][i]
|
pos = [(0, 0), (2, 0), (2, 2), (0, 2)][i]
|
||||||
image = self.drawPatchQt(pos, corner[2] + 1 + i, corner[1], **kwds)
|
image = self.drawPatchQt(pos, corner[2] + 1 + i, corner[1], **kwds)
|
||||||
|
|
||||||
return image
|
|
||||||
|
|
||||||
|
|
||||||
def drawPatchQt(self, pos, turn, invert, type, image, size, foreColor,
|
return image
|
||||||
|
|
||||||
|
def drawPatchQt(
|
||||||
|
self, pos, turn, invert, type, image, size, foreColor,
|
||||||
backColor, penwidth):
|
backColor, penwidth):
|
||||||
"""
|
"""
|
||||||
@param size patch size
|
@param size patch size
|
||||||
|
@ -123,97 +124,101 @@ class IdenticonRendererBase(object):
|
||||||
invert = not invert
|
invert = not invert
|
||||||
path = [(0., 0.), (1., 0.), (1., 1.), (0., 1.), (0., 0.)]
|
path = [(0., 0.), (1., 0.), (1., 1.), (0., 1.), (0., 0.)]
|
||||||
|
|
||||||
|
polygon = QtGui.QPolygonF([
|
||||||
polygon = QPolygonF([QPointF(x*size,y*size) for x,y in path])
|
QtCore.QPointF(x*size, y*size) for x, y in path])
|
||||||
|
|
||||||
rot = turn % 4
|
rot = turn % 4
|
||||||
rect = [QPointF(0.,0.), QPointF(size, 0.), QPointF(size, size), QPointF(0., size)]
|
rect = [
|
||||||
rotation = [0,90,180,270]
|
QtCore.QPointF(0., 0.), QtCore.QPointF(size, 0.),
|
||||||
|
QtCore.QPointF(size, size), QtCore.QPointF(0., size)]
|
||||||
nopen = QtGui.QPen(foreColor, Qt.NoPen)
|
rotation = [0, 90, 180, 270]
|
||||||
foreBrush = QtGui.QBrush(foreColor, Qt.SolidPattern)
|
|
||||||
|
nopen = QtGui.QPen(foreColor, QtCore.Qt.NoPen)
|
||||||
|
foreBrush = QtGui.QBrush(foreColor, QtCore.Qt.SolidPattern)
|
||||||
if penwidth > 0:
|
if penwidth > 0:
|
||||||
pen_color = QtGui.QColor(255, 255, 255)
|
pen_color = QtGui.QColor(255, 255, 255)
|
||||||
pen = QtGui.QPen(pen_color, Qt.SolidPattern)
|
pen = QtGui.QPen(pen_color, QtCore.Qt.SolidPattern)
|
||||||
pen.setWidth(penwidth)
|
pen.setWidth(penwidth)
|
||||||
|
|
||||||
painter = QPainter()
|
painter = QtGui.QPainter()
|
||||||
painter.begin(image)
|
painter.begin(image)
|
||||||
painter.setPen(nopen)
|
painter.setPen(nopen)
|
||||||
|
|
||||||
painter.translate(pos[0]*size +penwidth/2, pos[1]*size +penwidth/2)
|
painter.translate(pos[0]*size + penwidth/2, pos[1]*size + penwidth/2)
|
||||||
painter.translate(rect[rot])
|
painter.translate(rect[rot])
|
||||||
painter.rotate(rotation[rot])
|
painter.rotate(rotation[rot])
|
||||||
|
|
||||||
if invert:
|
if invert:
|
||||||
# subtract the actual polygon from a rectangle to invert it
|
# subtract the actual polygon from a rectangle to invert it
|
||||||
poly_rect = QPolygonF(rect)
|
poly_rect = QtGui.QPolygonF(rect)
|
||||||
polygon = poly_rect.subtracted(polygon)
|
polygon = poly_rect.subtracted(polygon)
|
||||||
painter.setBrush(foreBrush)
|
painter.setBrush(foreBrush)
|
||||||
if penwidth > 0:
|
if penwidth > 0:
|
||||||
# draw the borders
|
# draw the borders
|
||||||
painter.setPen(pen)
|
painter.setPen(pen)
|
||||||
painter.drawPolygon(polygon, Qt.WindingFill)
|
painter.drawPolygon(polygon, QtCore.Qt.WindingFill)
|
||||||
# draw the fill
|
# draw the fill
|
||||||
painter.setPen(nopen)
|
painter.setPen(nopen)
|
||||||
painter.drawPolygon(polygon, Qt.WindingFill)
|
painter.drawPolygon(polygon, QtCore.Qt.WindingFill)
|
||||||
|
|
||||||
painter.end()
|
painter.end()
|
||||||
|
|
||||||
return image
|
return image
|
||||||
|
|
||||||
### virtual functions
|
# virtual functions
|
||||||
def decode(self, code):
|
def decode(self, code):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class DonRenderer(IdenticonRendererBase):
|
class DonRenderer(IdenticonRendererBase):
|
||||||
"""
|
"""
|
||||||
Don Park's implementation of identicon
|
Don Park's implementation of identicon
|
||||||
see : http://www.docuverse.com/blog/donpark/2007/01/19/identicon-updated-and-source-released
|
see : http://www.docuverse.com/blog/donpark/2007/01/19/identicon-updated-and-source-released
|
||||||
"""
|
"""
|
||||||
|
|
||||||
PATH_SET = [
|
PATH_SET = [
|
||||||
#[0] full square:
|
# [0] full square:
|
||||||
[(0, 0), (4, 0), (4, 4), (0, 4)],
|
[(0, 0), (4, 0), (4, 4), (0, 4)],
|
||||||
#[1] right-angled triangle pointing top-left:
|
# [1] right-angled triangle pointing top-left:
|
||||||
[(0, 0), (4, 0), (0, 4)],
|
[(0, 0), (4, 0), (0, 4)],
|
||||||
#[2] upwardy triangle:
|
# [2] upwardy triangle:
|
||||||
[(2, 0), (4, 4), (0, 4)],
|
[(2, 0), (4, 4), (0, 4)],
|
||||||
#[3] left half of square, standing rectangle:
|
# [3] left half of square, standing rectangle:
|
||||||
[(0, 0), (2, 0), (2, 4), (0, 4)],
|
[(0, 0), (2, 0), (2, 4), (0, 4)],
|
||||||
#[4] square standing on diagonale:
|
# [4] square standing on diagonale:
|
||||||
[(2, 0), (4, 2), (2, 4), (0, 2)],
|
[(2, 0), (4, 2), (2, 4), (0, 2)],
|
||||||
#[5] kite pointing topleft:
|
# [5] kite pointing topleft:
|
||||||
[(0, 0), (4, 2), (4, 4), (2, 4)],
|
[(0, 0), (4, 2), (4, 4), (2, 4)],
|
||||||
#[6] Sierpinski triangle, fractal triangles:
|
# [6] Sierpinski triangle, fractal triangles:
|
||||||
[(2, 0), (4, 4), (2, 4), (3, 2), (1, 2), (2, 4), (0, 4)],
|
[(2, 0), (4, 4), (2, 4), (3, 2), (1, 2), (2, 4), (0, 4)],
|
||||||
#[7] sharp angled lefttop pointing triangle:
|
# [7] sharp angled lefttop pointing triangle:
|
||||||
[(0, 0), (4, 2), (2, 4)],
|
[(0, 0), (4, 2), (2, 4)],
|
||||||
#[8] small centered square:
|
# [8] small centered square:
|
||||||
[(1, 1), (3, 1), (3, 3), (1, 3)],
|
[(1, 1), (3, 1), (3, 3), (1, 3)],
|
||||||
#[9] two small triangles:
|
# [9] two small triangles:
|
||||||
[(2, 0), (4, 0), (0, 4), (0, 2), (2, 2)],
|
[(2, 0), (4, 0), (0, 4), (0, 2), (2, 2)],
|
||||||
#[10] small topleft square:
|
# [10] small topleft square:
|
||||||
[(0, 0), (2, 0), (2, 2), (0, 2)],
|
[(0, 0), (2, 0), (2, 2), (0, 2)],
|
||||||
#[11] downpointing right-angled triangle on bottom:
|
# [11] downpointing right-angled triangle on bottom:
|
||||||
[(0, 2), (4, 2), (2, 4)],
|
[(0, 2), (4, 2), (2, 4)],
|
||||||
#[12] uppointing right-angled triangle on bottom:
|
# [12] uppointing right-angled triangle on bottom:
|
||||||
[(2, 2), (4, 4), (0, 4)],
|
[(2, 2), (4, 4), (0, 4)],
|
||||||
#[13] small rightbottom pointing right-angled triangle on topleft:
|
# [13] small rightbottom pointing right-angled triangle on topleft:
|
||||||
[(2, 0), (2, 2), (0, 2)],
|
[(2, 0), (2, 2), (0, 2)],
|
||||||
#[14] small lefttop pointing right-angled triangle on topleft:
|
# [14] small lefttop pointing right-angled triangle on topleft:
|
||||||
[(0, 0), (2, 0), (0, 2)],
|
[(0, 0), (2, 0), (0, 2)],
|
||||||
#[15] empty:
|
# [15] empty:
|
||||||
[]]
|
[]]
|
||||||
# get the [0] full square, [4] square standing on diagonale, [8] small centered square, or [15] empty tile:
|
# get the [0] full square, [4] square standing on diagonale,
|
||||||
|
# [8] small centered square, or [15] empty tile:
|
||||||
MIDDLE_PATCH_SET = [0, 4, 8, 15]
|
MIDDLE_PATCH_SET = [0, 4, 8, 15]
|
||||||
|
|
||||||
# modify path set
|
# modify path set
|
||||||
for idx in xrange(len(PATH_SET)):
|
for idx in xrange(len(PATH_SET)):
|
||||||
if PATH_SET[idx]:
|
if PATH_SET[idx]:
|
||||||
p = map(lambda vec: (vec[0] / 4.0, vec[1] / 4.0), PATH_SET[idx])
|
p = map(lambda vec: (vec[0] / 4.0, vec[1] / 4.0), PATH_SET[idx])
|
||||||
PATH_SET[idx] = p + p[:1]
|
PATH_SET[idx] = p + p[:1]
|
||||||
|
|
||||||
def decode(self, code, twoColor):
|
def decode(self, code, twoColor):
|
||||||
# decode the code
|
# decode the code
|
||||||
shift = 0; middleType = (code >> shift) & 0x03
|
shift = 0; middleType = (code >> shift) & 0x03
|
||||||
|
@ -231,25 +236,27 @@ class DonRenderer(IdenticonRendererBase):
|
||||||
shift += 5; second_green= (code >> shift) & 0x1F
|
shift += 5; second_green= (code >> shift) & 0x1F
|
||||||
shift += 5; second_red = (code >> shift) & 0x1F
|
shift += 5; second_red = (code >> shift) & 0x1F
|
||||||
shift += 1; swap_cross = (code >> shift) & 0x01
|
shift += 1; swap_cross = (code >> shift) & 0x01
|
||||||
|
|
||||||
middleType = self.MIDDLE_PATCH_SET[middleType]
|
middleType = self.MIDDLE_PATCH_SET[middleType]
|
||||||
|
|
||||||
foreColor = (red << 3, green << 3, blue << 3)
|
foreColor = (red << 3, green << 3, blue << 3)
|
||||||
foreColor = QtGui.QColor(*foreColor)
|
foreColor = QtGui.QColor(*foreColor)
|
||||||
|
|
||||||
if twoColor:
|
if twoColor:
|
||||||
secondColor = (second_blue << 3, second_green << 3, second_red << 3)
|
secondColor = (
|
||||||
|
second_blue << 3, second_green << 3, second_red << 3)
|
||||||
secondColor = QtGui.QColor(*secondColor)
|
secondColor = QtGui.QColor(*secondColor)
|
||||||
else:
|
else:
|
||||||
secondColor = foreColor
|
secondColor = foreColor
|
||||||
|
|
||||||
return (middleType, middleInvert, 0),\
|
return (middleType, middleInvert, 0),\
|
||||||
(cornerType, cornerInvert, cornerTurn),\
|
(cornerType, cornerInvert, cornerTurn),\
|
||||||
(sideType, sideInvert, sideTurn),\
|
(sideType, sideInvert, sideTurn),\
|
||||||
foreColor, secondColor, swap_cross
|
foreColor, secondColor, swap_cross
|
||||||
|
|
||||||
|
|
||||||
def render_identicon(code, size, twoColor=False, opacity=255, penwidth=0, renderer=None):
|
def render_identicon(
|
||||||
|
code, size, twoColor=False, opacity=255, penwidth=0, renderer=None):
|
||||||
if not renderer:
|
if not renderer:
|
||||||
renderer = DonRenderer
|
renderer = DonRenderer
|
||||||
return renderer(code).render(size, twoColor, opacity, penwidth)
|
return renderer(code).render(size, twoColor, opacity, penwidth)
|
||||||
|
|
|
@ -6,11 +6,13 @@ from multiqueue import MultiQueue
|
||||||
workerQueue = Queue.Queue()
|
workerQueue = Queue.Queue()
|
||||||
UISignalQueue = Queue.Queue()
|
UISignalQueue = Queue.Queue()
|
||||||
addressGeneratorQueue = Queue.Queue()
|
addressGeneratorQueue = Queue.Queue()
|
||||||
# receiveDataThreads dump objects they hear on the network into this queue to be processed.
|
# receiveDataThreads dump objects they hear on the network into
|
||||||
|
# this queue to be processed.
|
||||||
objectProcessorQueue = ObjectProcessorQueue()
|
objectProcessorQueue = ObjectProcessorQueue()
|
||||||
invQueue = MultiQueue()
|
invQueue = MultiQueue()
|
||||||
addrQueue = MultiQueue()
|
addrQueue = MultiQueue()
|
||||||
portCheckerQueue = Queue.Queue()
|
portCheckerQueue = Queue.Queue()
|
||||||
receiveDataQueue = Queue.Queue()
|
receiveDataQueue = Queue.Queue()
|
||||||
apiAddressGeneratorReturnQueue = Queue.Queue(
|
# The address generator thread uses this queue to get information
|
||||||
) # The address generator thread uses this queue to get information back to the API thread.
|
# back to the API thread.
|
||||||
|
apiAddressGeneratorReturnQueue = Queue.Queue()
|
||||||
|
|
34
src/tr.py
34
src/tr.py
|
@ -1,39 +1,21 @@
|
||||||
import os
|
|
||||||
|
|
||||||
import shared
|
import shared
|
||||||
|
|
||||||
# This is used so that the translateText function can be used when we are in daemon mode and not using any QT functions.
|
|
||||||
class translateClass:
|
|
||||||
def __init__(self, context, text):
|
|
||||||
self.context = context
|
|
||||||
self.text = text
|
|
||||||
def arg(self,argument):
|
|
||||||
if '%' in self.text:
|
|
||||||
return translateClass(self.context, self.text.replace('%','',1)) # This doesn't actually do anything with the arguments because we don't have a UI in which to display this information anyway.
|
|
||||||
else:
|
|
||||||
return self.text
|
|
||||||
|
|
||||||
def _translate(context, text, disambiguation = None, encoding = None, n = None):
|
def _translate(context, text, disambiguation=None, n=None):
|
||||||
return translateText(context, text, n)
|
return translateText(context, text, n)
|
||||||
|
|
||||||
def translateText(context, text, n = None):
|
|
||||||
|
def translateText(context, text, n=None):
|
||||||
try:
|
try:
|
||||||
is_daemon = shared.thisapp.daemon
|
is_daemon = shared.thisapp.daemon
|
||||||
except AttributeError: # inside the plugin
|
except AttributeError: # inside the plugin
|
||||||
is_daemon = False
|
is_daemon = False
|
||||||
if not is_daemon:
|
if not is_daemon:
|
||||||
try:
|
from qtpy import QtWidgets, QtCore
|
||||||
from PyQt4 import QtCore, QtGui
|
|
||||||
except Exception as err:
|
|
||||||
print 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon'
|
|
||||||
print 'Error message:', err
|
|
||||||
os._exit(0)
|
|
||||||
if n is None:
|
if n is None:
|
||||||
return QtGui.QApplication.translate(context, text)
|
return QtWidgets.QApplication.translate(context, text)
|
||||||
else:
|
else:
|
||||||
return QtGui.QApplication.translate(context, text, None, QtCore.QCoreApplication.CodecForTr, n)
|
return QtWidgets.QApplication.translate(
|
||||||
|
context, text, None, QtCore.QCoreApplication.CodecForTr, n)
|
||||||
else:
|
else:
|
||||||
if '%' in text:
|
return text
|
||||||
return translateClass(context, text.replace('%','',1))
|
|
||||||
else:
|
|
||||||
return text
|
|
||||||
|
|
Reference in New Issue
Block a user