Merge pull request #333 from Atheros1/master
Further work to implement the Connect dialog on startup
This commit is contained in:
commit
63b201e6a8
|
@ -56,8 +56,6 @@ def connectToStream(streamNumber):
|
||||||
# This is one of several classes that constitute the API
|
# This is one of several classes that constitute the API
|
||||||
# This class was written by Vaibhav Bhatia. Modified by Jonathan Warren (Atheros).
|
# This class was written by Vaibhav Bhatia. Modified by Jonathan Warren (Atheros).
|
||||||
# http://code.activestate.com/recipes/501148-xmlrpc-serverclient-which-does-cookie-handling-and/
|
# http://code.activestate.com/recipes/501148-xmlrpc-serverclient-which-does-cookie-handling-and/
|
||||||
|
|
||||||
|
|
||||||
class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
|
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
|
@ -719,7 +717,6 @@ if __name__ == "__main__":
|
||||||
# signal.signal(signal.SIGINT, signal.SIG_DFL)
|
# signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||||
|
|
||||||
helper_bootstrap.knownNodes()
|
helper_bootstrap.knownNodes()
|
||||||
helper_bootstrap.dns()
|
|
||||||
# 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
|
addressGeneratorThread.daemon = True # close the main program even if there are threads left
|
||||||
|
@ -757,13 +754,6 @@ if __name__ == "__main__":
|
||||||
singleAPIThread = singleAPI()
|
singleAPIThread = singleAPI()
|
||||||
singleAPIThread.daemon = True # close the main program even if there are threads left
|
singleAPIThread.daemon = True # close the main program even if there are threads left
|
||||||
singleAPIThread.start()
|
singleAPIThread.start()
|
||||||
# self.singleAPISignalHandlerThread = singleAPISignalHandler()
|
|
||||||
# self.singleAPISignalHandlerThread.start()
|
|
||||||
# QtCore.QObject.connect(self.singleAPISignalHandlerThread, QtCore.SIGNAL("updateStatusBar(PyQt_PyObject)"), self.updateStatusBar)
|
|
||||||
# QtCore.QObject.connect(self.singleAPISignalHandlerThread, QtCore.SIGNAL("passAddressGeneratorObjectThrough(PyQt_PyObject)"), self.connectObjectToAddressGeneratorSignals)
|
|
||||||
# QtCore.QObject.connect(self.singleAPISignalHandlerThread,
|
|
||||||
# QtCore.SIGNAL("displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"),
|
|
||||||
# self.displayNewSentMessage)
|
|
||||||
|
|
||||||
connectToStream(1)
|
connectToStream(1)
|
||||||
|
|
||||||
|
@ -783,6 +773,7 @@ if __name__ == "__main__":
|
||||||
import bitmessageqt
|
import bitmessageqt
|
||||||
bitmessageqt.run()
|
bitmessageqt.run()
|
||||||
else:
|
else:
|
||||||
|
shared.config.remove_option('bitmessagesettings', 'dontconnect')
|
||||||
with shared.printLock:
|
with shared.printLock:
|
||||||
print 'Running as a daemon. You can use Ctrl+C to exit.'
|
print 'Running as a daemon. You can use Ctrl+C to exit.'
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'connect.ui'
|
# Form implementation generated from reading ui file 'connect.ui'
|
||||||
#
|
#
|
||||||
# Created: Wed Jul 24 10:41:58 2013
|
# Created: Wed Jul 24 12:42:01 2013
|
||||||
# by: PyQt4 UI code generator 4.10
|
# by: PyQt4 UI code generator 4.10
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
@ -36,9 +36,9 @@ class Ui_connectDialog(object):
|
||||||
self.radioButtonConnectNow.setChecked(True)
|
self.radioButtonConnectNow.setChecked(True)
|
||||||
self.radioButtonConnectNow.setObjectName(_fromUtf8("radioButtonConnectNow"))
|
self.radioButtonConnectNow.setObjectName(_fromUtf8("radioButtonConnectNow"))
|
||||||
self.gridLayout.addWidget(self.radioButtonConnectNow, 1, 0, 1, 2)
|
self.gridLayout.addWidget(self.radioButtonConnectNow, 1, 0, 1, 2)
|
||||||
self.radioButton = QtGui.QRadioButton(connectDialog)
|
self.radioButtonConfigureNetwork = QtGui.QRadioButton(connectDialog)
|
||||||
self.radioButton.setObjectName(_fromUtf8("radioButton"))
|
self.radioButtonConfigureNetwork.setObjectName(_fromUtf8("radioButtonConfigureNetwork"))
|
||||||
self.gridLayout.addWidget(self.radioButton, 2, 0, 1, 2)
|
self.gridLayout.addWidget(self.radioButtonConfigureNetwork, 2, 0, 1, 2)
|
||||||
spacerItem = QtGui.QSpacerItem(185, 24, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
spacerItem = QtGui.QSpacerItem(185, 24, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
|
||||||
self.gridLayout.addItem(spacerItem, 3, 0, 1, 1)
|
self.gridLayout.addItem(spacerItem, 3, 0, 1, 1)
|
||||||
self.buttonBox = QtGui.QDialogButtonBox(connectDialog)
|
self.buttonBox = QtGui.QDialogButtonBox(connectDialog)
|
||||||
|
@ -53,8 +53,8 @@ class Ui_connectDialog(object):
|
||||||
QtCore.QMetaObject.connectSlotsByName(connectDialog)
|
QtCore.QMetaObject.connectSlotsByName(connectDialog)
|
||||||
|
|
||||||
def retranslateUi(self, connectDialog):
|
def retranslateUi(self, connectDialog):
|
||||||
connectDialog.setWindowTitle(_translate("connectDialog", "Dialog", None))
|
connectDialog.setWindowTitle(_translate("connectDialog", "Bitmessage", None))
|
||||||
self.label.setText(_translate("connectDialog", "Bitmessage won\'t connect to anyone until you let it. ", None))
|
self.label.setText(_translate("connectDialog", "Bitmessage won\'t connect to anyone until you let it. ", None))
|
||||||
self.radioButtonConnectNow.setText(_translate("connectDialog", "Connect now", None))
|
self.radioButtonConnectNow.setText(_translate("connectDialog", "Connect now", None))
|
||||||
self.radioButton.setText(_translate("connectDialog", "Let me configure special network settings first", None))
|
self.radioButtonConfigureNetwork.setText(_translate("connectDialog", "Let me configure special network settings first", None))
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Bitmessage</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="2">
|
<item row="2" column="0" colspan="2">
|
||||||
<widget class="QRadioButton" name="radioButton">
|
<widget class="QRadioButton" name="radioButtonConfigureNetwork">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Let me configure special network settings first</string>
|
<string>Let me configure special network settings first</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -3,6 +3,7 @@ import shared
|
||||||
import socket
|
import socket
|
||||||
from class_sendDataThread import *
|
from class_sendDataThread import *
|
||||||
from class_receiveDataThread import *
|
from class_receiveDataThread import *
|
||||||
|
import helper_bootstrap
|
||||||
|
|
||||||
# Only one singleListener thread will ever exist. It creates the
|
# Only one singleListener thread will ever exist. It creates the
|
||||||
# receiveDataThread and sendDataThread for each incoming connection. Note
|
# receiveDataThread and sendDataThread for each incoming connection. Note
|
||||||
|
@ -21,14 +22,15 @@ class singleListener(threading.Thread):
|
||||||
self.selfInitiatedConnections = selfInitiatedConnections
|
self.selfInitiatedConnections = selfInitiatedConnections
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
while shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'):
|
||||||
|
time.sleep(1)
|
||||||
|
helper_bootstrap.dns()
|
||||||
# We typically don't want to accept incoming connections if the user is using a
|
# We typically don't want to accept incoming connections if the user is using a
|
||||||
# SOCKS proxy, unless they have configured otherwise. If they eventually select
|
# SOCKS proxy, unless they have configured otherwise. If they eventually select
|
||||||
# proxy 'none' or configure SOCKS listening then this will start listening for
|
# proxy 'none' or configure SOCKS listening then this will start listening for
|
||||||
# connections.
|
# connections.
|
||||||
while shared.config.get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' and not shared.config.getboolean('bitmessagesettings', 'sockslisten'):
|
while shared.config.get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' and not shared.config.getboolean('bitmessagesettings', 'sockslisten'):
|
||||||
time.sleep(10)
|
time.sleep(5)
|
||||||
while shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'):
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
with shared.printLock:
|
with shared.printLock:
|
||||||
print 'Listening for incoming connections.'
|
print 'Listening for incoming connections.'
|
||||||
|
|
|
@ -12,21 +12,18 @@ def knownNodes():
|
||||||
shared.knownNodes = pickle.load(pickleFile)
|
shared.knownNodes = pickle.load(pickleFile)
|
||||||
pickleFile.close()
|
pickleFile.close()
|
||||||
except:
|
except:
|
||||||
defaultKnownNodes.createDefaultKnownNodes(shared.appdata)
|
shared.knownNodes = defaultKnownNodes.createDefaultKnownNodes(shared.appdata)
|
||||||
pickleFile = open(shared.appdata + 'knownnodes.dat', 'rb')
|
|
||||||
shared.knownNodes = pickle.load(pickleFile)
|
|
||||||
pickleFile.close()
|
|
||||||
if shared.config.getint('bitmessagesettings', 'settingsversion') > 6:
|
if shared.config.getint('bitmessagesettings', 'settingsversion') > 6:
|
||||||
print 'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.'
|
print 'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.'
|
||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
|
|
||||||
def dns():
|
def dns():
|
||||||
# DNS bootstrap. This could be programmed to use the SOCKS proxy to do the
|
# DNS bootstrap. This could be programmed to use the SOCKS proxy to do the
|
||||||
# DNS lookup some day but for now we will just rely on the entries in
|
# DNS lookup some day but for now we will just rely on the entries in
|
||||||
# defaultKnownNodes.py. Hopefully either they are up to date or the user
|
# defaultKnownNodes.py. Hopefully either they are up to date or the user
|
||||||
# has run Bitmessage recently without SOCKS turned on and received good
|
# has run Bitmessage recently without SOCKS turned on and received good
|
||||||
# bootstrap nodes using that method.
|
# bootstrap nodes using that method.
|
||||||
|
with shared.printLock:
|
||||||
if shared.config.get('bitmessagesettings', 'socksproxytype') == 'none':
|
if shared.config.get('bitmessagesettings', 'socksproxytype') == 'none':
|
||||||
try:
|
try:
|
||||||
for item in socket.getaddrinfo('bootstrap8080.bitmessage.org', 80):
|
for item in socket.getaddrinfo('bootstrap8080.bitmessage.org', 80):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user