From 3c11c632899da3b4c6a3d56e58fb4894693f4048 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Mon, 30 Nov 2015 10:23:38 +0100 Subject: [PATCH] fix daemon: don't oad wallet if there is a gui --- electrum | 6 +++--- lib/daemon.py | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/electrum b/electrum index b151dd733..ee53b4b27 100755 --- a/electrum +++ b/electrum @@ -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) diff --git a/lib/daemon.py b/lib/daemon.py index 4dbcebd2f..e2dbaa766 100644 --- a/lib/daemon.py +++ b/lib/daemon.py @@ -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'):