in gui/mozregui/build_runner.py [0:0]
def init_worker(self, fetch_config, options):
"""
Create and initialize the worker.
Should be subclassed to configure the worker, and should return the
worker method that should start the work.
"""
self.options = options
# global preferences
global_prefs = get_prefs()
self.global_prefs = global_prefs
# apply the global prefs now
apply_prefs(global_prefs)
fetch_config.set_base_url(global_prefs["archive_base_url"])
download_dir = global_prefs["persist"]
if not download_dir:
download_dir = self.mainwindow.persist
persist_limit = PersistLimit(abs(global_prefs["persist_size_limit"]) * 1073741824)
self.download_manager = GuiBuildDownloadManager(download_dir, persist_limit)
self.test_runner = GuiTestRunner()
self.thread = QThread()
# options for the app launcher
launcher_kwargs = {}
for name in ("profile", "preferences"):
if name in options:
value = options[name]
if value:
launcher_kwargs[name] = value
# add add-ons paths to the app launcher
launcher_kwargs["addons"] = options["addons"]
self.test_runner.launcher_kwargs = launcher_kwargs
launcher_kwargs["cmdargs"] = []
if options["profile_persistence"] in ("clone-first", "reuse") or options["profile"]:
launcher_kwargs["cmdargs"] += ["--allow-downgrade"]
# Thunderbird will fail to start if passed an URL arg
if options.get("url") and fetch_config.app_name != "thunderbird":
launcher_kwargs["cmdargs"] += [options["url"]]
# Lang only works for firefox-l10n and thunderbird-l10n.
if options.get("lang"):
if options["application"] in ("firefox-l10n", "thunderbird-l10n"):
fetch_config.set_lang(options["lang"])
else:
raise MozRegressionError("Invalid lang argument")
self.worker = self.worker_class(fetch_config, self.test_runner, self.download_manager)
# Move self.bisector in the thread. This will
# allow to the self.bisector slots (connected after the move)
# to be automatically called in the thread.
self.worker.moveToThread(self.thread)
self.worker_created.emit(self.worker)