Skip to content

Commit

Permalink
Merge pull request #61 from ynput/enhancement/OP-8244_Clockify-use-AY…
Browse files Browse the repository at this point in the history
…ON-settings

Clockify: Use AYON settings
  • Loading branch information
iLLiCiTiT authored Feb 14, 2024
2 parents 4725d79 + fa55d15 commit 33c2eea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
23 changes: 14 additions & 9 deletions client/ayon_core/modules/clockify/clockify_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@
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"]

if self.enabled and not self.workspace_name:
raise Exception("Clockify Workspace is not set in settings.")
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 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
Expand Down
15 changes: 1 addition & 14 deletions client/ayon_core/settings/ayon_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand Down Expand Up @@ -127,14 +114,14 @@ 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,
):
func(ayon_settings, output, addon_versions, default_settings)

for key in {
"timers_manager",
"clockify",
}:
if addon_versions.get(key):
output[key] = ayon_settings
Expand Down

0 comments on commit 33c2eea

Please sign in to comment.