From 3541625825302dc92113092994de3a5b3f4aa188 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 3 Jan 2017 15:51:42 -0500 Subject: [PATCH] move launch into own function --- lbrynet/lbrynet_daemon/Daemon.py | 4 +++- lbrynet/lbrynet_daemon/UIManager.py | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lbrynet/lbrynet_daemon/Daemon.py b/lbrynet/lbrynet_daemon/Daemon.py index e8e40c6cf..a533cde1b 100644 --- a/lbrynet/lbrynet_daemon/Daemon.py +++ b/lbrynet/lbrynet_daemon/Daemon.py @@ -329,7 +329,9 @@ class Daemon(AuthJSONRPCServer): if conf.settings.host_ui: self.lbry_ui_manager.update_checker.start(1800, now=False) - yield self.lbry_ui_manager.setup(launch=launch_ui) + yield self.lbry_ui_manager.setup() + if launch_ui: + self.lbry_ui_manager.launch() yield self._initial_setup() yield threads.deferToThread(self._setup_data_directory) yield self._check_db_migration() diff --git a/lbrynet/lbrynet_daemon/UIManager.py b/lbrynet/lbrynet_daemon/UIManager.py index 2321ec2d3..0624d513c 100644 --- a/lbrynet/lbrynet_daemon/UIManager.py +++ b/lbrynet/lbrynet_daemon/UIManager.py @@ -59,7 +59,7 @@ class UIManager(object): self.loaded_branch = None self.loaded_requirements = None - def setup(self, branch=None, check_requirements=None, user_specified=None, launch=False): + def setup(self, branch=None, check_requirements=None, user_specified=None): local_ui_path = user_specified or conf.settings.local_ui_path self.branch = branch or conf.settings.ui_branch @@ -94,8 +94,6 @@ class UIManager(object): d = self._up_to_date() d.addCallback(lambda r: self._download_ui() if not r else self._load_ui()) - if launch: - d.addCallback(lambda _: webbrowser.open(conf.settings.UI_ADDRESS)) return d def _check_for_bundled_ui(self): @@ -213,6 +211,9 @@ class UIManager(object): def _load_ui(self): return load_ui(self.root, self.active_dir) + def launch(self): + webbrowser.open(conf.settings.UI_ADDRESS) + class BundledUIManager(object): """Copies the UI bundled with lbrynet, if available.