Merge pull request #410 from Atheros1/master
added some more error handling
This commit is contained in:
commit
49d16a502e
|
@ -438,14 +438,18 @@ class MyForm(QtGui.QMainWindow):
|
||||||
self.rerenderComboBoxSendFrom()
|
self.rerenderComboBoxSendFrom()
|
||||||
|
|
||||||
# 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.
|
||||||
options = {}
|
try:
|
||||||
options["type"] = shared.config.get('bitmessagesettings', 'namecoinrpctype')
|
options = {}
|
||||||
options["host"] = shared.config.get('bitmessagesettings', 'namecoinrpchost')
|
options["type"] = shared.config.get('bitmessagesettings', 'namecoinrpctype')
|
||||||
options["port"] = shared.config.get('bitmessagesettings', 'namecoinrpcport')
|
options["host"] = shared.config.get('bitmessagesettings', 'namecoinrpchost')
|
||||||
options["user"] = shared.config.get('bitmessagesettings', 'namecoinrpcuser')
|
options["port"] = shared.config.get('bitmessagesettings', 'namecoinrpcport')
|
||||||
options["password"] = shared.config.get('bitmessagesettings', 'namecoinrpcpassword')
|
options["user"] = shared.config.get('bitmessagesettings', 'namecoinrpcuser')
|
||||||
nc = namecoinConnection(options)
|
options["password"] = shared.config.get('bitmessagesettings', 'namecoinrpcpassword')
|
||||||
if nc.test()[0] == 'failed':
|
nc = namecoinConnection(options)
|
||||||
|
if nc.test()[0] == 'failed':
|
||||||
|
self.ui.pushButtonFetchNamecoinID.hide()
|
||||||
|
except:
|
||||||
|
print 'There was a problem testing for a Namecoin daemon. Hiding the Fetch Namecoin ID button'
|
||||||
self.ui.pushButtonFetchNamecoinID.hide()
|
self.ui.pushButtonFetchNamecoinID.hide()
|
||||||
|
|
||||||
|
|
||||||
|
@ -3095,8 +3099,6 @@ class settingsDialog(QtGui.QDialog):
|
||||||
'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes')) / shared.networkDefaultPayloadLengthExtraBytes)))
|
'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes')) / shared.networkDefaultPayloadLengthExtraBytes)))
|
||||||
|
|
||||||
# Namecoin integration tab
|
# Namecoin integration tab
|
||||||
|
|
||||||
ensureNamecoinOptions()
|
|
||||||
nmctype = shared.config.get('bitmessagesettings', 'namecoinrpctype')
|
nmctype = shared.config.get('bitmessagesettings', 'namecoinrpctype')
|
||||||
self.ui.lineEditNamecoinHost.setText(str(
|
self.ui.lineEditNamecoinHost.setText(str(
|
||||||
shared.config.get('bitmessagesettings', 'namecoinrpchost')))
|
shared.config.get('bitmessagesettings', 'namecoinrpchost')))
|
||||||
|
@ -3200,9 +3202,11 @@ class settingsDialog(QtGui.QDialog):
|
||||||
options["user"] = self.ui.lineEditNamecoinUser.text()
|
options["user"] = self.ui.lineEditNamecoinUser.text()
|
||||||
options["password"] = self.ui.lineEditNamecoinPassword.text()
|
options["password"] = self.ui.lineEditNamecoinPassword.text()
|
||||||
nc = namecoinConnection(options)
|
nc = namecoinConnection(options)
|
||||||
responseStatus = nc.test()[1]
|
response = nc.test()
|
||||||
self.ui.labelNamecoinTestResult.setText(responseStatus)
|
responseStatus = response[0]
|
||||||
if nc.test()[0]== 'success':
|
responseText = response[1]
|
||||||
|
self.ui.labelNamecoinTestResult.setText(responseText)
|
||||||
|
if responseStatus== 'success':
|
||||||
self.parent.ui.pushButtonFetchNamecoinID.show()
|
self.parent.ui.pushButtonFetchNamecoinID.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import shutil # used for moving the messages.dat file
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from debug import logger
|
from debug import logger
|
||||||
|
from namecoin import ensureNamecoinOptions
|
||||||
|
|
||||||
# This thread exists because SQLITE3 is so un-threadsafe that we must
|
# This thread exists because SQLITE3 is so un-threadsafe that we must
|
||||||
# submit queries to it and it puts results back in a different queue. They
|
# submit queries to it and it puts results back in a different queue. They
|
||||||
|
@ -190,6 +191,8 @@ class sqlThread(threading.Thread):
|
||||||
if not shared.config.has_option('bitmessagesettings', 'sockslisten'):
|
if not shared.config.has_option('bitmessagesettings', 'sockslisten'):
|
||||||
shared.config.set('bitmessagesettings', 'sockslisten', 'false')
|
shared.config.set('bitmessagesettings', 'sockslisten', 'false')
|
||||||
|
|
||||||
|
ensureNamecoinOptions()
|
||||||
|
|
||||||
# Add a new column to the inventory table to store the first 20 bytes of encrypted messages to support Android app
|
# Add a new column to the inventory table to store the first 20 bytes of encrypted messages to support Android app
|
||||||
item = '''SELECT value FROM settings WHERE key='version';'''
|
item = '''SELECT value FROM settings WHERE key='version';'''
|
||||||
parameters = ''
|
parameters = ''
|
||||||
|
|
|
@ -52,7 +52,6 @@ class namecoinConnection (object):
|
||||||
# actually changing the values (yet).
|
# actually changing the values (yet).
|
||||||
def __init__ (self, options = None):
|
def __init__ (self, options = None):
|
||||||
if options is None:
|
if options is None:
|
||||||
ensureNamecoinOptions ()
|
|
||||||
self.nmctype = shared.config.get (configSection, "namecoinrpctype")
|
self.nmctype = shared.config.get (configSection, "namecoinrpctype")
|
||||||
self.host = shared.config.get (configSection, "namecoinrpchost")
|
self.host = shared.config.get (configSection, "namecoinrpchost")
|
||||||
self.port = shared.config.get (configSection, "namecoinrpcport")
|
self.port = shared.config.get (configSection, "namecoinrpcport")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user