mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #49 from ynput/enhancement/OP-8231_TimersManager-use-AYON-settings
Timers Manager: Use AYON settings
This commit is contained in:
commit
0df7385c3f
2 changed files with 29 additions and 42 deletions
|
|
@ -3,8 +3,8 @@ import platform
|
|||
|
||||
|
||||
from ayon_core.client import get_asset_by_name
|
||||
from ayon_core.modules import (
|
||||
OpenPypeModule,
|
||||
from ayon_core.addon import (
|
||||
AYONAddon,
|
||||
ITrayService,
|
||||
IPluginPaths
|
||||
)
|
||||
|
|
@ -76,7 +76,7 @@ class ExampleTimersManagerConnector:
|
|||
|
||||
|
||||
class TimersManager(
|
||||
OpenPypeModule,
|
||||
AYONAddon,
|
||||
ITrayService,
|
||||
IPluginPaths
|
||||
):
|
||||
|
|
@ -99,23 +99,27 @@ class TimersManager(
|
|||
"start_timer"
|
||||
)
|
||||
|
||||
def initialize(self, modules_settings):
|
||||
timers_settings = modules_settings[self.name]
|
||||
def initialize(self, studio_settings):
|
||||
timers_settings = studio_settings.get(self.name)
|
||||
enabled = timers_settings is not None
|
||||
|
||||
self.enabled = timers_settings["enabled"]
|
||||
auto_stop = False
|
||||
full_time = 0
|
||||
message_time = 0
|
||||
if enabled:
|
||||
# When timer will stop if idle manager is running (minutes)
|
||||
full_time = int(timers_settings["full_time"] * 60)
|
||||
# How many minutes before the timer is stopped will popup the message
|
||||
message_time = int(timers_settings["message_time"] * 60)
|
||||
|
||||
# When timer will stop if idle manager is running (minutes)
|
||||
full_time = int(timers_settings["full_time"] * 60)
|
||||
# How many minutes before the timer is stopped will popup the message
|
||||
message_time = int(timers_settings["message_time"] * 60)
|
||||
|
||||
auto_stop = timers_settings["auto_stop"]
|
||||
platform_name = platform.system().lower()
|
||||
# Turn of auto stop on MacOs because pynput requires root permissions
|
||||
# and on linux can cause thread locks on application close
|
||||
if full_time <= 0 or platform_name in ("darwin", "linux"):
|
||||
auto_stop = False
|
||||
auto_stop = timers_settings["auto_stop"]
|
||||
platform_name = platform.system().lower()
|
||||
# Turn of auto stop on MacOs because pynput requires root permissions
|
||||
# and on linux can cause thread locks on application close
|
||||
if full_time <= 0 or platform_name in ("darwin", "linux"):
|
||||
auto_stop = False
|
||||
|
||||
self.enabled = enabled
|
||||
self.auto_stop = auto_stop
|
||||
self.time_show_message = full_time - message_time
|
||||
self.time_stop_timer = full_time
|
||||
|
|
|
|||
|
|
@ -76,26 +76,6 @@ def _convert_kitsu_system_settings(
|
|||
output["modules"]["kitsu"] = kitsu_settings
|
||||
|
||||
|
||||
def _convert_timers_manager_system_settings(
|
||||
ayon_settings, output, addon_versions, default_settings
|
||||
):
|
||||
enabled = addon_versions.get("timers_manager") is not None
|
||||
manager_settings = default_settings["modules"]["timers_manager"]
|
||||
manager_settings["enabled"] = enabled
|
||||
if enabled:
|
||||
ayon_manager = ayon_settings["timers_manager"]
|
||||
manager_settings.update({
|
||||
key: ayon_manager[key]
|
||||
for key in {
|
||||
"auto_stop",
|
||||
"full_time",
|
||||
"message_time",
|
||||
"disregard_publishing"
|
||||
}
|
||||
})
|
||||
output["modules"]["timers_manager"] = manager_settings
|
||||
|
||||
|
||||
def _convert_clockify_system_settings(
|
||||
ayon_settings, output, addon_versions, default_settings
|
||||
):
|
||||
|
|
@ -147,21 +127,24 @@ def _convert_modules_system(
|
|||
# TODO add 'enabled' values
|
||||
for func in (
|
||||
_convert_kitsu_system_settings,
|
||||
_convert_timers_manager_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",
|
||||
}:
|
||||
if addon_versions.get(key):
|
||||
output[key] = ayon_settings
|
||||
else:
|
||||
output.pop(key, None)
|
||||
|
||||
modules_settings = output["modules"]
|
||||
for module_name in (
|
||||
"sync_server",
|
||||
"log_viewer",
|
||||
"standalonepublish_tool",
|
||||
"project_manager",
|
||||
"job_queue",
|
||||
"avalon",
|
||||
"addon_paths",
|
||||
):
|
||||
settings = default_settings["modules"][module_name]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue