Merge remote-tracking branch 'origin/bugfix/application_without_executables' into bugfix/unreal-on-linux

This commit is contained in:
Ondrej Samohel 2021-06-16 12:39:48 +02:00
commit fa272bc0ad
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
6 changed files with 53 additions and 23 deletions

View file

@ -191,26 +191,32 @@ class Application:
self.full_label = full_label
self._environment = data.get("environment") or {}
arguments = data.get("arguments")
if isinstance(arguments, dict):
arguments = arguments.get(platform.system().lower())
if not arguments:
arguments = []
self.arguments = arguments
if "executables" not in data:
self.executables = [
UndefinedApplicationExecutable()
]
return
_executables = data["executables"]
if isinstance(_executables, dict):
_executables = _executables.get(platform.system().lower())
if not _executables:
_executables = []
elif isinstance(_executables, dict):
_executables = _executables.get(platform.system().lower()) or []
_arguments = 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
def __repr__(self):
return "<{}> - {}".format(self.__class__.__name__, self.full_name)
@ -484,6 +490,27 @@ class ApplicationExecutable:
return bool(self._realpath())
class UndefinedApplicationExecutable(ApplicationExecutable):
"""Some applications do not require executable path from settings.
In that case this class is used to "fake" existing executable.
"""
def __init__(self):
pass
def __str__(self):
return self.__class__.__name__
def __repr__(self):
return "<{}>".format(self.__class__.__name__)
def as_args(self):
return []
def exists(self):
return True
@six.add_metaclass(ABCMeta)
class LaunchHook:
"""Abstract base class of launch hook."""

View file

@ -1101,16 +1101,6 @@
"variants": {
"4-26": {
"use_python_2": false,
"executables": {
"windows": [],
"darwin": [],
"linux": []
},
"arguments": {
"windows": [],
"darwin": [],
"linux": []
},
"environment": {}
}
}

View file

@ -30,7 +30,12 @@
"children": [
{
"type": "schema_template",
"name": "template_host_variant_items"
"name": "template_host_variant_items",
"skip_paths": [
"executables",
"separator",
"arguments"
]
}
]
}

View file

@ -14,6 +14,7 @@
"placeholder": "Executable path"
},
{
"key": "separator",
"type":"separator"
},
{

View file

@ -532,7 +532,11 @@ def apply_local_settings_on_system_settings(system_settings, local_settings):
variants = system_settings["applications"][app_group_name]["variants"]
for app_name, app_value in value.items():
if not app_value or app_name not in variants:
if (
not app_value
or app_name not in variants
or "executables" not in variants[app_name]
):
continue
executable = app_value.get("executable")

View file

@ -121,6 +121,9 @@ class AppGroupWidget(QtWidgets.QWidget):
widgets_by_variant_name = {}
for variant_name, variant_entity in valid_variants.items():
if "executables" not in variant_entity:
continue
variant_widget = AppVariantWidget(
group_label, variant_name, variant_entity, content_widget
)