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()
|
||||
|
||||
# Check to see whether we can connect to namecoin. Hide the 'Fetch Namecoin ID' button if we can't.
|
||||
options = {}
|
||||
options["type"] = shared.config.get('bitmessagesettings', 'namecoinrpctype')
|
||||
options["host"] = shared.config.get('bitmessagesettings', 'namecoinrpchost')
|
||||
options["port"] = shared.config.get('bitmessagesettings', 'namecoinrpcport')
|
||||
options["user"] = shared.config.get('bitmessagesettings', 'namecoinrpcuser')
|
||||
options["password"] = shared.config.get('bitmessagesettings', 'namecoinrpcpassword')
|
||||
nc = namecoinConnection(options)
|
||||
if nc.test()[0] == 'failed':
|
||||
try:
|
||||
options = {}
|
||||
options["type"] = shared.config.get('bitmessagesettings', 'namecoinrpctype')
|
||||
options["host"] = shared.config.get('bitmessagesettings', 'namecoinrpchost')
|
||||
options["port"] = shared.config.get('bitmessagesettings', 'namecoinrpcport')
|
||||
options["user"] = shared.config.get('bitmessagesettings', 'namecoinrpcuser')
|
||||
options["password"] = shared.config.get('bitmessagesettings', 'namecoinrpcpassword')
|
||||
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()
|
||||
|
||||
|
||||
|
@ -3095,8 +3099,6 @@ class settingsDialog(QtGui.QDialog):
|
|||
'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes')) / shared.networkDefaultPayloadLengthExtraBytes)))
|
||||
|
||||
# Namecoin integration tab
|
||||
|
||||
ensureNamecoinOptions()
|
||||
nmctype = shared.config.get('bitmessagesettings', 'namecoinrpctype')
|
||||
self.ui.lineEditNamecoinHost.setText(str(
|
||||
shared.config.get('bitmessagesettings', 'namecoinrpchost')))
|
||||
|
@ -3200,9 +3202,11 @@ class settingsDialog(QtGui.QDialog):
|
|||
options["user"] = self.ui.lineEditNamecoinUser.text()
|
||||
options["password"] = self.ui.lineEditNamecoinPassword.text()
|
||||
nc = namecoinConnection(options)
|
||||
responseStatus = nc.test()[1]
|
||||
self.ui.labelNamecoinTestResult.setText(responseStatus)
|
||||
if nc.test()[0]== 'success':
|
||||
response = nc.test()
|
||||
responseStatus = response[0]
|
||||
responseText = response[1]
|
||||
self.ui.labelNamecoinTestResult.setText(responseText)
|
||||
if responseStatus== 'success':
|
||||
self.parent.ui.pushButtonFetchNamecoinID.show()
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import shutil # used for moving the messages.dat file
|
|||
import sys
|
||||
import os
|
||||
from debug import logger
|
||||
from namecoin import ensureNamecoinOptions
|
||||
|
||||
# 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
|
||||
|
@ -190,6 +191,8 @@ class sqlThread(threading.Thread):
|
|||
if not shared.config.has_option('bitmessagesettings', 'sockslisten'):
|
||||
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
|
||||
item = '''SELECT value FROM settings WHERE key='version';'''
|
||||
parameters = ''
|
||||
|
|
|
@ -52,7 +52,6 @@ class namecoinConnection (object):
|
|||
# actually changing the values (yet).
|
||||
def __init__ (self, options = None):
|
||||
if options is None:
|
||||
ensureNamecoinOptions ()
|
||||
self.nmctype = shared.config.get (configSection, "namecoinrpctype")
|
||||
self.host = shared.config.get (configSection, "namecoinrpchost")
|
||||
self.port = shared.config.get (configSection, "namecoinrpcport")
|
||||
|
|
Loading…
Reference in New Issue
Block a user