aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/python-wxwidgets-type-errors.patch
blob: 53e48c08862a3d5760c3c23c3dee87a5dc4a4676 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Merged upstream but not yet released (see:
https://github.com/wxWidgets/Phoenix/pull/2387/commits/5d9f7aa185cd18da3e93ae1d0033fb9172d7a714).

From 5d9f7aa185cd18da3e93ae1d0033fb9172d7a714 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 1 May 2023 13:53:55 -0400
Subject: [PATCH] agw: Fix TypeError caused by floats with Python 3.10
 extensions.

This fixes the following error:

   File "/lib/python3.10/site-packages/wx/lib/agw/pygauge.py", line 380, in OnPaint
       dc.DrawText(drawString, textXPos, textYPos)
   TypeError: DC.DrawText(): arguments did not match any overloaded call:
     overload 1: argument 2 has unexpected type 'float'
     overload 2: argument 2 has unexpected type 'float'
   TimeLeft: 3.0

Visible when using Python 3.10 or newer.
---
 wx/lib/agw/pygauge.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/wx/lib/agw/pygauge.py b/wx/lib/agw/pygauge.py
index b8654436a..da42e6f61 100644
--- a/wx/lib/agw/pygauge.py
+++ b/wx/lib/agw/pygauge.py
@@ -367,12 +367,12 @@ def OnPaint(self, event):
             drawString = self._drawIndicatorText_formatString.format(drawValue)
             rect = self.GetClientRect()
             (textWidth, textHeight, descent, extraLeading) = dc.GetFullTextExtent(drawString)
-            textYPos = (rect.height-textHeight)/2
+            textYPos = (rect.height-textHeight)//2
 
             if textHeight > rect.height:
                 textYPos = 0-descent+extraLeading
 
-            textXPos = (rect.width-textWidth)/2
+            textXPos = (rect.width-textWidth)//2
 
             if textWidth>rect.width:
                 textXPos = 0