Fixed the mass-selection functionality of the graph.
This commit is contained in:
parent
2ee93ca374
commit
9214a73b83
19
borealis.py
19
borealis.py
@ -5,18 +5,17 @@ from Qt import QtWidgets, QtCore, QtGui
|
||||
|
||||
_original_setSelectionArea = QtWidgets.QGraphicsScene.setSelectionArea
|
||||
|
||||
def _patched_setSelectionArea(self, painterPath, second_arg, *args, **kwargs):
|
||||
def _patched_setSelectionArea(self, *args, **kwargs):
|
||||
try:
|
||||
# Try calling the original method with the provided arguments.
|
||||
return _original_setSelectionArea(self, painterPath, second_arg, *args, **kwargs)
|
||||
return _original_setSelectionArea(self, *args, **kwargs)
|
||||
except TypeError as e:
|
||||
# If a TypeError is raised, assume the call was made with only a QPainterPath
|
||||
# and an ItemSelectionMode, and patch it by supplying defaults.
|
||||
# Default operation: ReplaceSelection, default transform: QTransform()
|
||||
return _original_setSelectionArea(self, painterPath,
|
||||
QtCore.Qt.ReplaceSelection,
|
||||
second_arg,
|
||||
QtGui.QTransform())
|
||||
# If only a QPainterPath is provided, supply default mode and transform.
|
||||
if len(args) == 1:
|
||||
painterPath = args[0]
|
||||
return _original_setSelectionArea(self, painterPath,
|
||||
QtCore.Qt.ReplaceSelection,
|
||||
QtGui.QTransform())
|
||||
raise e
|
||||
|
||||
# Monkey-patch the setSelectionArea method.
|
||||
QtWidgets.QGraphicsScene.setSelectionArea = _patched_setSelectionArea
|
||||
|
Loading…
x
Reference in New Issue
Block a user