File: initializing-qclipboard-in-a-way-that-wo.patch

package info (click to toggle)
meshroom 2025.1.1-1
  • links: PTS, VCS
  • area: contrib
  • in suites: sid
  • size: 5,196 kB
  • sloc: python: 14,951; javascript: 105; sh: 103; modula3: 53; makefile: 28
file content (51 lines) | stat: -rw-r--r-- 2,371 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From: Dima Kogan <dkogan@debian.org>
Date: Tue, 16 Dec 2025 19:15:33 -0800
X-Dgit-Generated: 2025.1.0-1 99be86d991222f3dc4cb99bfaa162da79ad79535
Subject: Initializing QClipboard in a way that works with the new PySide6

Prior to this patch this happened:

  $ meshroom
  Traceback (most recent call last):
    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "/usr/lib/python3/dist-packages/meshroom/ui/__main__.py", line 12, in <module>
      meshroom.ui.uiInstance = meshroom.ui.app.MeshroomApp(sys.argv)
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
    File "/usr/lib/python3/dist-packages/meshroom/ui/app.py", line 279, in __init__
      self.engine.rootContext().setContextProperty("Clipboard", ClipboardHelper(parent=self))
                                                                ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
    File "/usr/lib/python3/dist-packages/meshroom/ui/components/clipboard.py", line 12, in __init__
      self._clipboard = QClipboard(parent=self)
                        ~~~~~~~~~~^^^^^^^^^^^^^
  NotImplementedError: Class 'QClipboard' cannot be instantiated.
  Exception ignored in: <function ClipboardHelper.__del__ at 0x7f070e1c49a0>
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/meshroom/ui/components/clipboard.py", line 19, in __del__
      self.clear()
    File "/usr/lib/python3/dist-packages/meshroom/ui/components/clipboard.py", line 31, in clear
      self._clipboard.clear()
  AttributeError: 'ClipboardHelper' object has no attribute '_clipboard'

---

diff --git a/meshroom/ui/components/clipboard.py b/meshroom/ui/components/clipboard.py
index aaee965a..820ca669 100644
--- a/meshroom/ui/components/clipboard.py
+++ b/meshroom/ui/components/clipboard.py
@@ -1,5 +1,5 @@
 from PySide6.QtCore import Slot, QObject
-from PySide6.QtGui import QClipboard
+from PySide6.QtGui import QGuiApplication
 
 
 class ClipboardHelper(QObject):
@@ -9,7 +9,7 @@ class ClipboardHelper(QObject):
 
     def __init__(self, parent=None):
         super(ClipboardHelper, self).__init__(parent)
-        self._clipboard = QClipboard(parent=self)
+        self._clipboard = QGuiApplication.clipboard()
 
     def __del__(self):
         # Workaround to avoid the "QXcbClipboard: Unable to receive an event from the clipboard manager