File: avoid-floats-for-int-arguments

package info (click to toggle)
mu-editor 1.0.3%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,440 kB
  • sloc: python: 16,321; makefile: 129; xml: 29; sh: 7
file content (33 lines) | stat: -rw-r--r-- 1,188 bytes parent folder | download
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
Description: On Python 3.10+, we cannot use floats for int arguments
Origin: https://github.com/mu-editor/mu/issues/2228
Bug: https://github.com/mu-editor/mu/issues/2228
Applied-Upstream: https://github.com/mu-editor/mu/commit/05ed288f80d3786373bd814a7d5b0048666e1f03
Reviewed-by: Nick Morrott <nickm@debian.org>
Last-Update: 2022-05-17
---
--- a/mu/interface/main.py
+++ b/mu/interface/main.py
@@ -771,8 +771,8 @@
         h = int(screen.height() * 0.8)
         self.resize(w, h)
         size = self.geometry()
-        self.move((screen.width() - size.width()) / 2,
-                  (screen.height() - size.height()) / 2)
+        self.move((screen.width() - size.width()) // 2,
+                  (screen.height() - size.height()) // 2)
 
     def reset_annotations(self):
         """
--- a/tests/interface/test_main.py
+++ b/tests/interface/test_main.py
@@ -1306,8 +1306,8 @@
     mock_qdw.assert_called_once_with()
     w.resize.assert_called_once_with(int(1024 * 0.8), int(768 * 0.8))
     w.geometry.assert_called_once_with()
-    x = (1024 - 819) / 2
-    y = (768 - 614) / 2
+    x = (1024 - 819) // 2
+    y = (768 - 614) // 2
     w.move.assert_called_once_with(x, y)