diff --git a/qtgui/graphs.py b/qtgui/graphs.py index cc1c43e..ff65b44 100644 --- a/qtgui/graphs.py +++ b/qtgui/graphs.py @@ -75,9 +75,9 @@ class CCPath(QtWidgets.QGraphicsRectItem): return super().itemChange(changeEnum, value) - def mousePressEvent(self, event): + def mousePressEventToAdd(self, event): if event.button() == 1: #QtCore.Qt.LeftButton - self.add(event.pos()) + self.add(event) @property def items(self): @@ -215,14 +215,15 @@ class CCPath(QtWidgets.QGraphicsRectItem): assert 0 <= newCCValue < 128 return newCCValue - def add(self, qPos): + def add(self, event): """Only activated through the hover area which gives are the most control over where clicks are allowed. - Also there was a weird bug that the CCPath itself cannot - detect mouse clicks in the right position""" - y = qPos.y() + """ + pos = self.mapFromScene(event.scenePos()) + x = pos.x() + y = pos.y() if -28 < y < 28: - sp = qPos.x() * constantsAndConfigs.ticksToPixelRatio + sp = x * constantsAndConfigs.ticksToPixelRatio blockId, blockStartOffset = self.blocKByPosition(sp) #get the block before rounding. Otherwise rounding might result in a position higher than the blocks duration if constantsAndConfigs.snapToGrid: sp = round(sp / constantsAndConfigs.gridRhythm) * constantsAndConfigs.gridRhythm @@ -553,7 +554,7 @@ class CCUserPoint(QtWidgets.QGraphicsEllipseItem): api.changeGraphItemInterpolation(self.staticExportItem["id"], graphTypeString[0]) def changeCCValue(self): - ccValue = QtWidgets.QInputDialog.getInt(self.scene().parentView, "CC Value", "specify midi Continuous Control value", value=64, minValue=0, maxValue=127) + ccValue = QtWidgets.QInputDialog.getInt(self.scene().parentView, "CC Value", "specify midi control change value", 64, 0, 127) #value, min, max. if ccValue[1]: #[1] bool if canceled api.changeGraphItem(self.staticExportItem["id"], self.getXDifferenceAsBackendValue(), ccValue[0]) #send update to the backend, don't wait for callback.