fix daemon: don't oad wallet if there is a gui

This commit is contained in:
ThomasV 2015-11-30 10:23:38 +01:00
parent a4c767437c
commit 3c11c63289
2 changed files with 11 additions and 7 deletions

View File

@ -356,10 +356,10 @@ if __name__ == '__main__':
network.start()
else:
network = None
server = Daemon(config, network)
gui = init_gui(config, network, plugins)
server = Daemon(config, network, gui)
server.start()
server.gui = init_gui(config, network, plugins)
server.gui.main()
gui.main()
server.stop()
sys.exit(0)

View File

@ -56,12 +56,16 @@ class RequestHandler(SimpleJSONRPCRequestHandler):
class Daemon(util.DaemonThread):
def __init__(self, config, network):
def __init__(self, config, network, gui=None):
util.DaemonThread.__init__(self)
self.config = config
self.network = network
self.gui = gui
self.wallets = {}
self.wallet = self.load_wallet(config)
if gui is None:
self.wallet = self.load_wallet(config)
else:
self.wallet = None
self.cmd_runner = Commands(self.config, self.wallet, self.network)
host = config.get('rpchost', 'localhost')
port = config.get('rpcport', 7777)
@ -72,7 +76,7 @@ class Daemon(util.DaemonThread):
self.server.register_function(self.run_cmdline, 'run_cmdline')
self.server.register_function(self.ping, 'ping')
self.server.register_function(self.daemon, 'daemon')
self.server.register_function(self.gui, 'gui')
self.server.register_function(self.run_gui, 'gui')
def ping(self):
return True
@ -99,7 +103,7 @@ class Daemon(util.DaemonThread):
response = "Daemon stopped"
return response
def gui(self, config_options):
def run_gui(self, config_options):
config = SimpleConfig(config_options)
if self.gui:
if hasattr(self.gui, 'new_window'):