Merge branch '2.x/develop' into develop

This commit is contained in:
Jakub Trllo 2020-07-09 15:00:55 +02:00 committed by GitHub
commit aa97c54aa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,35 +61,29 @@ class TrayManager:
In this case `Statics Server` won't be used.
"""
# Backwards compatible presets loading
if isinstance(self.items, list):
items = self.items
else:
items = []
# Get booleans is module should be used
usages = self.items.get("item_usage") or {}
attributes = self.items.get("attributes") or {}
for item in self.items.get("item_import", []):
import_path = item.get("import_path")
title = item.get("title")
items = []
# Get booleans is module should be used
for item in self.modules_imports:
import_path = item.get("import_path")
title = item.get("title")
item_usage = usages.get(title)
if item_usage is None:
item_usage = usages.get(import_path, True)
if not item_usage:
if not title:
title = import_path
self.log.debug("{} - Module ignored".format(title))
continue
item_usage = self.modules_usage.get(title)
if item_usage is None:
item_usage = self.modules_usage.get(import_path, True)
if item_usage:
_attributes = attributes.get(title)
if _attributes is None:
_attributes = attributes.get(import_path)
if _attributes:
item["attributes"] = _attributes
items.append(item)
else:
if not title:
title = import_path
self.log.info("{} - Module ignored".format(title))
if items:
self.process_items(items, self.tray_widget.menu)