mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
fixes after suggestions
This commit is contained in:
parent
cf8c30abcf
commit
04f7c125b0
2 changed files with 26 additions and 25 deletions
|
|
@ -92,13 +92,13 @@ def deprecated(new_destination):
|
||||||
log = Logger.get_logger(__name__)
|
log = Logger.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def flatten(_list):
|
def flatten(list_):
|
||||||
for item in _list:
|
for item_ in list_:
|
||||||
if isinstance(item, (list, tuple)):
|
if isinstance(item_, (list, tuple)):
|
||||||
for sub_item in flatten(item):
|
for sub_item in flatten(item_):
|
||||||
yield sub_item
|
yield sub_item
|
||||||
else:
|
else:
|
||||||
yield item
|
yield item_
|
||||||
|
|
||||||
|
|
||||||
def get_current_project(remove_untitled=False):
|
def get_current_project(remove_untitled=False):
|
||||||
|
|
@ -698,29 +698,29 @@ def setup(console=False, port=None, menu=True):
|
||||||
menu (bool, optional): Display file menu in Hiero.
|
menu (bool, optional): Display file menu in Hiero.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if CTX._has_been_setup:
|
if _CTX.has_been_setup:
|
||||||
teardown()
|
teardown()
|
||||||
|
|
||||||
add_submission()
|
add_submission()
|
||||||
|
|
||||||
if menu:
|
if menu:
|
||||||
add_to_filemenu()
|
add_to_filemenu()
|
||||||
CTX._has_menu = True
|
_CTX.has_menu = True
|
||||||
|
|
||||||
CTX._has_been_setup = True
|
_CTX.has_been_setup = True
|
||||||
log.debug("pyblish: Loaded successfully.")
|
log.debug("pyblish: Loaded successfully.")
|
||||||
|
|
||||||
|
|
||||||
def teardown():
|
def teardown():
|
||||||
"""Remove integration"""
|
"""Remove integration"""
|
||||||
if not CTX._has_been_setup:
|
if not _CTX.has_been_setup:
|
||||||
return
|
return
|
||||||
|
|
||||||
if CTX._has_menu:
|
if _CTX.has_menu:
|
||||||
remove_from_filemenu()
|
remove_from_filemenu()
|
||||||
CTX._has_menu = False
|
_CTX.has_menu = False
|
||||||
|
|
||||||
CTX._has_been_setup = False
|
_CTX.has_been_setup = False
|
||||||
log.debug("pyblish: Integration torn down successfully")
|
log.debug("pyblish: Integration torn down successfully")
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1311,11 +1311,11 @@ def before_project_save(event):
|
||||||
|
|
||||||
def get_main_window():
|
def get_main_window():
|
||||||
"""Acquire Nuke's main window"""
|
"""Acquire Nuke's main window"""
|
||||||
if CTX._parent_gui is None:
|
if _CTX.parent_gui is None:
|
||||||
top_widgets = QtWidgets.QApplication.topLevelWidgets()
|
top_widgets = QtWidgets.QApplication.topLevelWidgets()
|
||||||
name = "Foundry::UI::DockMainWindow"
|
name = "Foundry::UI::DockMainWindow"
|
||||||
main_window = next(widget for widget in top_widgets if
|
main_window = next(widget for widget in top_widgets if
|
||||||
widget.inherits("QMainWindow") and
|
widget.inherits("QMainWindow") and
|
||||||
widget.metaObject().className() == name)
|
widget.metaObject().className() == name)
|
||||||
CTX._parent_gui = main_window
|
_CTX.parent_gui = main_window
|
||||||
return CTX._parent_gui
|
return _CTX.parent_gui
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import ast
|
import ast
|
||||||
import opentimelineio as otio
|
import opentimelineio as otio
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
@ -23,19 +22,21 @@ MARKER_COLOR_MAP = {
|
||||||
"cyan": otio.schema.MarkerColor.CYAN,
|
"cyan": otio.schema.MarkerColor.CYAN,
|
||||||
"blue": otio.schema.MarkerColor.BLUE,
|
"blue": otio.schema.MarkerColor.BLUE,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CTX:
|
class CTX:
|
||||||
project_fps = None
|
project_fps = None
|
||||||
timeline = None
|
timeline = None
|
||||||
include_tags = True
|
include_tags = True
|
||||||
|
|
||||||
def flatten(_list):
|
|
||||||
for item in _list:
|
def flatten(list_):
|
||||||
if isinstance(item, (list, tuple)):
|
for item_ in list_:
|
||||||
for sub_item in flatten(item):
|
if isinstance(item_, (list, tuple)):
|
||||||
|
for sub_item in flatten(item_):
|
||||||
yield sub_item
|
yield sub_item
|
||||||
else:
|
else:
|
||||||
yield item
|
yield item_
|
||||||
|
|
||||||
|
|
||||||
def create_otio_rational_time(frame, fps):
|
def create_otio_rational_time(frame, fps):
|
||||||
|
|
@ -205,8 +206,8 @@ def get_marker_color(tag):
|
||||||
res = re.search(pat, icon)
|
res = re.search(pat, icon)
|
||||||
if res:
|
if res:
|
||||||
color = res.groupdict().get('color')
|
color = res.groupdict().get('color')
|
||||||
if color.lower() in CTX.marker_color_map:
|
if color.lower() in MARKER_COLOR_MAP:
|
||||||
return CTX.marker_color_map[color.lower()]
|
return MARKER_COLOR_MAP[color.lower()]
|
||||||
|
|
||||||
return otio.schema.MarkerColor.RED
|
return otio.schema.MarkerColor.RED
|
||||||
|
|
||||||
|
|
@ -339,7 +340,7 @@ def _create_otio_timeline():
|
||||||
def create_otio_track(track_type, track_name):
|
def create_otio_track(track_type, track_name):
|
||||||
return otio.schema.Track(
|
return otio.schema.Track(
|
||||||
name=track_name,
|
name=track_name,
|
||||||
kind=CTX.track_types[track_type]
|
kind=TRACK_TYPE_MAP[track_type]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue