Merge branch 'develop' into feature/module_attributes_in_tray_menu

This commit is contained in:
Milan Kolar 2020-07-08 08:58:27 +02:00 committed by GitHub
commit f49591000d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 379 additions and 49 deletions

View file

@ -0,0 +1,58 @@
[
{
"title": "User settings",
"type": "module",
"import_path": "pype.modules.user",
"fromlist": ["pype", "modules"]
}, {
"title": "Ftrack",
"type": "module",
"import_path": "pype.modules.ftrack.tray",
"fromlist": ["pype", "modules", "ftrack"]
}, {
"title": "Muster",
"type": "module",
"import_path": "pype.modules.muster",
"fromlist": ["pype", "modules"]
}, {
"title": "Avalon",
"type": "module",
"import_path": "pype.modules.avalon_apps",
"fromlist": ["pype", "modules"]
}, {
"title": "Clockify",
"type": "module",
"import_path": "pype.modules.clockify",
"fromlist": ["pype", "modules"]
}, {
"title": "Standalone Publish",
"type": "module",
"import_path": "pype.modules.standalonepublish",
"fromlist": ["pype", "modules"]
}, {
"title": "Logging",
"type": "module",
"import_path": "pype.modules.logging.tray",
"fromlist": ["pype", "modules", "logging"]
}, {
"title": "Idle Manager",
"type": "module",
"import_path": "pype.modules.idle_manager",
"fromlist": ["pype","modules"]
}, {
"title": "Timers Manager",
"type": "module",
"import_path": "pype.modules.timers_manager",
"fromlist": ["pype","modules"]
}, {
"title": "Rest Api",
"type": "module",
"import_path": "pype.modules.rest_api",
"fromlist": ["pype","modules"]
}, {
"title": "Adobe Communicator",
"type": "module",
"import_path": "pype.modules.adobe_communicator",
"fromlist": ["pype", "modules"]
}
]

View file

@ -12,28 +12,34 @@ class TrayManager:
Load submenus, actions, separators and modules into tray's context.
"""
modules = {}
services = {}
services_submenu = None
errors = []
items = (
config.get_presets(first_run=True)
.get('tray', {})
.get('menu_items', [])
)
available_sourcetypes = ['python', 'file']
available_sourcetypes = ["python", "file"]
def __init__(self, tray_widget, main_window):
self.tray_widget = tray_widget
self.main_window = main_window
self.log = Logger().get_logger(self.__class__.__name__)
self.icon_run = QtGui.QIcon(get_resource('circle_green.png'))
self.icon_stay = QtGui.QIcon(get_resource('circle_orange.png'))
self.icon_failed = QtGui.QIcon(get_resource('circle_red.png'))
self.modules = {}
self.services = {}
self.services_submenu = None
self.services_thread = None
self.errors = []
CURRENT_DIR = os.path.dirname(__file__)
self.modules_imports = config.load_json(
os.path.join(CURRENT_DIR, "modules_imports.json")
)
presets = config.get_presets(first_run=True)
try:
self.modules_usage = presets["tray"]["menu_items"]["item_usage"]
except Exception:
self.modules_usage = {}
self.log.critical("Couldn't find modules usage data.")
self.icon_run = QtGui.QIcon(get_resource("circle_green.png"))
self.icon_stay = QtGui.QIcon(get_resource("circle_orange.png"))
self.icon_failed = QtGui.QIcon(get_resource("circle_red.png"))
def process_presets(self):
"""Add modules to tray by presets.
@ -46,21 +52,10 @@ class TrayManager:
"item_usage": {
"Statics Server": false
}
}, {
"item_import": [{
"title": "Ftrack",
"type": "module",
"import_path": "pype.ftrack.tray",
"fromlist": ["pype", "ftrack"]
}, {
"title": "Statics Server",
"type": "module",
"import_path": "pype.services.statics_server",
"fromlist": ["pype","services"]
}]
}
In this case `Statics Server` won't be used.
"""
# Backwards compatible presets loading
if isinstance(self.items, list):
items = self.items