Merge branch 'develop' into feature/direct_settings_imports

This commit is contained in:
Jakub Trllo 2022-10-04 14:39:12 +02:00
commit cb7862faa2
78 changed files with 169 additions and 209 deletions

View file

@ -1,8 +1,8 @@
# Changelog
## [3.14.3-nightly.5](https://github.com/pypeclub/OpenPype/tree/HEAD)
## [3.14.3](https://github.com/pypeclub/OpenPype/tree/3.14.3) (2022-10-03)
[Full Changelog](https://github.com/pypeclub/OpenPype/compare/3.14.2...HEAD)
[Full Changelog](https://github.com/pypeclub/OpenPype/compare/3.14.2...3.14.3)
**🚀 Enhancements**
@ -17,12 +17,12 @@
- Photoshop: synchronize image version with workfile [\#3854](https://github.com/pypeclub/OpenPype/pull/3854)
- General: Transcoding handle float2 attr type [\#3849](https://github.com/pypeclub/OpenPype/pull/3849)
- General: Simple script for getting license information about used packages [\#3843](https://github.com/pypeclub/OpenPype/pull/3843)
- Houdini: Increment current file on workfile publish [\#3840](https://github.com/pypeclub/OpenPype/pull/3840)
- General: Workfile template build enhancements [\#3838](https://github.com/pypeclub/OpenPype/pull/3838)
- General: lock task workfiles when they are working on [\#3810](https://github.com/pypeclub/OpenPype/pull/3810)
**🐛 Bug fixes**
- Maya: Fix Render single camera validator [\#3929](https://github.com/pypeclub/OpenPype/pull/3929)
- Flame: loading multilayer exr to batch/reel is working [\#3901](https://github.com/pypeclub/OpenPype/pull/3901)
- Hiero: Fix inventory check on launch [\#3895](https://github.com/pypeclub/OpenPype/pull/3895)
- WebPublisher: Fix import after refactor [\#3891](https://github.com/pypeclub/OpenPype/pull/3891)
@ -33,10 +33,10 @@
- Tray Publisher: skip plugin if otioTimeline is missing [\#3856](https://github.com/pypeclub/OpenPype/pull/3856)
- Flame: retimed attributes are integrated with settings [\#3855](https://github.com/pypeclub/OpenPype/pull/3855)
- Maya: Extract Playblast fix textures + labelize viewport show settings [\#3852](https://github.com/pypeclub/OpenPype/pull/3852)
- Maya Deadline: Fix Tile Rendering by forcing integer pixel values [\#3758](https://github.com/pypeclub/OpenPype/pull/3758)
**🔀 Refactored code**
- Maya: Remove unused 'openpype.api' imports in plugins [\#3925](https://github.com/pypeclub/OpenPype/pull/3925)
- Resolve: Use new Extractor location [\#3918](https://github.com/pypeclub/OpenPype/pull/3918)
- Unreal: Use new Extractor location [\#3917](https://github.com/pypeclub/OpenPype/pull/3917)
- Flame: Use new Extractor location [\#3916](https://github.com/pypeclub/OpenPype/pull/3916)
@ -45,7 +45,6 @@
- Hiero: Use new Extractor location [\#3851](https://github.com/pypeclub/OpenPype/pull/3851)
- Maya: Remove old legacy \(ftrack\) plug-ins that are of no use anymore [\#3819](https://github.com/pypeclub/OpenPype/pull/3819)
- Nuke: Use new Extractor location [\#3799](https://github.com/pypeclub/OpenPype/pull/3799)
- Maya: Use new Extractor location [\#3775](https://github.com/pypeclub/OpenPype/pull/3775)
**Merged pull requests:**
@ -104,18 +103,6 @@
[Full Changelog](https://github.com/pypeclub/OpenPype/compare/CI/3.14.1-nightly.4...3.14.1)
**🚀 Enhancements**
- General: Thumbnail can use project roots [\#3750](https://github.com/pypeclub/OpenPype/pull/3750)
**🐛 Bug fixes**
- Maya: Fix typo in getPanel argument `with\_focus` -\> `withFocus` [\#3753](https://github.com/pypeclub/OpenPype/pull/3753)
**🔀 Refactored code**
- General: Move delivery logic to pipeline [\#3751](https://github.com/pypeclub/OpenPype/pull/3751)
## [3.14.0](https://github.com/pypeclub/OpenPype/tree/3.14.0) (2022-08-18)
[Full Changelog](https://github.com/pypeclub/OpenPype/compare/CI/3.14.0-nightly.1...3.14.0)

View file

@ -1,7 +1,6 @@
import os
import logging
import platform
import six
from openpype.settings import get_project_settings
@ -9,16 +8,10 @@ import hou
log = logging.getLogger("openpype.hosts.houdini.shelves")
if six.PY2:
FileNotFoundError = IOError
def generate_shelves():
"""This function generates complete shelves from shelf set to tools
in Houdini from openpype project settings houdini shelf definition.
Raises:
FileNotFoundError: Raised when the shelf set filepath does not exist
"""
current_os = platform.system().lower()
@ -27,51 +20,41 @@ def generate_shelves():
shelves_set_config = project_settings["houdini"]["shelves"]
if not shelves_set_config:
log.debug(
"No custom shelves found in project settings."
)
log.debug("No custom shelves found in project settings.")
return
for shelf_set_config in shelves_set_config:
shelf_set_filepath = shelf_set_config.get('shelf_set_source_path')
shelf_set_os_filepath = shelf_set_filepath[current_os]
if shelf_set_os_filepath:
if not os.path.isfile(shelf_set_os_filepath):
log.error("Shelf path doesn't exist - "
"{}".format(shelf_set_os_filepath))
continue
if shelf_set_filepath[current_os]:
if not os.path.isfile(shelf_set_filepath[current_os]):
raise FileNotFoundError(
"This path doesn't exist - {}".format(
shelf_set_filepath[current_os]
)
)
hou.shelves.newShelfSet(file_path=shelf_set_filepath[current_os])
hou.shelves.newShelfSet(file_path=shelf_set_os_filepath)
continue
shelf_set_name = shelf_set_config.get('shelf_set_name')
if not shelf_set_name:
log.warning(
"No name found in shelf set definition."
)
return
shelf_set = get_or_create_shelf_set(shelf_set_name)
log.warning("No name found in shelf set definition.")
continue
shelves_definition = shelf_set_config.get('shelf_definition')
if not shelves_definition:
log.debug(
"No shelf definition found for shelf set named '{}'".format(
shelf_set_name
)
)
return
continue
shelf_set = get_or_create_shelf_set(shelf_set_name)
for shelf_definition in shelves_definition:
shelf_name = shelf_definition.get('shelf_name')
if not shelf_name:
log.warning(
"No name found in shelf definition."
)
return
log.warning("No name found in shelf definition.")
continue
shelf = get_or_create_shelf(shelf_name)
@ -81,7 +64,7 @@ def generate_shelves():
shelf_name
)
)
return
continue
mandatory_attributes = {'name', 'script'}
for tool_definition in shelf_definition.get('tools_list'):
@ -91,14 +74,14 @@ def generate_shelves():
tool_definition[key] for key in mandatory_attributes
):
log.warning(
"You need to specify at least the name and \
the script path of the tool.")
"You need to specify at least the name and the "
"script path of the tool.")
continue
tool = get_or_create_tool(tool_definition, shelf)
if not tool:
return
continue
# Add the tool to the shelf if not already in it
if tool not in shelf.tools():
@ -121,12 +104,10 @@ def get_or_create_shelf_set(shelf_set_label):
"""
all_shelves_sets = hou.shelves.shelfSets().values()
shelf_sets = [
shelf for shelf in all_shelves_sets if shelf.label() == shelf_set_label
]
if shelf_sets:
return shelf_sets[0]
shelf_set = next((shelf for shelf in all_shelves_sets if
shelf.label() == shelf_set_label), None)
if shelf_set:
return shelf_set
shelf_set_name = shelf_set_label.replace(' ', '_').lower()
new_shelf_set = hou.shelves.newShelfSet(
@ -148,10 +129,9 @@ def get_or_create_shelf(shelf_label):
"""
all_shelves = hou.shelves.shelves().values()
shelf = [s for s in all_shelves if s.label() == shelf_label]
shelf = next((s for s in all_shelves if s.label() == shelf_label), None)
if shelf:
return shelf[0]
return shelf
shelf_name = shelf_label.replace(' ', '_').lower()
new_shelf = hou.shelves.newShelf(
@ -175,23 +155,21 @@ def get_or_create_tool(tool_definition, shelf):
existing_tools = shelf.tools()
tool_label = tool_definition.get('label')
existing_tool = [
tool for tool in existing_tools if tool.label() == tool_label
]
existing_tool = next(
(tool for tool in existing_tools if tool.label() == tool_label),
None
)
if existing_tool:
tool_definition.pop('name', None)
tool_definition.pop('label', None)
existing_tool[0].setData(**tool_definition)
return existing_tool[0]
existing_tool.setData(**tool_definition)
return existing_tool
tool_name = tool_label.replace(' ', '_').lower()
if not os.path.exists(tool_definition['script']):
log.warning(
"This path doesn't exist - {}".format(
tool_definition['script']
)
"This path doesn't exist - {}".format(tool_definition['script'])
)
return

View file

@ -1,5 +1,4 @@
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,7 +1,6 @@
import maya.cmds as cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import (

View file

@ -1,5 +1,4 @@
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action

View file

@ -1,5 +1,4 @@
import pyblish.api
import openpype.api
from maya import cmds

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
RepairAction,

View file

@ -2,7 +2,6 @@ from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api.lib import maintained_selection
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,5 +1,4 @@
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,5 +1,4 @@
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -2,7 +2,6 @@ from collections import defaultdict
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
RepairAction,

View file

@ -1,7 +1,6 @@
from collections import defaultdict
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidatePipelineOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,5 +1,4 @@
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
RepairAction,

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,7 +1,6 @@
import pymel.core as pc
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api.lib import maintained_selection
from openpype.pipeline.publish import (

View file

@ -3,7 +3,6 @@ import re
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateMeshOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateMeshOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateMeshOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateMeshOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import ValidateMeshOrder

View file

@ -2,7 +2,6 @@ from maya import cmds
import maya.api.OpenMaya as om2
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
RepairAction,

View file

@ -1,5 +1,4 @@
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
import math
import maya.api.OpenMaya as om

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
RepairAction,

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import (

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
RepairAction,

View file

@ -3,7 +3,6 @@ import re
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
RepairAction,

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -5,7 +5,6 @@ import re
from maya import cmds
import pyblish.api
import openpype.api
from openpype.pipeline import legacy_io
from openpype.pipeline.publish import ValidateContentsOrder
import openpype.hosts.maya.api.action

View file

@ -1,6 +1,5 @@
import os
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -2,7 +2,6 @@ import pymel.core as pm
import maya.cmds as cmds
import pyblish.api
import openpype.api
from openpype.pipeline.publish import (
RepairAction,
ValidateContentsOrder,

View file

@ -1,7 +1,6 @@
import maya.cmds as cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
RepairAction,

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,5 +1,5 @@
import pyblish.api
import openpype.api
from openpype.pipeline.publish import ValidatePipelineOrder
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import (

View file

@ -1,6 +1,5 @@
import pyblish.api
import openpype.api
from openpype.client import get_assets
from openpype.pipeline import legacy_io
from openpype.pipeline.publish import ValidatePipelineOrder

View file

@ -1,5 +1,4 @@
import pyblish.api
import openpype.api
from openpype.pipeline.publish import ValidatePipelineOrder
import openpype.hosts.maya.api.action

View file

@ -1,7 +1,6 @@
from collections import defaultdict
import pyblish.api
import openpype.api
from openpype.pipeline.publish import ValidatePipelineOrder
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib

View file

@ -1,7 +1,7 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,7 +1,7 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -3,9 +3,8 @@ import re
import pyblish.api
from maya import cmds
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api.render_settings import RenderSettings
from openpype.hosts.maya.api.lib_rendersettings import RenderSettings
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,7 +1,6 @@
from maya import cmds
import pyblish.api
import openpype.api
from openpype.pipeline.publish import (
ValidateContentsOrder,

View file

@ -1,7 +1,7 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import (

View file

@ -1,7 +1,7 @@
import maya.cmds as cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import (

View file

@ -2,7 +2,6 @@ import pymel.core as pc
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
RepairAction,

View file

@ -2,7 +2,7 @@ import re
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -3,7 +3,7 @@ import re
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import (
ValidateContentsOrder,

View file

@ -1,5 +1,4 @@
import pyblish.api
import openpype.api
from maya import cmds

View file

@ -1,7 +1,7 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.hosts.maya.api import lib
from openpype.pipeline.publish import (

View file

@ -1,7 +1,7 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,5 +1,5 @@
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -3,7 +3,7 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,7 +1,7 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -2,8 +2,9 @@
from maya import cmds
import pyblish.api
import openpype.api
from openpype.pipeline.publish import ValidateMeshOrder
import openpype.hosts.maya.api.action
class ValidateUnrealMeshTriangulated(pyblish.api.InstancePlugin):

View file

@ -3,7 +3,7 @@
import re
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline import legacy_io
from openpype.settings import get_project_settings

View file

@ -1,6 +1,5 @@
import pyblish.api
import openpype.api
from openpype.hosts.maya.api.lib import iter_visible_nodes_in_range
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,5 +1,4 @@
import pyblish.api
import openpype.api
from maya import cmds

View file

@ -1,7 +1,7 @@
from maya import cmds
import pyblish.api
import openpype.api
import openpype.hosts.maya.api.action
from openpype.pipeline.publish import ValidateContentsOrder

View file

@ -1,15 +1,5 @@
{
"shelves": [
{
"shelf_set_name": "OpenPype Shelves",
"shelf_set_source_path": {
"windows": "",
"darwin": "",
"linux": ""
},
"shelf_definition": []
}
],
"shelves": [],
"create": {
"CreateArnoldAss": {
"enabled": true,

View file

@ -1,4 +1,5 @@
import os
import copy
import json
import collections
import six
@ -19,6 +20,9 @@ class _Cache:
disabled_entity_icon_color = None
deprecated_entity_font_color = None
colors_data = None
objected_colors = None
def get_style_image_path(image_name):
# All filenames are lowered
@ -46,8 +50,11 @@ def _get_colors_raw_data():
def get_colors_data():
"""Only color data from stylesheet data."""
data = _get_colors_raw_data()
return data.get("color") or {}
if _Cache.colors_data is None:
data = _get_colors_raw_data()
color_data = data.get("color") or {}
_Cache.colors_data = color_data
return copy.deepcopy(_Cache.colors_data)
def _convert_color_values_to_objects(value):
@ -75,17 +82,38 @@ def _convert_color_values_to_objects(value):
return parse_color(value)
def get_objected_colors():
def get_objected_colors(*keys):
"""Colors parsed from stylesheet data into color definitions.
You can pass multiple arguments to get a key from the data dict's colors.
Because this functions returns a deep copy of the cached data this allows
a much smaller dataset to be copied and thus result in a faster function.
It is however a micro-optimization in the area of 0.001s and smaller.
For example:
>>> get_colors_data() # copy of full colors dict
>>> get_colors_data("font")
>>> get_colors_data("loader", "asset-view")
Args:
*keys: Each key argument will return a key nested deeper in the
objected colors data.
Returns:
dict: Parsed color objects by keys in data.
Any: Parsed color objects by keys in data.
"""
colors_data = get_colors_data()
output = {}
for key, value in colors_data.items():
output[key] = _convert_color_values_to_objects(value)
return output
if _Cache.objected_colors is None:
colors_data = get_colors_data()
output = {}
for key, value in colors_data.items():
output[key] = _convert_color_values_to_objects(value)
_Cache.objected_colors = output
output = _Cache.objected_colors
for key in keys:
output = output[key]
return copy.deepcopy(output)
def _load_stylesheet():

View file

@ -158,8 +158,7 @@ class BorderedLabelWidget(QtWidgets.QFrame):
"""
def __init__(self, label, parent):
super(BorderedLabelWidget, self).__init__(parent)
colors_data = get_objected_colors()
color_value = colors_data.get("border")
color_value = get_objected_colors("border")
color = None
if color_value:
color = color_value.get_qcolor()

View file

@ -54,8 +54,7 @@ class ListItemDelegate(QtWidgets.QStyledItemDelegate):
def __init__(self, parent):
super(ListItemDelegate, self).__init__(parent)
colors_data = get_objected_colors()
group_color_info = colors_data["publisher"]["list-view-group"]
group_color_info = get_objected_colors("publisher", "list-view-group")
self._group_colors = {
key: value.get_qcolor()

View file

@ -323,7 +323,7 @@ class SettingsToolBtn(ImageButton):
@classmethod
def _get_icon_type(cls, btn_type):
if btn_type not in cls._cached_icons:
settings_colors = get_objected_colors()["settings"]
settings_colors = get_objected_colors("settings")
normal_color = settings_colors["image-btn"].get_qcolor()
hover_color = settings_colors["image-btn-hover"].get_qcolor()
disabled_color = settings_colors["image-btn-disabled"].get_qcolor()
@ -789,8 +789,7 @@ class ProjectModel(QtGui.QStandardItemModel):
self._items_by_name = {}
self._versions_by_project = {}
colors = get_objected_colors()
font_color = colors["font"].get_qcolor()
font_color = get_objected_colors("font").get_qcolor()
font_color.setAlpha(67)
self._version_font_color = font_color
self._current_version = get_openpype_version()

View file

@ -144,8 +144,7 @@ class VersionUpdateDialog(QtWidgets.QDialog):
"gifts.png"
)
src_image = QtGui.QImage(image_path)
colors = style.get_objected_colors()
color_value = colors["font"]
color_value = style.get_objected_colors("font")
return paint_image_with_color(
src_image,

View file

@ -114,7 +114,7 @@ class UnderlinesAssetDelegate(QtWidgets.QItemDelegate):
def __init__(self, *args, **kwargs):
super(UnderlinesAssetDelegate, self).__init__(*args, **kwargs)
asset_view_colors = get_objected_colors()["loader"]["asset-view"]
asset_view_colors = get_objected_colors("loader", "asset-view")
self._selected_color = (
asset_view_colors["selected"].get_qcolor()
)

View file

@ -819,8 +819,6 @@ def get_warning_pixmap(color=None):
src_image_path = get_image_path("warning.png")
src_image = QtGui.QImage(src_image_path)
if color is None:
colors = get_objected_colors()
color_value = colors["delete-btn-bg"]
color = color_value.get_qcolor()
color = get_objected_colors("delete-btn-bg").get_qcolor()
return paint_image_with_color(src_image, color)

View file

@ -14,8 +14,7 @@ class CloseButton(QtWidgets.QFrame):
def __init__(self, parent):
super(CloseButton, self).__init__(parent)
colors = get_objected_colors()
close_btn_color = colors["overlay-messages"]["close-btn"]
close_btn_color = get_objected_colors("overlay-messages", "close-btn")
self._color = close_btn_color.get_qcolor()
self._mouse_pressed = False
policy = QtWidgets.QSizePolicy(

View file

@ -40,7 +40,7 @@ class PlaceholderLineEdit(QtWidgets.QLineEdit):
# Change placeholder palette color
if hasattr(QtGui.QPalette, "PlaceholderText"):
filter_palette = self.palette()
color_obj = get_objected_colors()["font"]
color_obj = get_objected_colors("font")
color = color_obj.get_qcolor()
color.setAlpha(67)
filter_palette.setColor(

View file

@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
"""Package declaring Pype version."""
__version__ = "3.14.3-nightly.5"
__version__ = "3.14.3"

View file

@ -138,11 +138,13 @@ class DropEmpty(QtWidgets.QWidget):
allowed_items = [item + "s" for item in allowed_items]
if not allowed_items:
self._drop_label_widget.setVisible(False)
self._items_label_widget.setText(
"It is not allowed to add anything here!"
)
return
self._drop_label_widget.setVisible(True)
items_label = "Multiple "
if self._single_item:
items_label = "Single "
@ -235,10 +237,41 @@ class FilesModel(QtGui.QStandardItemModel):
self._filenames_by_dirpath = collections.defaultdict(set)
self._items_by_dirpath = collections.defaultdict(list)
self.rowsAboutToBeRemoved.connect(self._on_about_to_be_removed)
self.rowsInserted.connect(self._on_insert)
@property
def id(self):
return self._id
def _on_about_to_be_removed(self, parent_index, start, end):
"""Make sure that removed items are removed from items mapping.
Connected with '_on_insert'. When user drag item and drop it to same
view the item is actually removed and creted again but it happens in
inner calls of Qt.
"""
for row in range(start, end + 1):
index = self.index(row, 0, parent_index)
item_id = index.data(ITEM_ID_ROLE)
if item_id is not None:
self._items_by_id.pop(item_id, None)
def _on_insert(self, parent_index, start, end):
"""Make sure new added items are stored in items mapping.
Connected to '_on_about_to_be_removed'. Some items are not created
using '_create_item' but are recreated using Qt. So the item is not in
mapping and if it would it would not lead to same item pointer.
"""
for row in range(start, end + 1):
index = self.index(start, end, parent_index)
item_id = index.data(ITEM_ID_ROLE)
if item_id not in self._items_by_id:
self._items_by_id[item_id] = self.item(row)
def set_multivalue(self, multivalue):
"""Disable filtering."""
@ -352,6 +385,10 @@ class FilesModel(QtGui.QStandardItemModel):
src_item_id = index.data(ITEM_ID_ROLE)
src_item = self._items_by_id.get(src_item_id)
src_row = None
if src_item:
src_row = src_item.row()
# Take out items that should be moved
items = []
for item_id in item_ids:
@ -365,10 +402,12 @@ class FilesModel(QtGui.QStandardItemModel):
return False
# Calculate row where items should be inserted
if src_item:
src_row = src_item.row()
else:
src_row = root.rowCount()
row_count = root.rowCount()
if src_row is None:
src_row = row_count
if src_row > row_count:
src_row = row_count
root.insertRow(src_row, items)
return True
@ -592,6 +631,13 @@ class FilesView(QtWidgets.QListView):
self._remove_btn.setVisible(not multivalue)
def update_remove_btn_visibility(self):
model = self.model()
visible = False
if model:
visible = model.rowCount() > 0
self._remove_btn.setVisible(visible)
def has_selected_item_ids(self):
"""Is any index selected."""
for index in self.selectionModel().selectedIndexes():
@ -655,6 +701,7 @@ class FilesView(QtWidgets.QListView):
def showEvent(self, event):
super(FilesView, self).showEvent(event)
self._update_remove_btn()
self.update_remove_btn_visibility()
class FilesWidget(QtWidgets.QFrame):
@ -673,12 +720,13 @@ class FilesWidget(QtWidgets.QFrame):
files_proxy_model.setSourceModel(files_model)
files_view = FilesView(self)
files_view.setModel(files_proxy_model)
files_view.setVisible(False)
layout = QtWidgets.QHBoxLayout(self)
layout = QtWidgets.QStackedLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(empty_widget, 1)
layout.addWidget(files_view, 1)
layout.setStackingMode(layout.StackAll)
layout.addWidget(empty_widget)
layout.addWidget(files_view)
layout.setCurrentWidget(empty_widget)
files_proxy_model.rowsInserted.connect(self._on_rows_inserted)
files_proxy_model.rowsRemoved.connect(self._on_rows_removed)
@ -698,6 +746,8 @@ class FilesWidget(QtWidgets.QFrame):
self._widgets_by_id = {}
self._layout = layout
def _set_multivalue(self, multivalue):
if self._multivalue == multivalue:
return
@ -774,6 +824,8 @@ class FilesWidget(QtWidgets.QFrame):
if not self._in_set_value:
self.value_changed.emit()
self._update_visibility()
def _on_rows_removed(self, parent_index, start_row, end_row):
available_item_ids = set()
for row in range(self._files_proxy_model.rowCount()):
@ -793,6 +845,7 @@ class FilesWidget(QtWidgets.QFrame):
if not self._in_set_value:
self.value_changed.emit()
self._update_visibility()
def _on_split_request(self):
if self._multivalue:
@ -836,29 +889,6 @@ class FilesWidget(QtWidgets.QFrame):
menu.popup(pos)
def sizeHint(self):
# Get size hints of widget and visible widgets
result = super(FilesWidget, self).sizeHint()
if not self._files_view.isVisible():
not_visible_hint = self._files_view.sizeHint()
else:
not_visible_hint = self._empty_widget.sizeHint()
# Get margins of this widget
margins = self.layout().contentsMargins()
# Change size hint based on result of maximum size hint of widgets
result.setWidth(max(
result.width(),
not_visible_hint.width() + margins.left() + margins.right()
))
result.setHeight(max(
result.height(),
not_visible_hint.height() + margins.top() + margins.bottom()
))
return result
def dragEnterEvent(self, event):
if self._multivalue:
return
@ -890,7 +920,6 @@ class FilesWidget(QtWidgets.QFrame):
mime_data = event.mimeData()
if mime_data.hasUrls():
event.accept()
# event.setDropAction(QtCore.Qt.CopyAction)
filepaths = []
for url in mime_data.urls():
filepath = url.toLocalFile()
@ -956,13 +985,15 @@ class FilesWidget(QtWidgets.QFrame):
def _add_filepaths(self, filepaths):
self._files_model.add_filepaths(filepaths)
self._update_visibility()
def _remove_item_by_ids(self, item_ids):
self._files_model.remove_item_by_ids(item_ids)
self._update_visibility()
def _update_visibility(self):
files_exists = self._files_proxy_model.rowCount() > 0
self._files_view.setVisible(files_exists)
self._empty_widget.setVisible(not files_exists)
if files_exists:
current_widget = self._files_view
else:
current_widget = self._empty_widget
self._layout.setCurrentWidget(current_widget)
self._files_view.update_remove_btn_visibility()

View file

@ -66,8 +66,7 @@ class NiceCheckbox(QtWidgets.QFrame):
if cls._checked_bg_color is not None:
return
colors_data = get_objected_colors()
colors_info = colors_data["nice-checkbox"]
colors_info = get_objected_colors("nice-checkbox")
cls._checked_bg_color = colors_info["bg-checked"].get_qcolor()
cls._unchecked_bg_color = colors_info["bg-unchecked"].get_qcolor()

View file

@ -10,7 +10,7 @@ import glob
import platform
from tests.lib.db_handler import DBHandler
from distribution.file_handler import RemoteFileHandler
from common.openpype_common.distribution.file_handler import RemoteFileHandler
class BaseTest: