mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
base handler set attribute values based on presets
This commit is contained in:
parent
11fc3ee6fd
commit
01926282d9
1 changed files with 10 additions and 0 deletions
|
|
@ -37,13 +37,23 @@ class BaseHandler(object):
|
|||
# Using decorator
|
||||
self.register = self.register_decorator(self.register)
|
||||
self.launch = self.launch_log(self.launch)
|
||||
self.plugins_presets = plugins_presets
|
||||
|
||||
# Decorator
|
||||
def register_decorator(self, func):
|
||||
@functools.wraps(func)
|
||||
def wrapper_register(*args, **kwargs):
|
||||
|
||||
presets_data = self.plugins_presets.get(self.__class__.__name__)
|
||||
if presets_data:
|
||||
for key, value in presets_data.items():
|
||||
if not hasattr(self, key):
|
||||
continue
|
||||
setattr(self, key, value)
|
||||
|
||||
if self.ignore_me:
|
||||
return
|
||||
|
||||
label = self.__class__.__name__
|
||||
if hasattr(self, 'label'):
|
||||
if self.variant is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue