Merge pull request #410 from Atheros1/master

added some more error handling
This commit is contained in:
Jonathan Warren 2013-08-14 16:47:51 -07:00
commit 49d16a502e
3 changed files with 20 additions and 14 deletions

View File

@ -438,6 +438,7 @@ 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.
try:
options = {} options = {}
options["type"] = shared.config.get('bitmessagesettings', 'namecoinrpctype') options["type"] = shared.config.get('bitmessagesettings', 'namecoinrpctype')
options["host"] = shared.config.get('bitmessagesettings', 'namecoinrpchost') options["host"] = shared.config.get('bitmessagesettings', 'namecoinrpchost')
@ -447,6 +448,9 @@ class MyForm(QtGui.QMainWindow):
nc = namecoinConnection(options) nc = namecoinConnection(options)
if nc.test()[0] == 'failed': if nc.test()[0] == 'failed':
self.ui.pushButtonFetchNamecoinID.hide() 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()
# Show or hide the application window after clicking an item within the # Show or hide the application window after clicking an item within the
@ -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()

View File

@ -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 = ''

View File

@ -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")