From fe5b0b0d9409a6cf47ee2f5067bae1eaa5c140ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 8 Nov 2021 14:50:29 +0100 Subject: [PATCH] Round coordinates on getFaceIdAtPosition, to fix crash with Python 3.10+ Fixes https://bugzilla.redhat.com/2021157 Patch by Elia Devito --- 750.patch | 28 ++++++++++++++++++++++++++++ python-uranium.spec | 12 +++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 750.patch diff --git a/750.patch b/750.patch new file mode 100644 index 0000000..e89fc17 --- /dev/null +++ b/750.patch @@ -0,0 +1,28 @@ +From 970c94b8ce5008ca90a1cbfaeeef5470879a138f Mon Sep 17 00:00:00 2001 +From: Elia Devito +Date: Sat, 6 Nov 2021 23:22:28 +0100 +Subject: [PATCH] Round coordinates on getFaceIdAtPosition + +PyQt Pixel expects integer coordinates as parameters. + +This fixes the crash on cura when using the +"Select face to align to the build plate" tool +--- + UM/View/SelectionPass.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/UM/View/SelectionPass.py b/UM/View/SelectionPass.py +index f0344e3d22..945b789776 100644 +--- a/UM/View/SelectionPass.py ++++ b/UM/View/SelectionPass.py +@@ -158,8 +158,8 @@ def getFaceIdAtPosition(self, x, y): + + window_size = self._renderer.getWindowSize() + +- px = (0.5 + x / 2.0) * window_size[0] +- py = (0.5 + y / 2.0) * window_size[1] ++ px = round((0.5 + x / 2.0) * window_size[0]) ++ py = round((0.5 + y / 2.0) * window_size[1]) + + if px < 0 or px > (output.width() - 1) or py < 0 or py > (output.height() - 1): + return -1 diff --git a/python-uranium.spec b/python-uranium.spec index d18a15c..138d67a 100644 --- a/python-uranium.spec +++ b/python-uranium.spec @@ -1,11 +1,16 @@ Name: python-uranium Version: 4.11.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A Python framework for building desktop applications License: LGPLv3+ URL: https://github.com/Ultimaker/Uranium Source0: %{url}/archive/%{version}.tar.gz#/Uranium-%{version}.tar.gz +# Round coordinates on getFaceIdAtPosition, to fix crash with Python 3.10+ +# Merged upstream +# Fixes https://bugzilla.redhat.com/2021157 +Patch1: %{url}/pull/750.patch + BuildRequires: python3-devel BuildRequires: python3-pip BuildRequires: /usr/bin/doxygen @@ -109,6 +114,11 @@ popd %changelog +* Mon Nov 08 2021 Miro Hrončok - 4.11.0-2 +- Round coordinates on getFaceIdAtPosition, to fix crash with Python 3.10+ +- Fixes a crash when using "Select face to align to the build plate" tool +- Fixes rhbz#2021157 + * Wed Sep 15 2021 Gabriel Féron - 4.11.0-1 - Update to 4.11.0