fix daemon: don't oad wallet if there is a gui
This commit is contained in:
parent
a4c767437c
commit
3c11c63289
6
electrum
6
electrum
|
@ -356,10 +356,10 @@ if __name__ == '__main__':
|
||||||
network.start()
|
network.start()
|
||||||
else:
|
else:
|
||||||
network = None
|
network = None
|
||||||
server = Daemon(config, network)
|
gui = init_gui(config, network, plugins)
|
||||||
|
server = Daemon(config, network, gui)
|
||||||
server.start()
|
server.start()
|
||||||
server.gui = init_gui(config, network, plugins)
|
gui.main()
|
||||||
server.gui.main()
|
|
||||||
server.stop()
|
server.stop()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,16 @@ class RequestHandler(SimpleJSONRPCRequestHandler):
|
||||||
|
|
||||||
class Daemon(util.DaemonThread):
|
class Daemon(util.DaemonThread):
|
||||||
|
|
||||||
def __init__(self, config, network):
|
def __init__(self, config, network, gui=None):
|
||||||
util.DaemonThread.__init__(self)
|
util.DaemonThread.__init__(self)
|
||||||
self.config = config
|
self.config = config
|
||||||
self.network = network
|
self.network = network
|
||||||
|
self.gui = gui
|
||||||
self.wallets = {}
|
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)
|
self.cmd_runner = Commands(self.config, self.wallet, self.network)
|
||||||
host = config.get('rpchost', 'localhost')
|
host = config.get('rpchost', 'localhost')
|
||||||
port = config.get('rpcport', 7777)
|
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.run_cmdline, 'run_cmdline')
|
||||||
self.server.register_function(self.ping, 'ping')
|
self.server.register_function(self.ping, 'ping')
|
||||||
self.server.register_function(self.daemon, 'daemon')
|
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):
|
def ping(self):
|
||||||
return True
|
return True
|
||||||
|
@ -99,7 +103,7 @@ class Daemon(util.DaemonThread):
|
||||||
response = "Daemon stopped"
|
response = "Daemon stopped"
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def gui(self, config_options):
|
def run_gui(self, config_options):
|
||||||
config = SimpleConfig(config_options)
|
config = SimpleConfig(config_options)
|
||||||
if self.gui:
|
if self.gui:
|
||||||
if hasattr(self.gui, 'new_window'):
|
if hasattr(self.gui, 'new_window'):
|
||||||
|
|
Loading…
Reference in New Issue