mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
use 'AYONAddon' for times manager addon
This commit is contained in:
parent
9d7dd0d75a
commit
221cd01ae2
1 changed files with 21 additions and 17 deletions
|
|
@ -3,8 +3,8 @@ import platform
|
||||||
|
|
||||||
|
|
||||||
from ayon_core.client import get_asset_by_name
|
from ayon_core.client import get_asset_by_name
|
||||||
from ayon_core.modules import (
|
from ayon_core.addon import (
|
||||||
OpenPypeModule,
|
AYONAddon,
|
||||||
ITrayService,
|
ITrayService,
|
||||||
IPluginPaths
|
IPluginPaths
|
||||||
)
|
)
|
||||||
|
|
@ -76,7 +76,7 @@ class ExampleTimersManagerConnector:
|
||||||
|
|
||||||
|
|
||||||
class TimersManager(
|
class TimersManager(
|
||||||
OpenPypeModule,
|
AYONAddon,
|
||||||
ITrayService,
|
ITrayService,
|
||||||
IPluginPaths
|
IPluginPaths
|
||||||
):
|
):
|
||||||
|
|
@ -99,23 +99,27 @@ class TimersManager(
|
||||||
"start_timer"
|
"start_timer"
|
||||||
)
|
)
|
||||||
|
|
||||||
def initialize(self, modules_settings):
|
def initialize(self, studio_settings):
|
||||||
timers_settings = modules_settings[self.name]
|
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)
|
auto_stop = timers_settings["auto_stop"]
|
||||||
full_time = int(timers_settings["full_time"] * 60)
|
platform_name = platform.system().lower()
|
||||||
# How many minutes before the timer is stopped will popup the message
|
# Turn of auto stop on MacOs because pynput requires root permissions
|
||||||
message_time = int(timers_settings["message_time"] * 60)
|
# and on linux can cause thread locks on application close
|
||||||
|
if full_time <= 0 or platform_name in ("darwin", "linux"):
|
||||||
auto_stop = timers_settings["auto_stop"]
|
auto_stop = False
|
||||||
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.auto_stop = auto_stop
|
||||||
self.time_show_message = full_time - message_time
|
self.time_show_message = full_time - message_time
|
||||||
self.time_stop_timer = full_time
|
self.time_stop_timer = full_time
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue