mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
implemented TrayModule interface ITrayModule
This commit is contained in:
parent
66aa85e921
commit
c1a7e36e21
1 changed files with 50 additions and 0 deletions
|
|
@ -58,3 +58,53 @@ class PypeModule:
|
|||
Environment variables that can be get only from system settings.
|
||||
"""
|
||||
return {}
|
||||
|
||||
|
||||
@six.add_metaclass(ABCMeta)
|
||||
class ITrayModule:
|
||||
"""Module has special procedures when used in Pype Tray.
|
||||
|
||||
IMPORTANT:
|
||||
The module still must be usable if is not used in tray even if
|
||||
would do nothing.
|
||||
"""
|
||||
tray_initialized = False
|
||||
|
||||
def do_tray_init(self, *args, **kwargs):
|
||||
"""Method called by Tray manager.
|
||||
|
||||
Point is to set `tray_initialized` to True after process.
|
||||
|
||||
TODO try to handle this with decorator on `tray_init`.
|
||||
"""
|
||||
self.tray_init(*args, **kwargs)
|
||||
self.tray_initialized = True
|
||||
|
||||
@abstractmethod
|
||||
def tray_init(self, tray_widget, main_window):
|
||||
"""Initialization part of tray implementation.
|
||||
|
||||
Triggered between `initialization` and `connect_with_modules`.
|
||||
|
||||
This is where GUIs should be loaded or tray specific parts should be
|
||||
prepared.
|
||||
"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def tray_menu(self, tray_menu):
|
||||
"""Add module's action to tray menu."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def tray_start(self):
|
||||
"""Start procedure in Pype tray."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def tray_exit(self):
|
||||
"""Cleanup method which is executed on tray shutdown.
|
||||
|
||||
This is place where all threads should be shut.
|
||||
"""
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue