mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added settings module
This commit is contained in:
parent
66761a2544
commit
8c2f4876c9
3 changed files with 58 additions and 2 deletions
|
|
@ -7,7 +7,7 @@ from .base import (
|
|||
ModulesManager,
|
||||
TrayModulesManager
|
||||
)
|
||||
|
||||
from .settings_module import SettingsModule
|
||||
from .rest_api import (
|
||||
RestApiModule,
|
||||
IRestApi
|
||||
|
|
@ -44,6 +44,8 @@ __all__ = (
|
|||
"ModulesManager",
|
||||
"TrayModulesManager",
|
||||
|
||||
"SettingsModule",
|
||||
|
||||
"UserModule",
|
||||
"IUserModule",
|
||||
|
||||
|
|
|
|||
|
|
@ -390,7 +390,8 @@ class TrayModulesManager(ModulesManager):
|
|||
"Avalon",
|
||||
"Clockify",
|
||||
"Standalone Publish",
|
||||
"Logging"
|
||||
"Logging",
|
||||
"settings"
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
|||
53
pype/modules/settings_module.py
Normal file
53
pype/modules/settings_module.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
from . import PypeModule, ITrayModule
|
||||
|
||||
|
||||
class SettingsModule(PypeModule, ITrayModule):
|
||||
name = "settings"
|
||||
|
||||
def initialize(self, _modules_settings):
|
||||
# This module is always enabled
|
||||
self.enabled = True
|
||||
|
||||
# User role
|
||||
# TODO should be changeable
|
||||
self.user_role = "manager"
|
||||
|
||||
# Tray attributes
|
||||
self.settings_window = None
|
||||
|
||||
def connect_with_modules(self, *_a, **_kw):
|
||||
return
|
||||
|
||||
def create_settings_window(self):
|
||||
if self.settings_window:
|
||||
return
|
||||
from pype.tools.settings import MainWidget
|
||||
self.settings_window = MainWidget(self.user_role)
|
||||
|
||||
def show_settings_window(self):
|
||||
if not self.settings_window:
|
||||
raise AssertionError("Window is not initialized.")
|
||||
|
||||
self.settings_window.show()
|
||||
|
||||
# Pull window to the front.
|
||||
self.settings_window.raise_()
|
||||
self.settings_window.activateWindow()
|
||||
|
||||
def tray_init(self):
|
||||
self.create_settings_window()
|
||||
|
||||
def tray_menu(self, tray_menu):
|
||||
"""Add **change credentials** option to tray menu."""
|
||||
from Qt import QtWidgets
|
||||
|
||||
# Actions
|
||||
action = QtWidgets.QAction("Settings", tray_menu)
|
||||
action.triggered.connect(self.show_settings_window)
|
||||
tray_menu.addAction(action)
|
||||
|
||||
def tray_start(self):
|
||||
return
|
||||
|
||||
def tray_exit(self):
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue