commit 0e2db1e0caa774bdb5ebf811ecab7b0d700fda9c
parent 0fa38074deea8ab4e07c9b948f0fea8a21dfae29
Author: ThomasV <thomasv@gitorious>
Date: Tue, 1 Sep 2015 10:17:55 +0200
don't try to open window if started in daemon mode
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/electrum b/electrum
@@ -295,8 +295,11 @@ class ClientThread(util.DaemonThread):
config = SimpleConfig(config_options)
cmd = config.get('cmd')
if cmd == 'gui':
- self.server.gui.new_window(config)
- response = "ok"
+ if self.server.gui:
+ self.server.gui.new_window(config)
+ response = "ok"
+ else:
+ response = "Error: Electrum daemon is running"
elif cmd == 'daemon':
sub = config.get('subcommand')
assert sub in ['start', 'stop', 'status']
@@ -340,6 +343,8 @@ class NetworkServer(util.DaemonThread):
self.lock = threading.RLock()
# each GUI is a client of the daemon
self.clients = []
+ # gui is None is we run as daemon
+ self.gui = None
def add_client(self, client):
for key in ['fee', 'status', 'banner', 'updated', 'servers', 'interfaces']: