move launch into own function

This commit is contained in:
Jack 2017-01-03 15:51:42 -05:00
parent 5f8a06443c
commit 3541625825
2 changed files with 7 additions and 4 deletions

View file

@ -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()

View file

@ -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.