Merge pull request #61 from ynput/enhancement/OP-8244_Clockify-use-AYON-settings

Clockify: Use AYON settings
This commit is contained in:
Jakub Trllo 2024-02-14 13:14:36 +01:00 committed by GitHub
commit 33c2eeaa12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 22 deletions

View file

@ -2,22 +2,27 @@ import os
import threading
import time
from ayon_core.modules import OpenPypeModule, ITrayModule, IPluginPaths
from ayon_core.modules import AYONAddon, ITrayModule, IPluginPaths
from ayon_core.client import get_asset_by_name
from .constants import CLOCKIFY_FTRACK_USER_PATH, CLOCKIFY_FTRACK_SERVER_PATH
class ClockifyModule(OpenPypeModule, ITrayModule, IPluginPaths):
class ClockifyModule(AYONAddon, ITrayModule, IPluginPaths):
name = "clockify"
def initialize(self, modules_settings):
clockify_settings = modules_settings[self.name]
self.enabled = clockify_settings["enabled"]
self.workspace_name = clockify_settings["workspace_name"]
def initialize(self, studio_settings):
enabled = self.name in studio_settings
workspace_name = None
if enabled:
clockify_settings = studio_settings[self.name]
workspace_name = clockify_settings["workspace_name"]
if self.enabled and not self.workspace_name:
raise Exception("Clockify Workspace is not set in settings.")
if enabled and workspace_name:
self.log.warning("Clockify Workspace is not set in settings.")
enabled = False
self.enabled = enabled
self.workspace_name = workspace_name
self.timer_manager = None
self.MessageWidgetClass = None

View file

@ -76,19 +76,6 @@ def _convert_kitsu_system_settings(
output["modules"]["kitsu"] = kitsu_settings
def _convert_clockify_system_settings(
ayon_settings, output, addon_versions, default_settings
):
enabled = addon_versions.get("clockify") is not None
clockify_settings = default_settings["modules"]["clockify"]
clockify_settings["enabled"] = enabled
if enabled:
clockify_settings["workspace_name"] = (
ayon_settings["clockify"]["workspace_name"]
)
output["modules"]["clockify"] = clockify_settings
def _convert_deadline_system_settings(
ayon_settings, output, addon_versions, default_settings
):
@ -127,7 +114,6 @@ def _convert_modules_system(
# TODO add 'enabled' values
for func in (
_convert_kitsu_system_settings,
_convert_clockify_system_settings,
_convert_deadline_system_settings,
_convert_royalrender_system_settings,
):
@ -135,6 +121,7 @@ def _convert_modules_system(
for key in {
"timers_manager",
"clockify",
}:
if addon_versions.get(key):
output[key] = ayon_settings