mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 06:58:59 +08:00
Merge remote-tracking branch 'origin/main' into CURA-7435_3DConnexion
This commit is contained in:
commit
399d622eeb
@ -17,3 +17,5 @@ CuraLatestURL = "{{ cura_latest_url }}"
|
|||||||
ConanInstalls = {{ conan_installs }}
|
ConanInstalls = {{ conan_installs }}
|
||||||
|
|
||||||
PythonInstalls = {{ python_installs }}
|
PythonInstalls = {{ python_installs }}
|
||||||
|
|
||||||
|
DependenciesDescriptions = {{ dependencies_description }}
|
||||||
|
@ -625,3 +625,10 @@ python_translation_source_folders:
|
|||||||
qml_translation_source_folders:
|
qml_translation_source_folders:
|
||||||
- resources/qml
|
- resources/qml
|
||||||
- plugins
|
- plugins
|
||||||
|
|
||||||
|
extra_dependencies:
|
||||||
|
conan:
|
||||||
|
version: "2.7.1"
|
||||||
|
sources_url: https://github.com/conan-io/conan
|
||||||
|
license: MIT
|
||||||
|
summary: Conan C/C++ package manager
|
||||||
|
193
conanfile.py
193
conanfile.py
@ -1,6 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
|
import requests
|
||||||
|
import yaml
|
||||||
|
import tempfile
|
||||||
|
import tarfile
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from git import Repo
|
||||||
|
from git.exc import GitCommandError
|
||||||
|
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
||||||
@ -11,7 +17,7 @@ from conan.tools.env import VirtualRunEnv, Environment, VirtualBuildEnv
|
|||||||
from conan.tools.scm import Version
|
from conan.tools.scm import Version
|
||||||
from conan.errors import ConanInvalidConfiguration, ConanException
|
from conan.errors import ConanInvalidConfiguration, ConanException
|
||||||
|
|
||||||
required_conan_version = ">=2.7.0"
|
required_conan_version = ">=2.7.0" # When changing the version, also change the one in conandata.yml/extra_dependencies
|
||||||
|
|
||||||
|
|
||||||
class CuraConan(ConanFile):
|
class CuraConan(ConanFile):
|
||||||
@ -37,6 +43,7 @@ class CuraConan(ConanFile):
|
|||||||
"cura_debug_mode": [True, False], # FIXME: Use profiles
|
"cura_debug_mode": [True, False], # FIXME: Use profiles
|
||||||
"internal": [True, False],
|
"internal": [True, False],
|
||||||
"i18n_extract": [True, False],
|
"i18n_extract": [True, False],
|
||||||
|
"skip_licenses_download": [True, False],
|
||||||
}
|
}
|
||||||
default_options = {
|
default_options = {
|
||||||
"enterprise": False,
|
"enterprise": False,
|
||||||
@ -46,6 +53,7 @@ class CuraConan(ConanFile):
|
|||||||
"cura_debug_mode": False, # Not yet implemented
|
"cura_debug_mode": False, # Not yet implemented
|
||||||
"internal": False,
|
"internal": False,
|
||||||
"i18n_extract": False,
|
"i18n_extract": False,
|
||||||
|
"skip_licenses_download": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
def set_version(self):
|
def set_version(self):
|
||||||
@ -135,6 +143,180 @@ class CuraConan(ConanFile):
|
|||||||
|
|
||||||
return python_installs
|
return python_installs
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _is_repository_url(url):
|
||||||
|
# That will not work for ALL open-source projects, but should already get a large majority of them
|
||||||
|
return (url.startswith("https://github.com/") or url.startswith("https://gitlab.com/")) and "conan-center-index" not in url
|
||||||
|
|
||||||
|
def _retrieve_pip_license(self, package, sources_url, dependency_description):
|
||||||
|
# Download the sources to get the license file inside
|
||||||
|
self.output.info(f"Retrieving license for {package}")
|
||||||
|
response = requests.get(sources_url)
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
|
sources_path = os.path.join(temp_dir, "sources.tar.gz")
|
||||||
|
with open(sources_path, 'wb') as sources_file:
|
||||||
|
sources_file.write(response.content)
|
||||||
|
|
||||||
|
with tarfile.open(sources_path, 'r:gz') as sources_archive:
|
||||||
|
license_file = "LICENSE"
|
||||||
|
|
||||||
|
for source_file in sources_archive.getnames():
|
||||||
|
if Path(source_file).name == license_file:
|
||||||
|
sources_archive.extract(source_file, temp_dir)
|
||||||
|
|
||||||
|
license_file_path = os.path.join(temp_dir, source_file)
|
||||||
|
with open(license_file_path, 'r', encoding='utf8') as file:
|
||||||
|
dependency_description["license_full"] = file.read()
|
||||||
|
|
||||||
|
def _make_pip_dependency_description(self, package, version, dependencies):
|
||||||
|
url = ["https://pypi.org/pypi", package]
|
||||||
|
if version is not None:
|
||||||
|
url.append(version)
|
||||||
|
url.append("json")
|
||||||
|
|
||||||
|
data = requests.get("/".join(url)).json()
|
||||||
|
|
||||||
|
dependency_description = {
|
||||||
|
"summary": data["info"]["summary"],
|
||||||
|
"version": data["info"]["version"],
|
||||||
|
"license": data["info"]["license"]
|
||||||
|
}
|
||||||
|
|
||||||
|
for url_data in data["urls"]:
|
||||||
|
if url_data["packagetype"] == "sdist":
|
||||||
|
sources_url = url_data["url"]
|
||||||
|
dependency_description["sources_url"] = sources_url
|
||||||
|
|
||||||
|
if not self.options.skip_licenses_download:
|
||||||
|
self._retrieve_pip_license(package, sources_url, dependency_description)
|
||||||
|
|
||||||
|
for source_url, check_source in [("source", False),
|
||||||
|
("Source", False),
|
||||||
|
("Source Code", False),
|
||||||
|
("Repository", False),
|
||||||
|
("Code", False),
|
||||||
|
("homepage", True),
|
||||||
|
("Homepage", True)]:
|
||||||
|
try:
|
||||||
|
url = data["info"]["project_urls"][source_url]
|
||||||
|
if check_source and not self._is_repository_url(url):
|
||||||
|
# That will not work for ALL open-source projects, but should already get a large majority of them
|
||||||
|
self.output.warning(f"Source URL for {package} ({url}) doesn't seem to be a supported repository")
|
||||||
|
continue
|
||||||
|
dependency_description["sources_url"] = url
|
||||||
|
break
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if dependency_description["license"] is not None and len(dependency_description["license"]) > 32:
|
||||||
|
# Some packages have their full license in this field
|
||||||
|
dependency_description["license_full"] = dependency_description["license"]
|
||||||
|
dependency_description["license"] = data["info"]["name"]
|
||||||
|
|
||||||
|
dependencies[data["info"]["name"]] = dependency_description
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _get_license_from_repository(sources_url, version, license_file_name = None):
|
||||||
|
git_url = sources_url
|
||||||
|
if git_url.endswith('/'):
|
||||||
|
git_url = git_url[:-1]
|
||||||
|
if not git_url.endswith(".git"):
|
||||||
|
git_url = f"{git_url}.git"
|
||||||
|
git_url = git_url.replace("/cgit/", "/")
|
||||||
|
|
||||||
|
tags = [f"v{version}", version]
|
||||||
|
files = ["LICENSE", "LICENSE.txt", "LICENSE.md", "COPYRIGHT", "COPYING", "COPYING.LIB"] if license_file_name is None else [license_file_name]
|
||||||
|
|
||||||
|
with tempfile.TemporaryDirectory() as clone_dir:
|
||||||
|
repo = Repo.clone_from(git_url, clone_dir, depth=1, no_checkout=True)
|
||||||
|
|
||||||
|
for tag in tags:
|
||||||
|
try:
|
||||||
|
repo.git.fetch('--depth', '1', 'origin', 'tag', tag)
|
||||||
|
except GitCommandError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
repo.git.sparse_checkout('init', '--cone')
|
||||||
|
for file_name in files:
|
||||||
|
repo.git.sparse_checkout('add', file_name)
|
||||||
|
|
||||||
|
try:
|
||||||
|
repo.git.checkout(tag)
|
||||||
|
except GitCommandError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
for file_name in files:
|
||||||
|
license_file = os.path.join(clone_dir, file_name)
|
||||||
|
if os.path.exists(license_file):
|
||||||
|
with open(license_file, 'r', encoding='utf8') as file:
|
||||||
|
return file.read()
|
||||||
|
|
||||||
|
break
|
||||||
|
|
||||||
|
def _make_conan_dependency_description(self, dependency, dependencies):
|
||||||
|
dependency_description = {
|
||||||
|
"summary": dependency.description,
|
||||||
|
"version": str(dependency.ref.version),
|
||||||
|
"license": ', '.join(dependency.license) if (isinstance(dependency.license, list) or isinstance(dependency.license, tuple)) else dependency.license,
|
||||||
|
}
|
||||||
|
|
||||||
|
for source_url, check_source in [(dependency.homepage, True),
|
||||||
|
(dependency.url, True),
|
||||||
|
(dependency.homepage, False),
|
||||||
|
(dependency.url, False)]:
|
||||||
|
if source_url is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
is_repository_source = self._is_repository_url(source_url)
|
||||||
|
if not check_source or is_repository_source:
|
||||||
|
dependency_description["sources_url"] = source_url
|
||||||
|
|
||||||
|
if is_repository_source and not self.options.skip_licenses_download:
|
||||||
|
self.output.info(f"Retrieving license for {dependency.ref.name}")
|
||||||
|
dependency_description["license_full"] = self._get_license_from_repository(source_url, str(dependency.ref.version))
|
||||||
|
|
||||||
|
break
|
||||||
|
|
||||||
|
dependencies[dependency.ref.name] = dependency_description
|
||||||
|
|
||||||
|
def _make_extra_dependency_description(self, dependency_name, dependency_data, dependencies):
|
||||||
|
sources_url = dependency_data["sources_url"]
|
||||||
|
version = dependency_data["version"]
|
||||||
|
home_url = dependency_data["home_url"] if "home_url" in dependency_data else sources_url
|
||||||
|
|
||||||
|
dependency_description = {
|
||||||
|
"summary": dependency_data["summary"],
|
||||||
|
"version": version,
|
||||||
|
"license": dependency_data["license"],
|
||||||
|
"sources_url": home_url,
|
||||||
|
}
|
||||||
|
|
||||||
|
if not self.options.skip_licenses_download:
|
||||||
|
self.output.info(f"Retrieving license for {dependency_name}")
|
||||||
|
license_file = dependency_data["license_file"] if "license_file" in dependency_data else None
|
||||||
|
dependency_description["license_full"] = self._get_license_from_repository(sources_url, version, license_file)
|
||||||
|
|
||||||
|
dependencies[dependency_name] = dependency_description
|
||||||
|
|
||||||
|
def _dependencies_description(self):
|
||||||
|
dependencies = {}
|
||||||
|
|
||||||
|
for dependency in [self] + list(self.dependencies.values()):
|
||||||
|
self._make_conan_dependency_description(dependency, dependencies)
|
||||||
|
|
||||||
|
if "extra_dependencies" in dependency.conan_data:
|
||||||
|
for dependency_name, dependency_data in dependency.conan_data["extra_dependencies"].items():
|
||||||
|
self._make_extra_dependency_description(dependency_name, dependency_data, dependencies)
|
||||||
|
|
||||||
|
pip_requirements_summary = os.path.abspath(Path(self.generators_folder, "pip_requirements_summary.yml") )
|
||||||
|
with open(pip_requirements_summary, 'r') as file:
|
||||||
|
for package_name, package_version in yaml.safe_load(file).items():
|
||||||
|
self._make_pip_dependency_description(package_name, package_version, dependencies)
|
||||||
|
|
||||||
|
return dependencies
|
||||||
|
|
||||||
def _generate_cura_version(self, location):
|
def _generate_cura_version(self, location):
|
||||||
with open(os.path.join(self.recipe_folder, "CuraVersion.py.jinja"), "r") as f:
|
with open(os.path.join(self.recipe_folder, "CuraVersion.py.jinja"), "r") as f:
|
||||||
cura_version_py = Template(f.read())
|
cura_version_py = Template(f.read())
|
||||||
@ -149,7 +331,7 @@ class CuraConan(ConanFile):
|
|||||||
|
|
||||||
self.output.info(f"Write CuraVersion.py to {self.recipe_folder}")
|
self.output.info(f"Write CuraVersion.py to {self.recipe_folder}")
|
||||||
|
|
||||||
with open(os.path.join(location, "CuraVersion.py"), "w") as f:
|
with open(os.path.join(location, "CuraVersion.py"), "wb") as f:
|
||||||
f.write(cura_version_py.render(
|
f.write(cura_version_py.render(
|
||||||
cura_app_name = self.name,
|
cura_app_name = self.name,
|
||||||
cura_app_display_name = self._app_name,
|
cura_app_display_name = self._app_name,
|
||||||
@ -165,7 +347,8 @@ class CuraConan(ConanFile):
|
|||||||
cura_latest_url=self.conan_data["urls"][self._urls]["cura_latest_url"],
|
cura_latest_url=self.conan_data["urls"][self._urls]["cura_latest_url"],
|
||||||
conan_installs=self._conan_installs(),
|
conan_installs=self._conan_installs(),
|
||||||
python_installs=self._python_installs(),
|
python_installs=self._python_installs(),
|
||||||
))
|
dependencies_description=self._dependencies_description(),
|
||||||
|
).encode("utf-8"))
|
||||||
|
|
||||||
def _delete_unwanted_binaries(self, root):
|
def _delete_unwanted_binaries(self, root):
|
||||||
dynamic_binary_file_exts = [".so", ".dylib", ".dll", ".pyd", ".pyi"]
|
dynamic_binary_file_exts = [".so", ".dylib", ".dll", ".pyd", ".pyi"]
|
||||||
@ -493,8 +676,8 @@ class CuraConan(ConanFile):
|
|||||||
copy(self, "*.mo", os.path.join(self.build_folder, "resources"), os.path.join(self.package_folder, "resources"))
|
copy(self, "*.mo", os.path.join(self.build_folder, "resources"), os.path.join(self.package_folder, "resources"))
|
||||||
copy(self, "*", src = os.path.join(self.source_folder, "plugins"), dst = os.path.join(self.package_folder, self.cpp.package.resdirs[1]))
|
copy(self, "*", src = os.path.join(self.source_folder, "plugins"), dst = os.path.join(self.package_folder, self.cpp.package.resdirs[1]))
|
||||||
copy(self, "*", src = os.path.join(self.source_folder, "packaging"), dst = os.path.join(self.package_folder, self.cpp.package.resdirs[2]))
|
copy(self, "*", src = os.path.join(self.source_folder, "packaging"), dst = os.path.join(self.package_folder, self.cpp.package.resdirs[2]))
|
||||||
copy(self, "pip_requirements_*.txt", src=self.generators_folder,
|
copy(self, "pip_requirements_*.txt", src = self.generators_folder, dst = os.path.join(self.package_folder, self.cpp.package.resdirs[-1]))
|
||||||
dst=os.path.join(self.package_folder, self.cpp.package.resdirs[-1]))
|
copy(self, "pip_requirements_summary.yml", src = self.generators_folder, dst = os.path.join(self.package_folder, self.cpp.package.resdirs[-1]))
|
||||||
|
|
||||||
# Remove the fdm_materials from the package
|
# Remove the fdm_materials from the package
|
||||||
rmdir(self, os.path.join(self.package_folder, self.cpp.package.resdirs[0], "materials"))
|
rmdir(self, os.path.join(self.package_folder, self.cpp.package.resdirs[0], "materials"))
|
||||||
|
@ -111,6 +111,7 @@ from cura.UI.MachineActionManager import MachineActionManager
|
|||||||
from cura.UI.AddPrinterPagesModel import AddPrinterPagesModel
|
from cura.UI.AddPrinterPagesModel import AddPrinterPagesModel
|
||||||
from cura.UI.MachineSettingsManager import MachineSettingsManager
|
from cura.UI.MachineSettingsManager import MachineSettingsManager
|
||||||
from cura.UI.ObjectsModel import ObjectsModel
|
from cura.UI.ObjectsModel import ObjectsModel
|
||||||
|
from cura.UI.OpenSourceDependenciesModel import OpenSourceDependenciesModel
|
||||||
from cura.UI.RecommendedMode import RecommendedMode
|
from cura.UI.RecommendedMode import RecommendedMode
|
||||||
from cura.UI.TextManager import TextManager
|
from cura.UI.TextManager import TextManager
|
||||||
from cura.UI.WelcomePagesModel import WelcomePagesModel
|
from cura.UI.WelcomePagesModel import WelcomePagesModel
|
||||||
@ -1311,6 +1312,7 @@ class CuraApplication(QtApplication):
|
|||||||
qmlRegisterType(AddPrinterPagesModel, "Cura", 1, 0, "AddPrinterPagesModel")
|
qmlRegisterType(AddPrinterPagesModel, "Cura", 1, 0, "AddPrinterPagesModel")
|
||||||
qmlRegisterType(TextManager, "Cura", 1, 0, "TextManager")
|
qmlRegisterType(TextManager, "Cura", 1, 0, "TextManager")
|
||||||
qmlRegisterType(RecommendedMode, "Cura", 1, 0, "RecommendedMode")
|
qmlRegisterType(RecommendedMode, "Cura", 1, 0, "RecommendedMode")
|
||||||
|
qmlRegisterType(OpenSourceDependenciesModel, "Cura", 1, 0, "OpenSourceDependenciesModel")
|
||||||
|
|
||||||
self.processEvents()
|
self.processEvents()
|
||||||
qmlRegisterType(NetworkMJPGImage, "Cura", 1, 0, "NetworkMJPGImage")
|
qmlRegisterType(NetworkMJPGImage, "Cura", 1, 0, "NetworkMJPGImage")
|
||||||
|
23
cura/UI/OpenSourceDependenciesModel.py
Normal file
23
cura/UI/OpenSourceDependenciesModel.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Copyright (c) 2025 UltiMaker
|
||||||
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
from PyQt6.QtCore import QObject, pyqtProperty
|
||||||
|
|
||||||
|
from cura import CuraVersion
|
||||||
|
from .OpenSourceDependency import OpenSourceDependency
|
||||||
|
|
||||||
|
|
||||||
|
class OpenSourceDependenciesModel(QObject):
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
self._dependencies = []
|
||||||
|
|
||||||
|
for name, data in CuraVersion.DependenciesDescriptions.items():
|
||||||
|
self._dependencies.append(OpenSourceDependency(name, data))
|
||||||
|
|
||||||
|
@pyqtProperty(list, constant=True)
|
||||||
|
def dependencies(self) -> List[OpenSourceDependency]:
|
||||||
|
return self._dependencies
|
40
cura/UI/OpenSourceDependency.py
Normal file
40
cura/UI/OpenSourceDependency.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Copyright (c) 2025 UltiMaker
|
||||||
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
from PyQt6.QtCore import QObject, pyqtProperty, pyqtEnum
|
||||||
|
|
||||||
|
|
||||||
|
class OpenSourceDependency(QObject):
|
||||||
|
|
||||||
|
def __init__(self, name, data):
|
||||||
|
super().__init__()
|
||||||
|
self._name = name
|
||||||
|
self._version = data['version'] if data['version'] is not None else ''
|
||||||
|
self._summary = data['summary'] if data['summary'] is not None else ''
|
||||||
|
self._license = data['license'] if data['license'] is not None and len(data['license']) > 0 else name
|
||||||
|
self._license_full = data['license_full'] if 'license_full' in data else ''
|
||||||
|
self._sources_url = data['sources_url'] if 'sources_url' in data else ''
|
||||||
|
|
||||||
|
@pyqtProperty(str, constant=True)
|
||||||
|
def name(self):
|
||||||
|
return self._name
|
||||||
|
|
||||||
|
@pyqtProperty(str, constant=True)
|
||||||
|
def version(self):
|
||||||
|
return self._version
|
||||||
|
|
||||||
|
@pyqtProperty(str, constant=True)
|
||||||
|
def summary(self):
|
||||||
|
return self._summary
|
||||||
|
|
||||||
|
@pyqtProperty(str, constant=True)
|
||||||
|
def license(self):
|
||||||
|
return self._license
|
||||||
|
|
||||||
|
@pyqtProperty(str, constant=True)
|
||||||
|
def license_full(self):
|
||||||
|
return self._license_full
|
||||||
|
|
||||||
|
@pyqtProperty(str, constant=True)
|
||||||
|
def sources_url(self):
|
||||||
|
return self._sources_url
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2023 UltiMaker
|
// Copyright (c) 2025 UltiMaker
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.4
|
import QtQuick 2.4
|
||||||
@ -19,9 +19,7 @@ UM.Dialog
|
|||||||
// Flag to toggle between main dependencies information and extensive dependencies information
|
// Flag to toggle between main dependencies information and extensive dependencies information
|
||||||
property bool showDefaultDependencies: true
|
property bool showDefaultDependencies: true
|
||||||
|
|
||||||
minimumWidth: 500 * screenScaleFactor
|
|
||||||
minimumHeight: 700 * screenScaleFactor
|
minimumHeight: 700 * screenScaleFactor
|
||||||
width: minimumWidth
|
|
||||||
height: minimumHeight
|
height: minimumHeight
|
||||||
|
|
||||||
backgroundColor: UM.Theme.getColor("main_background")
|
backgroundColor: UM.Theme.getColor("main_background")
|
||||||
@ -86,7 +84,6 @@ UM.Dialog
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visible: text !== ""
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredWidth: 1
|
Layout.preferredWidth: 1
|
||||||
onLinkActivated: Qt.openUrlExternally(url)
|
onLinkActivated: Qt.openUrlExternally(url)
|
||||||
@ -95,23 +92,43 @@ UM.Dialog
|
|||||||
UM.Label
|
UM.Label
|
||||||
{
|
{
|
||||||
text: description
|
text: description
|
||||||
visible: text !== ""
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredWidth: 2
|
Layout.preferredWidth: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.Label
|
UM.Label
|
||||||
{
|
{
|
||||||
text: license
|
text:
|
||||||
visible: text !== ""
|
{
|
||||||
|
if (license_full !== "")
|
||||||
|
{
|
||||||
|
return `<a href="license_full">${license}</a>`;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return license;
|
||||||
|
}
|
||||||
|
}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredWidth: 1
|
Layout.preferredWidth: 1
|
||||||
|
|
||||||
|
Component
|
||||||
|
{
|
||||||
|
id: componentLicenseDialog
|
||||||
|
|
||||||
|
LicenseDialog { }
|
||||||
|
}
|
||||||
|
|
||||||
|
onLinkActivated:
|
||||||
|
{
|
||||||
|
var license_dialog = componentLicenseDialog.createObject(base, {name: name, version: version, license: license_full});
|
||||||
|
license_dialog.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.Label
|
UM.Label
|
||||||
{
|
{
|
||||||
text: version
|
text: version
|
||||||
visible: text !== ""
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredWidth: 1
|
Layout.preferredWidth: 1
|
||||||
}
|
}
|
||||||
@ -151,6 +168,7 @@ UM.Dialog
|
|||||||
{
|
{
|
||||||
visible: showDefaultDependencies
|
visible: showDefaultDependencies
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
spacing: UM.Theme.getSize("narrow_margin").height
|
||||||
|
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
@ -160,65 +178,16 @@ UM.Dialog
|
|||||||
{
|
{
|
||||||
sourceComponent: dependency_row
|
sourceComponent: dependency_row
|
||||||
width: parent.width
|
width: parent.width
|
||||||
property string name: model.name
|
property string name: modelData.name
|
||||||
property string description: model.description
|
property string description: modelData.summary
|
||||||
property string license: model.license
|
property string license: modelData.license
|
||||||
property string url: model.url
|
property string license_full: modelData.license_full
|
||||||
property string version: ""
|
property string url: modelData.sources_url
|
||||||
|
property string version: modelData.version
|
||||||
}
|
}
|
||||||
|
|
||||||
model: ListModel
|
property var dependencies_model: Cura.OpenSourceDependenciesModel {}
|
||||||
{
|
model: dependencies_model.dependencies
|
||||||
id: projectsModel
|
|
||||||
}
|
|
||||||
Component.onCompleted:
|
|
||||||
{
|
|
||||||
//Do NOT add dependencies of our dependencies here, nor CI-dependencies!
|
|
||||||
//UltiMaker's own projects and forks.
|
|
||||||
projectsModel.append({ name: "Cura", description: catalog.i18nc("@label Description for application component", "Graphical user interface"), license: "LGPLv3", url: "https://github.com/Ultimaker/Cura" });
|
|
||||||
projectsModel.append({ name: "Uranium", description: catalog.i18nc("@label Description for application component", "Application framework"), license: "LGPLv3", url: "https://github.com/Ultimaker/Uranium" });
|
|
||||||
projectsModel.append({ name: "CuraEngine", description: catalog.i18nc("@label Description for application component", "G-code generator"), license: "AGPLv3", url: "https://github.com/Ultimaker/CuraEngine" });
|
|
||||||
projectsModel.append({ name: "libArcus", description: catalog.i18nc("@label Description for application component", "Interprocess communication library"), license: "LGPLv3", url: "https://github.com/Ultimaker/libArcus" });
|
|
||||||
projectsModel.append({ name: "pynest2d", description: catalog.i18nc("@label Description for application component", "Python bindings for libnest2d"), license: "LGPL", url: "https://github.com/Ultimaker/pynest2d" });
|
|
||||||
projectsModel.append({ name: "libnest2d", description: catalog.i18nc("@label Description for application component", "Polygon packing library, developed by Prusa Research"), license: "LGPL", url: "https://github.com/tamasmeszaros/libnest2d" });
|
|
||||||
projectsModel.append({ name: "libSavitar", description: catalog.i18nc("@label Description for application component", "Support library for handling 3MF files"), license: "LGPLv3", url: "https://github.com/ultimaker/libsavitar" });
|
|
||||||
projectsModel.append({ name: "libCharon", description: catalog.i18nc("@label Description for application component", "Support library for file metadata and streaming"), license: "LGPLv3", url: "https://github.com/ultimaker/libcharon" });
|
|
||||||
|
|
||||||
//Direct dependencies of the front-end.
|
|
||||||
projectsModel.append({ name: "Python", description: catalog.i18nc("@label Description for application dependency", "Programming language"), license: "Python", url: "http://python.org/" });
|
|
||||||
projectsModel.append({ name: "Qt6", description: catalog.i18nc("@label Description for application dependency", "GUI framework"), license: "LGPLv3", url: "https://www.qt.io/" });
|
|
||||||
projectsModel.append({ name: "PyQt", description: catalog.i18nc("@label Description for application dependency", "GUI framework bindings"), license: "GPL", url: "https://riverbankcomputing.com/software/pyqt" });
|
|
||||||
projectsModel.append({ name: "SIP", description: catalog.i18nc("@label Description for application dependency", "C/C++ Binding library"), license: "GPL", url: "https://riverbankcomputing.com/software/sip" });
|
|
||||||
projectsModel.append({ name: "Protobuf", description: catalog.i18nc("@label Description for application dependency", "Data interchange format"), license: "BSD", url: "https://developers.google.com/protocol-buffers" });
|
|
||||||
projectsModel.append({ name: "Noto Sans", description: catalog.i18nc("@label", "Font"), license: "Apache 2.0", url: "https://www.google.com/get/noto/" });
|
|
||||||
|
|
||||||
//CuraEngine's dependencies.
|
|
||||||
projectsModel.append({ name: "Clipper", description: catalog.i18nc("@label Description for application dependency", "Polygon clipping library"), license: "Boost", url: "http://www.angusj.com/delphi/clipper.php" });
|
|
||||||
projectsModel.append({ name: "RapidJSON", description: catalog.i18nc("@label Description for application dependency", "JSON parser"), license: "MIT", url: "https://rapidjson.org/" });
|
|
||||||
projectsModel.append({ name: "STB", description: catalog.i18nc("@label Description for application dependency", "Utility functions, including an image loader"), license: "Public Domain", url: "https://github.com/nothings/stb" });
|
|
||||||
projectsModel.append({ name: "Boost", description: catalog.i18nc("@label Description for application dependency", "Utility library, including Voronoi generation"), license: "Boost", url: "https://www.boost.org/" });
|
|
||||||
|
|
||||||
//Python modules.
|
|
||||||
projectsModel.append({ name: "Certifi", description: catalog.i18nc("@label Description for application dependency", "Root Certificates for validating SSL trustworthiness"), license: "MPL", url: "https://github.com/certifi/python-certifi" });
|
|
||||||
projectsModel.append({ name: "Cryptography", description: catalog.i18nc("@label Description for application dependency", "Root Certificates for validating SSL trustworthiness"), license: "APACHE and BSD", url: "https://cryptography.io/" });
|
|
||||||
projectsModel.append({ name: "Future", description: catalog.i18nc("@label Description for application dependency", "Compatibility between Python 2 and 3"), license: "MIT", url: "https://python-future.org/" });
|
|
||||||
projectsModel.append({ name: "keyring", description: catalog.i18nc("@label Description for application dependency", "Support library for system keyring access"), license: "MIT", url: "https://github.com/jaraco/keyring" });
|
|
||||||
projectsModel.append({ name: "NumPy", description: catalog.i18nc("@label Description for application dependency", "Support library for faster math"), license: "BSD", url: "http://www.numpy.org/" });
|
|
||||||
projectsModel.append({ name: "NumPy-STL", description: catalog.i18nc("@label Description for application dependency", "Support library for handling STL files"), license: "BSD", url: "https://github.com/WoLpH/numpy-stl" });
|
|
||||||
projectsModel.append({ name: "PyClipper", description: catalog.i18nc("@label Description for application dependency", "Python bindings for Clipper"), license: "MIT", url: "https://github.com/fonttools/pyclipper" });
|
|
||||||
projectsModel.append({ name: "PySerial", description: catalog.i18nc("@label Description for application dependency", "Serial communication library"), license: "Python", url: "http://pyserial.sourceforge.net/" });
|
|
||||||
projectsModel.append({ name: "SciPy", description: catalog.i18nc("@label Description for application dependency", "Support library for scientific computing"), license: "BSD-new", url: "https://www.scipy.org/" });
|
|
||||||
projectsModel.append({ name: "Sentry", description: catalog.i18nc("@Label Description for application dependency", "Python Error tracking library"), license: "BSD 2-Clause 'Simplified'", url: "https://sentry.io/for/python/" });
|
|
||||||
projectsModel.append({ name: "Trimesh", description: catalog.i18nc("@label Description for application dependency", "Support library for handling triangular meshes"), license: "MIT", url: "https://trimsh.org" });
|
|
||||||
projectsModel.append({ name: "python-zeroconf", description: catalog.i18nc("@label Description for application dependency", "ZeroConf discovery library"), license: "LGPL", url: "https://github.com/jstasiak/python-zeroconf" });
|
|
||||||
|
|
||||||
//Building/packaging.
|
|
||||||
projectsModel.append({ name: "CMake", description: catalog.i18nc("@label Description for development tool", "Universal build system configuration"), license: "BSD 3-Clause", url: "https://cmake.org/" });
|
|
||||||
projectsModel.append({ name: "Conan", description: catalog.i18nc("@label Description for development tool", "Dependency and package manager"), license: "MIT", url: "https://conan.io/" });
|
|
||||||
projectsModel.append({ name: "Pyinstaller", description: catalog.i18nc("@label Description for development tool", "Packaging Python-applications"), license: "GPLv2", url: "https://pyinstaller.org/" });
|
|
||||||
projectsModel.append({ name: "AppImageKit", description: catalog.i18nc("@label Description for development tool", "Linux cross-distribution application deployment"), license: "MIT", url: "https://github.com/AppImage/AppImageKit" });
|
|
||||||
projectsModel.append({ name: "NSIS", description: catalog.i18nc("@label Description for development tool", "Generating Windows installers"), license: "Zlib", url: "https://nsis.sourceforge.io/" });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,6 +216,7 @@ UM.Dialog
|
|||||||
property string name: modelData.name
|
property string name: modelData.name
|
||||||
property string version: modelData.version
|
property string version: modelData.version
|
||||||
property string license: ""
|
property string license: ""
|
||||||
|
property string license_full: ""
|
||||||
property string url: ""
|
property string url: ""
|
||||||
property string description: ""
|
property string description: ""
|
||||||
}
|
}
|
||||||
@ -274,6 +244,7 @@ UM.Dialog
|
|||||||
property string name: modelData.name
|
property string name: modelData.name
|
||||||
property string version: modelData.version
|
property string version: modelData.version
|
||||||
property string license: ""
|
property string license: ""
|
||||||
|
property string license_full: ""
|
||||||
property string url: ""
|
property string url: ""
|
||||||
property string description: ""
|
property string description: ""
|
||||||
}
|
}
|
||||||
|
43
resources/qml/Dialogs/LicenseDialog.qml
Normal file
43
resources/qml/Dialogs/LicenseDialog.qml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright (c) 2025 UltiMaker
|
||||||
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.4
|
||||||
|
import QtQuick.Controls 2.9
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
|
import UM 1.6 as UM
|
||||||
|
import Cura 1.6 as Cura
|
||||||
|
|
||||||
|
UM.Dialog
|
||||||
|
{
|
||||||
|
readonly property UM.I18nCatalog catalog: UM.I18nCatalog { name: "cura" }
|
||||||
|
|
||||||
|
property var name
|
||||||
|
property var version
|
||||||
|
property var license
|
||||||
|
|
||||||
|
id: base
|
||||||
|
title: catalog.i18nc("@title:window The argument is a package name, and the second is the version.", "License for %1 %2").arg(name).arg(version)
|
||||||
|
minimumWidth: 500 * screenScaleFactor
|
||||||
|
|
||||||
|
Flickable
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
contentHeight: labelLicense.height
|
||||||
|
ScrollBar.vertical: UM.ScrollBar { }
|
||||||
|
|
||||||
|
UM.Label
|
||||||
|
{
|
||||||
|
id: labelLicense
|
||||||
|
width: parent.width
|
||||||
|
text: license
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rightButtons: Cura.TertiaryButton
|
||||||
|
{
|
||||||
|
id: closeButton
|
||||||
|
text: catalog.i18nc("@action:button", "Close")
|
||||||
|
onClicked: reject()
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user