Simplify for loop

This commit is contained in:
Florian Bruhin 2017-12-06 19:53:58 +01:00
parent 2633dcc0d5
commit a37ecc353c

View File

@ -257,6 +257,7 @@ def inject_userscripts():
# ourselves so we need to remove all gm scripts, while not removing # ourselves so we need to remove all gm scripts, while not removing
# any other stuff that might have been added. Like the one for # any other stuff that might have been added. Like the one for
# stylesheets. # stylesheets.
greasemonkey = objreg.get('greasemonkey')
for profile in [default_profile, private_profile]: for profile in [default_profile, private_profile]:
scripts = profile.scripts() scripts = profile.scripts()
for script in scripts.toList(): for script in scripts.toList():
@ -265,9 +266,7 @@ def inject_userscripts():
.format(script.name())) .format(script.name()))
scripts.remove(script) scripts.remove(script)
for profile in [default_profile, private_profile]: # Then add the new scripts.
scripts = profile.scripts()
greasemonkey = objreg.get('greasemonkey')
for script in greasemonkey.all_scripts(): for script in greasemonkey.all_scripts():
new_script = QWebEngineScript() new_script = QWebEngineScript()
new_script.setWorldId(QWebEngineScript.MainWorld) new_script.setWorldId(QWebEngineScript.MainWorld)