diff --git a/pype/hooks/pre_python2_vendor.py b/pype/hooks/pre_python2_vendor.py index 070e671db0..6f34e44132 100644 --- a/pype/hooks/pre_python2_vendor.py +++ b/pype/hooks/pre_python2_vendor.py @@ -6,7 +6,7 @@ class PrePython2Vendor(PreLaunchHook): """Prepend python 2 dependencies for py2 hosts.""" # WARNING This hook will probably be deprecated in Pype 3 - kept for test order = 10 - app_groups = ["hiero", "nuke"] + app_groups = ["hiero", "nuke", "nukex"] def execute(self): # Prepare vendor dir path diff --git a/pype/lib/applications.py b/pype/lib/applications.py index 0b1f45f2f1..abaecf1e9c 100644 --- a/pype/lib/applications.py +++ b/pype/lib/applications.py @@ -210,32 +210,16 @@ class ApplicationTool: class ApplicationExecutable: def __init__(self, executable): - default_launch_args = [] - executable_path = None - if isinstance(executable, str): - executable_path = executable - - elif isinstance(executable, list): - for arg in executable: - if arg: - if executable_path is None: - executable_path = arg - else: - default_launch_args.append(arg) - - self.executable_path = executable_path - self.default_launch_args = default_launch_args - - def __iter__(self): - yield self._realpath() - for arg in self.default_launch_args: - yield arg + self.executable_path = executable def __str__(self): return self.executable_path + def __repr__(self): + return "<{}> {}".format(self.__class__.__name__, self.executable_path) + def as_args(self): - return list(self) + return [self.executable_path] def _realpath(self): """Check if path is valid executable path.""" @@ -293,11 +277,19 @@ class Application: elif isinstance(_executables, dict): _executables = _executables.get(platform.system().lower()) or [] + _arguments = app_data["arguments"] + if not _arguments: + _arguments = [] + + elif isinstance(_arguments, dict): + _arguments = _arguments.get(platform.system().lower()) or [] + executables = [] for executable in _executables: executables.append(ApplicationExecutable(executable)) self.executables = executables + self.arguments = _arguments @property def full_label(self): @@ -503,6 +495,7 @@ class ApplicationLaunchContext: # subprocess.Popen launch arguments (first argument in constructor) self.launch_args = executable.as_args() + self.launch_args.extend(application.arguments) # Handle launch environemtns env = self.data.pop("env", None) diff --git a/pype/settings/defaults/system_settings/applications.json b/pype/settings/defaults/system_settings/applications.json index b78d23f6ff..4a13cf78f6 100644 --- a/pype/settings/defaults/system_settings/applications.json +++ b/pype/settings/defaults/system_settings/applications.json @@ -37,19 +37,18 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Autodesk\\Maya2020\\bin\\maya.exe", - "" - ] + "C:\\Program Files\\Autodesk\\Maya2020\\bin\\maya.exe" ], "darwin": [], "linux": [ - [ - "/usr/autodesk/maya2020/bin/maya", - "" - ] + "/usr/autodesk/maya2020/bin/maya" ] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "MAYA_VERSION": "2020", "__environment_keys__": { @@ -66,19 +65,18 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Autodesk\\Maya2019\\bin\\maya.exe", - "" - ] + "C:\\Program Files\\Autodesk\\Maya2019\\bin\\maya.exe" ], "darwin": [], "linux": [ - [ - "/usr/autodesk/maya2019/bin/maya", - "" - ] + "/usr/autodesk/maya2019/bin/maya" ] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "MAYA_VERSION": "2019", "__environment_keys__": { @@ -95,19 +93,18 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Autodesk\\Maya2017\\bin\\maya.exe", - "" - ] + "C:\\Program Files\\Autodesk\\Maya2018\\bin\\maya.exe" ], "darwin": [], "linux": [ - [ - "/usr/autodesk/maya2018/bin/maya", - "" - ] + "/usr/autodesk/maya2018/bin/maya" ] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "MAYA_VERSION": "2018", "__environment_keys__": { @@ -159,14 +156,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Autodesk\\Maya2020\\bin\\mayabatch.exe", - "" - ] + "C:\\Program Files\\Autodesk\\Maya2020\\bin\\mayabatch.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "MAYA_VERSION": "2020", "__environment_keys__": { @@ -183,14 +182,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Autodesk\\Maya2019\\bin\\mayabatch.exe", - "" - ] + "C:\\Program Files\\Autodesk\\Maya2019\\bin\\mayabatch.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "MAYA_VERSION": "2019", "__environment_keys__": { @@ -207,14 +208,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Autodesk\\Maya2018\\bin\\mayabatch.exe", - "" - ] + "C:\\Program Files\\Autodesk\\Maya2018\\bin\\mayabatch.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "MAYA_VERSION": "2018", "__environment_keys__": { @@ -257,19 +260,18 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe", - "" - ] + "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke12.2v3Nuke12.2", - "" - ] + "/usr/local/Nuke12.2v3Nuke12.2" ] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "nuke_12.2": [] @@ -283,19 +285,18 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe", - "" - ] + "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke12.0v1/Nuke12.0", - "" - ] + "/usr/local/Nuke12.0v1/Nuke12.0" ] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "nuke_12.0": [] @@ -309,19 +310,18 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe", - "" - ] + "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke11.3v5/Nuke11.3", - "" - ] + "/usr/local/Nuke11.3v5/Nuke11.3" ] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "nuke_11.3": [] @@ -335,14 +335,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe", - "" - ] + "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "nuke_11.2": [] @@ -382,17 +384,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe", - "--nukex" - ] + "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke12.2v3Nuke12.2", - "--nukex" - ] + "/usr/local/Nuke12.2v3Nuke12.2" + ] + }, + "arguments": { + "windows": [ + "--nukex" + ], + "darwin": [ + "--nukex" + ], + "linux": [ + "--nukex" ] }, "environment": { @@ -408,17 +415,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe", - "--nukex" - ] + "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke12.0v1/Nuke12.0", - "--nukex" - ] + "/usr/local/Nuke12.0v1/Nuke12.0" + ] + }, + "arguments": { + "windows": [ + "--nukex" + ], + "darwin": [ + "--nukex" + ], + "linux": [ + "--nukex" ] }, "environment": { @@ -434,17 +446,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe", - "--nukex" - ] + "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke11.3v5/Nuke11.3", - "--nukex" - ] + "/usr/local/Nuke11.3v5/Nuke11.3" + ] + }, + "arguments": { + "windows": [ + "--nukex" + ], + "darwin": [ + "--nukex" + ], + "linux": [ + "--nukex" ] }, "environment": { @@ -460,14 +477,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe", - "--nukex" - ] + "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [ + "--nukex" + ], + "darwin": [ + "--nukex" + ], + "linux": [ + "--nukex" + ] + }, "environment": { "__environment_keys__": { "nukex_11.2": [] @@ -509,17 +534,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe", - "--studio" - ] + "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke12.2v3Nuke12.2", - "--studio" - ] + "/usr/local/Nuke12.2v3Nuke12.2" + ] + }, + "arguments": { + "windows": [ + "--studio" + ], + "darwin": [ + "--studio" + ], + "linux": [ + "--studio" ] }, "environment": { @@ -535,17 +565,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe", - "--studio" - ] + "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke12.0v1/Nuke12.0", - "--studio" - ] + "/usr/local/Nuke12.0v1/Nuke12.0" + ] + }, + "arguments": { + "windows": [ + "--studio" + ], + "darwin": [ + "--studio" + ], + "linux": [ + "--studio" ] }, "environment": { @@ -561,17 +596,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe", - "--studio" - ] + "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke11.3v5/Nuke11.3", - "--studio" - ] + "/usr/local/Nuke11.3v5/Nuke11.3" + ] + }, + "arguments": { + "windows": [ + "--studio" + ], + "darwin": [ + "--studio" + ], + "linux": [ + "--studio" ] }, "environment": { @@ -590,6 +630,17 @@ "darwin": [], "linux": [] }, + "arguments": { + "windows": [ + "--studio" + ], + "darwin": [ + "--studio" + ], + "linux": [ + "--studio" + ] + }, "environment": { "__environment_keys__": { "nukestudio_11.2": [] @@ -631,17 +682,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe", - "--hiero" - ] + "C:\\Program Files\\Nuke12.2v3\\Nuke12.2.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke12.2v3Nuke12.2", - "--hiero" - ] + "/usr/local/Nuke12.2v3Nuke12.2" + ] + }, + "arguments": { + "windows": [ + "--hiero" + ], + "darwin": [ + "--hiero" + ], + "linux": [ + "--hiero" ] }, "environment": { @@ -657,17 +713,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe", - "--hiero" - ] + "C:\\Program Files\\Nuke12.0v1\\Nuke12.0.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke12.0v1/Nuke12.0", - "--hiero" - ] + "/usr/local/Nuke12.0v1/Nuke12.0" + ] + }, + "arguments": { + "windows": [ + "--hiero" + ], + "darwin": [ + "--hiero" + ], + "linux": [ + "--hiero" ] }, "environment": { @@ -683,17 +744,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe", - "--hiero" - ] + "C:\\Program Files\\Nuke11.3v1\\Nuke11.3.exe" ], "darwin": [], "linux": [ - [ - "/usr/local/Nuke11.3v5/Nuke11.3", - "--hiero" - ] + "/usr/local/Nuke11.3v5/Nuke11.3" + ] + }, + "arguments": { + "windows": [ + "--hiero" + ], + "darwin": [ + "--hiero" + ], + "linux": [ + "--hiero" ] }, "environment": { @@ -709,14 +775,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe", - "--hiero" - ] + "C:\\Program Files\\Nuke11.2v2\\Nuke11.2.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [ + "--hiero" + ], + "darwin": [ + "--hiero" + ], + "linux": [ + "--hiero" + ] + }, "environment": { "__environment_keys__": { "hiero_11.2": [] @@ -775,6 +849,11 @@ "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "fusion_16": [] @@ -788,14 +867,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Blackmagic Design\\Fusion 9\\Fusion.exe", - "" - ] + "C:\\Program Files\\Blackmagic Design\\Fusion 9\\Fusion.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "fusion_9": [] @@ -869,14 +950,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:/Program Files/Blackmagic Design/DaVinci Resolve/Resolve.exe", - "" - ] + "C:/Program Files/Blackmagic Design/DaVinci Resolve/Resolve.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "resolve_16": [] @@ -919,6 +1002,11 @@ "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "houdini_18": [] @@ -935,6 +1023,11 @@ "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "houdini_17": [] @@ -971,14 +1064,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Blender Foundation\\Blender 2.90\\blender.exe", - "--python-use-system-env" - ] + "C:\\Program Files\\Blender Foundation\\Blender 2.90\\blender.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [ + "--python-use-system-env" + ], + "darwin": [ + "--python-use-system-env" + ], + "linux": [ + "--python-use-system-env" + ] + }, "environment": { "__environment_keys__": { "blender_2.90": [] @@ -992,14 +1093,22 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Blender Foundation\\Blender 2.83\\blender.exe", - "--python-use-system-env" - ] + "C:\\Program Files\\Blender Foundation\\Blender 2.83\\blender.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [ + "--python-use-system-env" + ], + "darwin": [ + "--python-use-system-env" + ], + "linux": [ + "--python-use-system-env" + ] + }, "environment": { "__environment_keys__": { "blender_2.83": [] @@ -1034,6 +1143,11 @@ "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "harmony_20": [] @@ -1048,13 +1162,15 @@ "executables": { "windows": [], "darwin": [ - [ - "/Applications/Toon Boom Harmony 17 Premium/Harmony Premium.app/Contents/MacOS/Harmony Premium", - "" - ] + "/Applications/Toon Boom Harmony 17 Premium/Harmony Premium.app/Contents/MacOS/Harmony Premium" ], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "harmony_17": [] @@ -1084,18 +1200,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\TVPaint Developpement\\TVPaint Animation 11 (64bits)\\TVPaint Animation 11 (64bits).exe", - "" - ], - [ - "C:\\Program Files\\TVPaint Developpement\\TVPaint Animation 11 Pro (64bits) (DEMO)\\TVPaint Animation 11 Pro (64bits) (DEMO).exe", - "" - ] + "C:\\Program Files\\TVPaint Developpement\\TVPaint Animation 11 (64bits)\\TVPaint Animation 11 (64bits).exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "tvpaint_Animation 11 (64bits)": [] @@ -1109,14 +1223,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files (x86)\\TVPaint Developpement\\TVPaint Animation 11 (32bits)\\TVPaint Animation 11 (32bits).exe", - "" - ] + "C:\\Program Files (x86)\\TVPaint Developpement\\TVPaint Animation 11 (32bits)\\TVPaint Animation 11 (32bits).exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "tvpaint_Animation 11 (32bits)": [] @@ -1152,14 +1268,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Adobe\\Adobe Photoshop 2020\\Photoshop.exe", - "" - ] + "C:\\Program Files\\Adobe\\Adobe Photoshop 2020\\Photoshop.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "photoshop_2020": [] @@ -1173,14 +1291,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Adobe\\Adobe Photoshop 2021\\Photoshop.exe", - "" - ] + "C:\\Program Files\\Adobe\\Adobe Photoshop 2021\\Photoshop.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "photoshop_2021": [] @@ -1216,14 +1336,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Adobe\\Adobe After Effects 2020\\Support Files\\AfterFX.exe", - "" - ] + "" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "aftereffects_2020": [] @@ -1237,14 +1359,16 @@ "icon": "", "executables": { "windows": [ - [ - "C:\\Program Files\\Adobe\\Adobe After Effects 2021\\Support Files\\AfterFX.exe", - "" - ] + "C:\\Program Files\\Adobe\\Adobe After Effects 2021\\Support Files\\AfterFX.exe" ], "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "aftereffects_2021": [] @@ -1272,10 +1396,12 @@ "label": "", "variant_label": "Local", "icon": "{}/app_icons/celaction_local.png", - "executables": [ - "", - "" - ], + "executables": "", + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "celation_Local": [] @@ -1287,10 +1413,12 @@ "label": "", "variant_label": "Pulblish", "icon": "", - "executables": [ - "", - "" - ], + "executables": "", + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "celation_Publish": [] @@ -1327,6 +1455,11 @@ "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "unreal_4.24": [] @@ -1353,6 +1486,11 @@ "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "python_Python 3.7": [] @@ -1369,6 +1507,11 @@ "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "python_Python 2.7": [] @@ -1385,6 +1528,11 @@ "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "terminal_Terminal": [] @@ -1414,6 +1562,11 @@ "darwin": [], "linux": [] }, + "arguments": { + "windows": [], + "darwin": [], + "linux": [] + }, "environment": { "__environment_keys__": { "djvview_1.1": [] @@ -1422,4 +1575,4 @@ } } } -} \ No newline at end of file +} diff --git a/pype/settings/entities/input_entities.py b/pype/settings/entities/input_entities.py index 1e781ae951..2ed397dad9 100644 --- a/pype/settings/entities/input_entities.py +++ b/pype/settings/entities/input_entities.py @@ -374,13 +374,8 @@ class PathInput(InputEntity): schema_types = ["path-input"] def _item_initalization(self): - self.with_arguments = self.schema_data.get("with_arguments", False) - if self.with_arguments: - self.valid_value_types = (list, ) - self.value_on_not_set = ["", ""] - else: - self.valid_value_types = (STRING_TYPE, ) - self.value_on_not_set = "" + self.valid_value_types = (STRING_TYPE, ) + self.value_on_not_set = "" class RawJsonEntity(InputEntity): @@ -388,13 +383,30 @@ class RawJsonEntity(InputEntity): def _item_initalization(self): # Schema must define if valid value is dict or list - self.valid_value_types = (list, dict) - self.value_on_not_set = {} + is_list = self.schema_data.get("is_list", False) + if is_list: + valid_value_types = (list, ) + value_on_not_set = [] + else: + valid_value_types = (dict, ) + value_on_not_set = {} + + self._is_list = is_list + self.valid_value_types = valid_value_types + self.value_on_not_set = value_on_not_set self.default_metadata = {} self.studio_override_metadata = {} self.project_override_metadata = {} + @property + def is_list(self): + return self._is_list + + @property + def is_dict(self): + return not self._is_list + def set(self, value): new_value = self.convert_to_valid_type(value) diff --git a/pype/settings/entities/item_entities.py b/pype/settings/entities/item_entities.py index da36bbbc2a..2edd3dad77 100644 --- a/pype/settings/entities/item_entities.py +++ b/pype/settings/entities/item_entities.py @@ -53,15 +53,13 @@ class PathEntity(ItemEntity): self.multiplatform = self.schema_data.get("multiplatform", False) self.multipath = self.schema_data.get("multipath", False) - self.with_arguments = self.schema_data.get("with_arguments", False) # Create child object if not self.multiplatform and not self.multipath: valid_value_types = (STRING_TYPE, ) item_schema = { "type": "path-input", - "key": self.key, - "with_arguments": self.with_arguments + "key": self.key } elif not self.multiplatform: @@ -69,10 +67,7 @@ class PathEntity(ItemEntity): item_schema = { "type": "list", "key": self.key, - "object_type": { - "type": "path-input", - "with_arguments": self.with_arguments - } + "object_type": "path-input" } else: @@ -91,13 +86,9 @@ class PathEntity(ItemEntity): } if self.multipath: child_item["type"] = "list" - child_item["object_type"] = { - "type": "path-input", - "with_arguments": self.with_arguments - } + child_item["object_type"] = "path-input" else: child_item["type"] = "path-input" - child_item["with_arguments"] = self.with_arguments item_schema["children"].append(child_item) diff --git a/pype/settings/entities/root_entities.py b/pype/settings/entities/root_entities.py index e9000015b2..74ccb8d17c 100644 --- a/pype/settings/entities/root_entities.py +++ b/pype/settings/entities/root_entities.py @@ -596,7 +596,7 @@ class ProjectSettings(RootEntity): def system_settings_entity(self): output = self._system_settings_entity if output is None: - output = SystemSettings() + output = SystemSettings(set_studio_state=False) self._system_settings_entity = output if self.override_state is OverrideState.DEFAULTS: diff --git a/pype/settings/entities/schemas/README.md b/pype/settings/entities/schemas/README.md index 80125d4b1b..e92ba8918f 100644 --- a/pype/settings/entities/schemas/README.md +++ b/pype/settings/entities/schemas/README.md @@ -235,13 +235,17 @@ ### raw-json - a little bit enhanced text input for raw json - has validations of json format - - empty value is invalid value, always must be at least `{}` of `[]` - + - empty value is invalid value, always must be json serializable + - valid value types are list `[]` and dictionary `{}` +- schema also defines valid value type + - by default it is dictionary + - to be able use list it is required to define `is_list` to `true` ``` { "type": "raw-json", "key": "profiles", - "label": "Extract Review profiles" + "label": "Extract Review profiles", + "is_list": true } ``` diff --git a/pype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json b/pype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json index bb0e162c04..623658b7a2 100644 --- a/pype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json +++ b/pype/settings/entities/schemas/projects_schema/schemas/schema_maya_publish.json @@ -274,7 +274,8 @@ { "type": "raw-json", "key": "bake_attributes", - "label": "Bake Attributes" + "label": "Bake Attributes", + "is_list": true } ] }, diff --git a/pype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json b/pype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json index 244b9c1f56..ba009cf094 100644 --- a/pype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json +++ b/pype/settings/entities/schemas/system_schema/host_settings/template_host_variant.json @@ -43,8 +43,36 @@ "key": "executables", "label": "Executables", "multiplatform": "{multiplatform}", - "multipath": "{multipath_executables}", - "with_arguments": true + "multipath": "{multipath_executables}" + }, + { + "type":"separator" + }, + { + "type": "dict", + "key": "arguments", + "label": "Arguments", + "use_label_wrap": false, + "children": [ + { + "key": "windows", + "label": "Windows", + "type": "list", + "object_type": "text" + }, + { + "key": "darwin", + "label": "MacOS", + "type": "list", + "object_type": "text" + }, + { + "key": "linux", + "label": "Linux", + "type": "list", + "object_type": "text" + } + ] }, { "key": "environment", diff --git a/pype/tools/settings/local_settings/apps_widget.py b/pype/tools/settings/local_settings/apps_widget.py index d63cd6a834..bc27a3c1c4 100644 --- a/pype/tools/settings/local_settings/apps_widget.py +++ b/pype/tools/settings/local_settings/apps_widget.py @@ -56,7 +56,7 @@ class AppVariantWidget(QtWidgets.QWidget): for item in studio_executables: path_widget = QtWidgets.QLineEdit(content_widget) - path_widget.setText(item.value[0]) + path_widget.setText(item.value) path_widget.setEnabled(False) content_layout.addWidget(path_widget) diff --git a/pype/tools/settings/settings/widgets/item_widgets.py b/pype/tools/settings/settings/widgets/item_widgets.py index 7cfcd84488..e2e31a7588 100644 --- a/pype/tools/settings/settings/widgets/item_widgets.py +++ b/pype/tools/settings/settings/widgets/item_widgets.py @@ -366,7 +366,7 @@ class NumberWidget(InputWidget): class RawJsonInput(QtWidgets.QPlainTextEdit): tab_length = 4 - def __init__(self, *args, **kwargs): + def __init__(self, valid_type, *args, **kwargs): super(RawJsonInput, self).__init__(*args, **kwargs) self.setObjectName("RawJsonInput") self.setTabStopDistance( @@ -374,6 +374,7 @@ class RawJsonInput(QtWidgets.QPlainTextEdit): self.font() ).horizontalAdvance(" ") * self.tab_length ) + self.valid_type = valid_type def sizeHint(self): document = self.document() @@ -403,8 +404,8 @@ class RawJsonInput(QtWidgets.QPlainTextEdit): def has_invalid_value(self): try: - self.json_value() - return False + value = self.json_value() + return not isinstance(value, self.valid_type) except Exception: return True @@ -415,7 +416,11 @@ class RawJsonInput(QtWidgets.QPlainTextEdit): class RawJsonWidget(InputWidget): def _add_inputs_to_layout(self): - self.input_field = RawJsonInput(self.content_widget) + if self.entity.is_list: + valid_type = list + else: + valid_type = dict + self.input_field = RawJsonInput(valid_type, self.content_widget) self.input_field.setSizePolicy( QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.MinimumExpanding @@ -623,40 +628,21 @@ class PathWidget(BaseWidget): class PathInputWidget(InputWidget): def _add_inputs_to_layout(self): self.input_field = QtWidgets.QLineEdit(self.content_widget) - self.args_input_field = None - if self.entity.with_arguments: - self.input_field.setPlaceholderText("Executable path") - self.args_input_field = QtWidgets.QLineEdit(self) - self.args_input_field.setPlaceholderText("Arguments") + self.input_field.setPlaceholderText("Executable path") self.setFocusProxy(self.input_field) - self.content_layout.addWidget(self.input_field, 8) + self.content_layout.addWidget(self.input_field) self.input_field.textChanged.connect(self._on_value_change) - if self.args_input_field: - self.content_layout.addWidget(self.args_input_field, 2) - self.args_input_field.textChanged.connect(self._on_value_change) - def _on_entity_change(self): if self.entity.value != self.input_value(): self.set_entity_value() def set_entity_value(self): - value = self.entity.value - args = "" - if isinstance(value, list): - value, args = value - self.input_field.setText(value) - if self.args_input_field: - self.args_input_field.setText(args) + self.input_field.setText(self.entity.value) def input_value(self): - path_value = self.input_field.text() - if self.entity.with_arguments: - value = [path_value, self.args_input_field.text()] - else: - value = path_value - return value + return self.input_field.text() def _on_value_change(self): if self.ignore_input_changes: