backports/uranium: new aport

This commit is contained in:
Antoine Martin 2024-01-18 22:00:37 -05:00
parent 1a792f23c9
commit 5a8ea97ecd
6 changed files with 306 additions and 0 deletions

View file

@ -0,0 +1,33 @@
From 88fd460a63263d66173f1e0127b0f208577d7f4e Mon Sep 17 00:00:00 2001
From: fieldOfView <aldo@fieldofview.com>
Date: Sat, 20 May 2023 21:14:36 +0200
Subject: [PATCH] Fix SimpleButton use of UM.ColorImage
Fixes https://github.com/Ultimaker/Cura/issues/15524
---
UM/Qt/qml/UM/SimpleButton.qml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/UM/Qt/qml/UM/SimpleButton.qml b/UM/Qt/qml/UM/SimpleButton.qml
index d3d398753c..d3bd0e8e14 100644
--- a/UM/Qt/qml/UM/SimpleButton.qml
+++ b/UM/Qt/qml/UM/SimpleButton.qml
@@ -1,7 +1,8 @@
-// Copyright (c) 2018 Ultimaker B.V.
+// Copyright (c) 2023 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.1
+import UM 1.5 as UM
MouseArea
{
@@ -27,7 +28,7 @@ MouseArea
radius: 0
}
- ColorImage
+ UM.ColorImage
{
id: image

View file

@ -0,0 +1,62 @@
# Contributor: Anjandev Momi <anjan@momi.ca>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=uranium
pkgver=5.2.2
pkgrel=3
pkgdesc="A Python framework for building Desktop applications"
url="https://github.com/Ultimaker/Uranium"
arch="noarch !armhf !riscv64" # armhf: no py3-qt5, rv64: no py3-shapely
license="LGPL-3.0-or-later"
depends="
py3-cryptography
py3-numpy
py3-qt6
py3-scipy
python3
"
# add cura-binary-data to makedepends when packaged
makedepends="samurai cmake doxygen gettext-dev graphviz"
checkdepends="py3-pytest py3-pytest-benchmark py3-twisted"
options="!check" # checks broken from 5.x onward
source="$pkgname-$pkgver.tar.gz::https://github.com/Ultimaker/Uranium/archive/refs/tags/$pkgver.tar.gz
cmake.patch
cmake-helpers.patch
874_fix-simplebutton-use-of-um-colorimage.patch
fix-logger-used-but-not-imported.patch
qt-try-ints-then-bytes.patch
"
builddir="$srcdir/Uranium-$pkgver"
build() {
if [ "$CBUILD" != "$CHOST" ]; then
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
fi
cmake -B build -G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DGETTEXT_MSGINIT_EXECUTABLE=msginit \
-DCURA_BINARY_DATA_DIRECTORY=/usr/share/cura \
$CMAKE_CROSSOPTS
cmake --build build
}
check() {
# useless code style test with another dependency
ctest -j $JOBS --output-on-failure -T Test
}
package() {
DESTDIR="$pkgdir" cmake --install build
mkdir "$pkgdir"/usr/share/uranium/cmake
mv "$pkgdir"/usr/share/cmake-*/Modules/* "$pkgdir"/usr/share/uranium/cmake/
}
sha512sums="
a9c222400022e05b5c42c72843b024204a58f5d233805bdffa610a2d9cbd1873773868b049aabbe52c6e859f235ca5428fcdfdbb86651f428483999060611e10 uranium-5.2.2.tar.gz
196a04164de288f5bffeebb73ace9390059dcffebaf40395368f413d1af2e2c668d85dd4c761ad226732540d41598235c2c368152cc157d2e89445ce27738c9b cmake.patch
aa185ce3592036f045e3386266015cc08443c2e4f9b9a4c03c77c13525af98d68eaa3360e8858e0561417a826c73bf8a2b209bcad91d2cc16cce32fb0231fcf8 cmake-helpers.patch
d0957ec427070f1b8ebe9257447402e09e3af7a89fe9b3c5967a4c40bfc753fab0ea8f0b0c49e17f5895abcd69888b59e4735d130cb47280207af1b8dbec1e71 874_fix-simplebutton-use-of-um-colorimage.patch
b23701d49d6bc7b8e87e7720ca52b96b9b7dc0e20562c12832eb710aed38dad77f93c20413bd93bc1e2f8026a57af44a1aa06a90cf6488b6f887e3ba0b7ca51c fix-logger-used-but-not-imported.patch
2a277b2e6e4acd701bc72924ec718127d8525192ef8e37a4d99d73b03b6c13462c2cb269704b5ee4c58203991cc3d3bd3ed32dadd5f153d5813eb2a946f02942 qt-try-ints-then-bytes.patch
"

View file

@ -0,0 +1,89 @@
--- /dev/null
+++ ./cmake/UraniumPluginInstall.cmake
@@ -0,0 +1,86 @@
+# Copyright (c) 2022 Ultimaker B.V.
+# UraniumPluginInstall.cmake is released under the terms of the LGPLv3 or higher.
+
+#
+# This module detects all plugins that need to be installed and adds them using the CMake install() command.
+# It detects all plugin folder in the path "plugins/*" where there's a "plugin.json" in it.
+#
+# Plugins can be configured to NOT BE INSTALLED via the variable "UM_NO_INSTALL_PLUGINS" as a list of string in the
+# form of "a;b;c" or "a,b,c". By default all plugins will be installed.
+#
+
+# Options or configuration variables
+set(UM_NO_INSTALL_PLUGINS "" CACHE STRING "A list of plugins that should not be installed, separated with ';' or ','.")
+
+file(GLOB_RECURSE _plugin_json_list ${CMAKE_SOURCE_DIR}/plugins/*/plugin.json)
+list(LENGTH _plugin_json_list _plugin_json_list_len)
+
+# Sort the lists alphabetically so we can handle cases like this:
+# - plugins/my_plugin/plugin.json
+# - plugins/my_plugin/my_module/plugin.json
+# In this case, only "plugins/my_plugin" should be added via install().
+set(_no_install_plugin_list ${UM_NO_INSTALL_PLUGINS})
+# Sanitize the string so the comparison will be case-insensitive.
+string(STRIP "${_no_install_plugin_list}" _no_install_plugin_list)
+string(TOLOWER "${_no_install_plugin_list}" _no_install_plugin_list)
+
+# WORKAROUND counterpart of what's in cura-build.
+string(REPLACE "," ";" _no_install_plugin_list "${_no_install_plugin_list}")
+
+list(LENGTH _no_install_plugin_list _no_install_plugin_list_len)
+
+if(_no_install_plugin_list_len GREATER 0)
+ list(SORT _no_install_plugin_list)
+endif()
+if(_plugin_json_list_len GREATER 0)
+ list(SORT _plugin_json_list)
+endif()
+
+# Check all plugin directories and add them via install() if needed.
+set(_install_plugin_list "")
+foreach(_plugin_json_path ${_plugin_json_list})
+ get_filename_component(_plugin_dir ${_plugin_json_path} DIRECTORY)
+ file(RELATIVE_PATH _rel_plugin_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_plugin_dir})
+ get_filename_component(_plugin_dir_name ${_plugin_dir} NAME)
+
+ # Make plugin name comparison case-insensitive
+ string(TOLOWER "${_plugin_dir_name}" _plugin_dir_name_lowercase)
+
+ # Check if this plugin needs to be skipped for installation
+ set(_add_plugin ON) # Indicates if this plugin should be added to the build or not.
+ set(_is_no_install_plugin OFF) # If this plugin will not be added, this indicates if it's because the plugin is
+ # specified in the NO_INSTALL_PLUGINS list.
+ if(_no_install_plugin_list)
+ if("${_plugin_dir_name_lowercase}" IN_LIST _no_install_plugin_list)
+ set(_add_plugin OFF)
+ set(_is_no_install_plugin ON)
+ endif()
+ endif()
+
+ # Make sure this is not a subdirectory in a plugin that's already in the install list
+ if(_add_plugin)
+ foreach(_known_install_plugin_dir ${_install_plugin_list})
+ if(_plugin_dir MATCHES "${_known_install_plugin_dir}.+")
+ set(_add_plugin OFF)
+ break()
+ endif()
+ endforeach()
+ endif()
+
+ if(_add_plugin)
+ message(STATUS "[+] PLUGIN TO INSTALL: ${_rel_plugin_dir}")
+ get_filename_component(_rel_plugin_parent_dir ${_rel_plugin_dir} DIRECTORY)
+ install(DIRECTORY ${_rel_plugin_dir}
+ DESTINATION lib${LIB_SUFFIX}/uranium/${_rel_plugin_parent_dir}
+ PATTERN "__pycache__" EXCLUDE
+ PATTERN "*.qmlc" EXCLUDE
+ )
+ list(APPEND _install_plugin_list ${_plugin_dir})
+ elseif(_is_no_install_plugin)
+ message(STATUS "[-] PLUGIN TO REMOVE : ${_rel_plugin_dir}")
+ execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/mod_bundled_packages_json.py
+ -d ${CMAKE_CURRENT_SOURCE_DIR}/resources/bundled_packages
+ ${_plugin_dir_name}
+ RESULT_VARIABLE _mod_json_result)
+ endif()
+endforeach()

View file

@ -0,0 +1,16 @@
--- ./CMakeLists.txt.orig
+++ ./CMakeLists.txt
@@ -19,9 +19,12 @@
# Build Translations
CREATE_TRANSLATION_TARGETS()
+find_package(Python REQUIRED COMPONENTS Interpreter)
-install(DIRECTORY UM DESTINATION "${Python_SITELIB_LOCAL}")
+install(DIRECTORY UM DESTINATION "${Python_SITELIB}")
install(FILES ${CMAKE_SOURCE_DIR}/cmake/UraniumTranslationTools.cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake-${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}/Modules/ )
install(DIRECTORY resources DESTINATION ${CMAKE_INSTALL_DATADIR}/uranium)
+
+include(UraniumPluginInstall)

View file

@ -0,0 +1,12 @@
diff --git a/UM/View/SelectionPass.py.orig b/UM/View/SelectionPass.py
index 945b789..ef042a5 100644
--- a/UM/View/SelectionPass.py.orig
+++ b/UM/View/SelectionPass.py
@@ -5,6 +5,7 @@ import enum
import random
from typing import TYPE_CHECKING
+from UM.Logger import Logger
from UM.Resources import Resources
from UM.Application import Application

View file

@ -0,0 +1,94 @@
diff --git a/UM/View/RenderBatch.py.orig b/UM/View/RenderBatch.py
index 6deeeb1..5f1eda5 100644
--- a/UM/View/RenderBatch.py.orig
+++ b/UM/View/RenderBatch.py
@@ -186,10 +186,24 @@ class RenderBatch:
if self._render_type == self.RenderType.Solid:
self._gl.glEnable(self._gl.GL_DEPTH_TEST)
- self._gl.glDepthMask(self._gl.GL_TRUE)
+ try:
+ self._gl.glDepthMask(self._gl.GL_TRUE)
+ except:
+ Logger.log("w", "glDepthMask does not like ints, trying bytes...")
+ try:
+ self._gl.glDepthMask(b'1')
+ except:
+ Logger.log("e", "glDepthMask does not like ints or bytes, no idea what it wants")
elif self._render_type == self.RenderType.Transparent:
self._gl.glEnable(self._gl.GL_DEPTH_TEST)
- self._gl.glDepthMask(self._gl.GL_FALSE)
+ try:
+ self._gl.glDepthMask(self._gl.GL_FALSE)
+ except:
+ Logger.log("w", "glDepthMask does not like ints, trying bytes...")
+ try:
+ self._gl.glDepthMask(b'1')
+ except:
+ Logger.log("e", "glDepthMask does not like ints or bytes, no idea what it wants")
elif self._render_type == self.RenderType.Overlay:
self._gl.glDisable(self._gl.GL_DEPTH_TEST)
diff --git a/UM/View/RenderPass.py.orig b/UM/View/RenderPass.py
index 8068ddf..8cb4f67 100644
--- a/UM/View/RenderPass.py.orig
+++ b/UM/View/RenderPass.py
@@ -93,8 +93,22 @@ class RenderPass:
self._fbo.bind()
# Ensure we can actually write to the relevant FBO components.
- self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE,self._gl.GL_TRUE, self._gl.GL_TRUE)
- self._gl.glDepthMask(self._gl.GL_TRUE)
+ try:
+ self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE,self._gl.GL_TRUE, self._gl.GL_TRUE)
+ except:
+ Logger.log("w", "glColorMask does not like ints, trying bytes...")
+ try:
+ self._gl.glColorMask(b'1', b'1',b'1', b'1')
+ except:
+ Logger.log("e", "glColorMask does not like ints or bytes, no idea what it wants")
+ try:
+ self._gl.glDepthMask(self._gl.GL_TRUE)
+ except:
+ Logger.log("w", "glDepthMask does not like ints, trying bytes...")
+ try:
+ self._gl.glDepthMask(b'1')
+ except:
+ Logger.log("e", "glDepthMask does not like ints or bytes, no idea what it wants")
self._gl.glClear(self._gl.GL_COLOR_BUFFER_BIT | self._gl.GL_DEPTH_BUFFER_BIT)
diff --git a/UM/View/SelectionPass.py.orig b/UM/View/SelectionPass.py
index ef042a5..c28fe4f 100644
--- a/UM/View/SelectionPass.py.orig
+++ b/UM/View/SelectionPass.py
@@ -110,13 +110,27 @@ class SelectionPass(RenderPass):
if selectable_objects:
batch.render(self._scene.getActiveCamera())
- self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_FALSE)
+ try:
+ self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_FALSE)
+ except:
+ Logger.log("w", "glColorMask does not like ints, trying bytes...")
+ try:
+ self._gl.glColorMask(b'1', b'1', b'1', b'0')
+ except:
+ Logger.log("e", "glColorMask does not like ints or bytes, no idea what it wants")
self._gl.glDisable(self._gl.GL_DEPTH_TEST)
tool_handle.render(self._scene.getActiveCamera())
self._gl.glEnable(self._gl.GL_DEPTH_TEST)
- self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE)
+ try:
+ self._gl.glColorMask(self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE, self._gl.GL_TRUE)
+ except:
+ Logger.log("w", "glColorMask does not like ints, trying bytes...")
+ try:
+ self._gl.glColorMask(b'1', b'1', b'1', b'1')
+ except:
+ Logger.log("e", "glColorMask does not like ints or bytes, no idea what it wants")
self.release()