CreativePython 1.1.4__tar.gz → 1.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {creativepython-1.1.4/src/CreativePython.egg-info → creativepython-1.1.6}/PKG-INFO +1 -1
- {creativepython-1.1.4 → creativepython-1.1.6}/pyproject.toml +1 -1
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/GuiHandler.py +15 -6
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/GuiRenderer.py +61 -97
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/__init__.py +6 -0
- {creativepython-1.1.4 → creativepython-1.1.6/src/CreativePython.egg-info}/PKG-INFO +1 -1
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython.egg-info/SOURCES.txt +5 -1
- {creativepython-1.1.4 → creativepython-1.1.6}/src/gui.py +532 -27
- {creativepython-1.1.4 → creativepython-1.1.6}/src/image.py +3 -2
- creativepython-1.1.6/src/midi.py +732 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/music.py +84 -51
- creativepython-1.1.6/src/osc.py +266 -0
- creativepython-1.1.6/tests/testCompress.py +12 -0
- creativepython-1.1.6/tests/testGameboard.py +49 -0
- creativepython-1.1.6/tests/test_midi.py +71 -0
- creativepython-1.1.6/tests/test_osc.py +71 -0
- creativepython-1.1.4/src/midi.py +0 -1007
- creativepython-1.1.4/src/osc.py +0 -450
- {creativepython-1.1.4 → creativepython-1.1.6}/LICENSE +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/LICENSE-PSF +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/MANIFEST.in +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/README.md +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/setup.cfg +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/RealtimeAudioPlayer.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/Java-Comparison-Tests/advMetricRunner.pythonSurvey.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/Java-Comparison-Tests/compareMetrics_Java-Vs-Python.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/RunMetrics.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/Surveyor.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/__init__.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/Confidence.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/Contig.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/ExtendedNote.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/Histogram.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/Judgement.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/Measurement.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/PianoRoll.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/PianoRollOld.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/__init__.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/test_ExtendedNote.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/test_Histogram.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/test_Measurement.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/test_PianoRoll_assertions.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/test_PianoRoll_integration.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/test_PianoRoll_quantization.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/data/test_PianoRoll_unit.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/Metric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/ZipfMetrics.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/__init__.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/ChordDensityMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/ChordDistanceMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/ChordMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/ChordNormalizedMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/ChromaticToneMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/ContourBasslineDurationMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/ContourBasslineDurationQuantizedMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/ContourBasslinePitchMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/ContourMelodyDurationMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/ContourMelodyDurationQuantizedMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/ContourMelodyPitchMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/DurationBigramMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/DurationDistanceMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/DurationMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/DurationQuantizedBigramMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/DurationQuantizedDistanceMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/DurationQuantizedMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/HarmonicBigramMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/HarmonicConsonanceMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/HarmonicIntervalMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/MelodicBigramMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/MelodicConsonanceMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/MelodicIntervalMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/PitchDistanceMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/PitchDurationMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/PitchDurationQuantizedMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/PitchMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/RestMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/__init__.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/test_DurationMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/test_Metrics_BasicIntervalsAndBigrams.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/test_Metrics_ChordsAndConsonance.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/test_Metrics_ContoursAndChromatic.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/test_Metrics_QuantizedDurationsAndDistances.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/test_PitchMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/simple/test_RestMetric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/metrics/test_Metric.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/utilities/CSVWriter.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/utilities/PowerLawRandom.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/nevmuse/utilities/__init__.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython/notationRenderer.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython.egg-info/dependency_links.txt +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython.egg-info/requires.txt +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/CreativePython.egg-info/top_level.txt +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/bin/libportaudio.2.dylib +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/iannix.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/markov.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/timer.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/src/zipf.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/tests/testAnimate.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/tests/testHitTesting.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/tests/testPeer.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/tests/testToolTips.py +0 -0
- {creativepython-1.1.4 → creativepython-1.1.6}/tests/test_keyEvent.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CreativePython
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.6
|
|
4
4
|
Summary: A Python-based software environment for developing algorithmic art projects.
|
|
5
5
|
Author-email: "Dr. Bill Manaris" <manaris@cofc.edu>, Taj Ballinger <ballingertj@g.cofc.edu>, Trevor Ritchie <ritchiets@g.cofc.edu>
|
|
6
6
|
License: MIT License
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "CreativePython"
|
|
7
|
-
version = "1.1.
|
|
7
|
+
version = "1.1.6"
|
|
8
8
|
description = "A Python-based software environment for developing algorithmic art projects."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { file = "LICENSE" }
|
|
@@ -86,11 +86,20 @@ def _launchRenderer(childCommandConnection, childPriorityConnection, parentPrior
|
|
|
86
86
|
|
|
87
87
|
parentPriorityConnection.close() # child must not hold the parent end open
|
|
88
88
|
|
|
89
|
-
#
|
|
90
|
-
#
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
# Set to True to redirect stderr to PENCIL_debug.log for diagnostics.
|
|
90
|
+
# When False, stderr is silenced (sent to /dev/null) to suppress Qt/Cocoa noise.
|
|
91
|
+
_DEBUG_LOG = False
|
|
92
|
+
|
|
93
|
+
if _DEBUG_LOG:
|
|
94
|
+
# Redirect stderr (fd 2) to a log file so both Python tracebacks and C-level
|
|
95
|
+
# output from Qt/Cocoa/XPC are captured for diagnostics.
|
|
96
|
+
# The log is removed on clean exit if nothing was written to it.
|
|
97
|
+
_logPath = os.path.join(os.getcwd(), "PENCIL_debug.log")
|
|
98
|
+
_logFile = open(_logPath, "w")
|
|
99
|
+
else:
|
|
100
|
+
_logPath = None
|
|
101
|
+
_logFile = open(os.devnull, "w")
|
|
102
|
+
|
|
94
103
|
os.dup2(_logFile.fileno(), 2)
|
|
95
104
|
sys.stderr = _logFile
|
|
96
105
|
|
|
@@ -103,7 +112,7 @@ def _launchRenderer(childCommandConnection, childPriorityConnection, parentPrior
|
|
|
103
112
|
raise
|
|
104
113
|
finally:
|
|
105
114
|
_logFile.flush()
|
|
106
|
-
if os.path.getsize(_logPath) == 0:
|
|
115
|
+
if _DEBUG_LOG and _logPath and os.path.getsize(_logPath) == 0:
|
|
107
116
|
try:
|
|
108
117
|
_logFile.close()
|
|
109
118
|
os.unlink(_logPath)
|
|
@@ -549,9 +549,10 @@ class _QtGraphicsItemEventMixin:
|
|
|
549
549
|
pos = event.scenePos()
|
|
550
550
|
args = [int(pos.x()), int(pos.y())]
|
|
551
551
|
self._send('mouseDown', args)
|
|
552
|
-
# register this item for drag delivery during subsequent mouse
|
|
552
|
+
# register this item for release and drag delivery during subsequent mouse events
|
|
553
553
|
view = self._qtview()
|
|
554
554
|
if view is not None:
|
|
555
|
+
view._pressedItems.append(self._mirror.objectId) # track for manual release delivery (see QtView.mouseReleaseEvent)
|
|
555
556
|
if (self._mirror.objectId, 'mouseDrag') in self._mirror.guiRenderer._registeredEvents:
|
|
556
557
|
view._draggingItems.append(self._mirror.objectId)
|
|
557
558
|
event.ignore() # allow cascade to items below
|
|
@@ -623,7 +624,30 @@ class _QPolygonItem(_QtGraphicsItemEventMixin, QtWidgets.QGraphicsPolygonItem):
|
|
|
623
624
|
pass
|
|
624
625
|
|
|
625
626
|
class _QPixmapItem(_QtGraphicsItemEventMixin, QtWidgets.QGraphicsPixmapItem):
|
|
626
|
-
|
|
627
|
+
_colorFilter = None # (r, g, b, a) set by IconMirror._applyColor; None = no filter
|
|
628
|
+
|
|
629
|
+
def paint(self, painter, option, widget=None):
|
|
630
|
+
if self._colorFilter is None:
|
|
631
|
+
super().paint(painter, option, widget)
|
|
632
|
+
return
|
|
633
|
+
|
|
634
|
+
pixmap = self.pixmap()
|
|
635
|
+
if pixmap.isNull():
|
|
636
|
+
return
|
|
637
|
+
|
|
638
|
+
r, g, b, a = self._colorFilter
|
|
639
|
+
image = pixmap.toImage().convertToFormat(QtGui.QImage.Format.Format_ARGB32)
|
|
640
|
+
|
|
641
|
+
filtered = QtGui.QImage(image.size(), QtGui.QImage.Format.Format_ARGB32)
|
|
642
|
+
filtered.fill(QtCore.Qt.GlobalColor.transparent)
|
|
643
|
+
|
|
644
|
+
p = QtGui.QPainter(filtered)
|
|
645
|
+
p.drawImage(0, 0, image)
|
|
646
|
+
p.setCompositionMode(QtGui.QPainter.CompositionMode.CompositionMode_SourceOver)
|
|
647
|
+
p.fillRect(image.rect(), QtGui.QColor(r, g, b, a))
|
|
648
|
+
p.end()
|
|
649
|
+
|
|
650
|
+
painter.drawImage(self.offset(), filtered)
|
|
627
651
|
|
|
628
652
|
class _QGroupItem(_QtGraphicsItemEventMixin, QtWidgets.QGraphicsItemGroup):
|
|
629
653
|
pass
|
|
@@ -653,6 +677,7 @@ class QtView(QtWidgets.QGraphicsView):
|
|
|
653
677
|
self._display = displayMirror
|
|
654
678
|
self._pressPos = None # QPointF scene pos at last press
|
|
655
679
|
self._draggingItems = [] # objectIds wanting drag events
|
|
680
|
+
self._pressedItems = [] # objectIds of items that received the last mousePressEvent
|
|
656
681
|
|
|
657
682
|
# ── Helpers ────────────────────────────────────────────────────────────────
|
|
658
683
|
|
|
@@ -679,16 +704,28 @@ class QtView(QtWidgets.QGraphicsView):
|
|
|
679
704
|
|
|
680
705
|
def mouseReleaseEvent(self, event):
|
|
681
706
|
x, y = self._sceneXY(event)
|
|
682
|
-
|
|
707
|
+
|
|
708
|
+
# Items call event.ignore() in mousePressEvent to allow cascade, so Qt never
|
|
709
|
+
# sets a mouse grabber and mouseReleaseEvent is never routed to items normally.
|
|
710
|
+
# Manually deliver mouseUp and mouseClick using the objectIds tracked at press time,
|
|
711
|
+
# mirroring the _draggingItems pattern used for mouseDrag.
|
|
712
|
+
registered = self._display.guiRenderer._registeredEvents
|
|
713
|
+
pos = self.mapToScene(event.position().toPoint())
|
|
714
|
+
is_click = (self._pressPos is not None
|
|
715
|
+
and abs(pos.x() - self._pressPos.x()) <= _QtGraphicsItemEventMixin._CLICK_THRESHOLD
|
|
716
|
+
and abs(pos.y() - self._pressPos.y()) <= _QtGraphicsItemEventMixin._CLICK_THRESHOLD)
|
|
717
|
+
for objectId in self._pressedItems:
|
|
718
|
+
if (objectId, 'mouseUp') in registered:
|
|
719
|
+
self._display.guiRenderer.sendEvent('mouseUp', objectId, [x, y])
|
|
720
|
+
if is_click and (objectId, 'mouseClick') in registered:
|
|
721
|
+
self._display.guiRenderer.sendEvent('mouseClick', objectId, [x, y])
|
|
722
|
+
|
|
683
723
|
self._sendDisplay('mouseUp', [x, y])
|
|
684
|
-
if
|
|
685
|
-
|
|
686
|
-
dx = abs(pos.x() - self._pressPos.x())
|
|
687
|
-
dy = abs(pos.y() - self._pressPos.y())
|
|
688
|
-
if dx <= _QtGraphicsItemEventMixin._CLICK_THRESHOLD and dy <= _QtGraphicsItemEventMixin._CLICK_THRESHOLD:
|
|
689
|
-
self._sendDisplay('mouseClick', [x, y])
|
|
724
|
+
if is_click:
|
|
725
|
+
self._sendDisplay('mouseClick', [x, y])
|
|
690
726
|
self._pressPos = None
|
|
691
727
|
self._draggingItems = []
|
|
728
|
+
self._pressedItems = []
|
|
692
729
|
|
|
693
730
|
def mouseMoveEvent(self, event):
|
|
694
731
|
x, y = self._sceneXY(event)
|
|
@@ -1674,15 +1711,12 @@ class _DrawableMirror:
|
|
|
1674
1711
|
self._rotation = 0
|
|
1675
1712
|
self._toolTipText = None
|
|
1676
1713
|
|
|
1677
|
-
# GuiRenderer only handles commands that alter an object visually
|
|
1678
|
-
#
|
|
1714
|
+
# GuiRenderer only handles commands that alter an object visually.
|
|
1715
|
+
# Hit testing (contains/intersects/encloses) is handled entirely in gui.py.
|
|
1679
1716
|
self._commandHandlers = {
|
|
1680
1717
|
'setPosition': self._setPosition,
|
|
1681
1718
|
'setSize': self._setSize,
|
|
1682
1719
|
'setRotation': self._setRotation,
|
|
1683
|
-
'contains': self._contains,
|
|
1684
|
-
'intersects': self._intersects,
|
|
1685
|
-
'encloses': self._encloses,
|
|
1686
1720
|
'setToolTipText': self._setToolTipText,
|
|
1687
1721
|
'show': self._show,
|
|
1688
1722
|
'hide': self._hide,
|
|
@@ -1745,43 +1779,6 @@ class _DrawableMirror:
|
|
|
1745
1779
|
self.qObject.prepareGeometryChange()
|
|
1746
1780
|
self.qObject.setRotation(qtDegree)
|
|
1747
1781
|
|
|
1748
|
-
# ── Hit testing ────────────────────────────────────────────────────────────
|
|
1749
|
-
|
|
1750
|
-
def _contains(self, args, responseId):
|
|
1751
|
-
"""Returns True if the point (x, y) is inside this item."""
|
|
1752
|
-
x = args.get('x', 0)
|
|
1753
|
-
y = args.get('y', 0)
|
|
1754
|
-
globalPoint = QtCore.QPointF(x, y)
|
|
1755
|
-
localPoint = self.qObject.mapFromScene(globalPoint)
|
|
1756
|
-
result = self.qObject.contains(localPoint)
|
|
1757
|
-
self.guiRenderer.sendResponse(responseId, [result])
|
|
1758
|
-
|
|
1759
|
-
def _intersects(self, args, responseId):
|
|
1760
|
-
"""Returns True if this item intersects another item."""
|
|
1761
|
-
otherObjectId = args.get('otherObjectId')
|
|
1762
|
-
otherMirror = self.guiRenderer._objectRegistry.get(otherObjectId)
|
|
1763
|
-
result = False
|
|
1764
|
-
|
|
1765
|
-
if otherMirror is not None:
|
|
1766
|
-
pathA = self.qObject.mapToScene(self.qObject.shape())
|
|
1767
|
-
pathB = otherMirror.qObject.mapToScene(otherMirror.qObject.shape())
|
|
1768
|
-
result = pathA.intersects(pathB)
|
|
1769
|
-
|
|
1770
|
-
self.guiRenderer.sendResponse(responseId, [result])
|
|
1771
|
-
|
|
1772
|
-
def _encloses(self, args, responseId):
|
|
1773
|
-
"""Returns True if this item fully encloses another item."""
|
|
1774
|
-
otherObjectId = args.get('otherObjectId')
|
|
1775
|
-
otherMirror = self.guiRenderer._objectRegistry.get(otherObjectId)
|
|
1776
|
-
result = False
|
|
1777
|
-
|
|
1778
|
-
if otherMirror is not None:
|
|
1779
|
-
pathA = self.qObject.mapToScene(self.qObject.shape())
|
|
1780
|
-
pathB = otherMirror.qObject.mapToScene(otherMirror.qObject.shape())
|
|
1781
|
-
result = pathA.contains(pathB)
|
|
1782
|
-
|
|
1783
|
-
self.guiRenderer.sendResponse(responseId, [result])
|
|
1784
|
-
|
|
1785
1782
|
# ── Visibility ─────────────────────────────────────────────────────────────
|
|
1786
1783
|
|
|
1787
1784
|
def _show(self, args, responseId):
|
|
@@ -2391,6 +2388,7 @@ class PolygonMirror(_GraphicsMirror):
|
|
|
2391
2388
|
# IconMirror — mirror of gui.py's Icon
|
|
2392
2389
|
#######################################################################################
|
|
2393
2390
|
|
|
2391
|
+
|
|
2394
2392
|
class IconMirror(_GraphicsMirror):
|
|
2395
2393
|
"""
|
|
2396
2394
|
Mirror of gui.py's Icon. Backed by a QGraphicsPixmapItem.
|
|
@@ -2460,16 +2458,25 @@ class IconMirror(_GraphicsMirror):
|
|
|
2460
2458
|
'getPixels': self._getPixels,
|
|
2461
2459
|
'setPixels': self._setPixels,
|
|
2462
2460
|
'write': self._write,
|
|
2461
|
+
'setAlpha': self._setAlpha,
|
|
2463
2462
|
})
|
|
2464
2463
|
|
|
2465
2464
|
def _applyColor(self):
|
|
2466
|
-
|
|
2467
|
-
|
|
2465
|
+
r, g, b, a = self._color
|
|
2466
|
+
if [r, g, b, a] == [0, 0, 0, 0]:
|
|
2467
|
+
self.qObject._colorFilter = None
|
|
2468
|
+
else:
|
|
2469
|
+
self.qObject._colorFilter = (r, g, b, a)
|
|
2470
|
+
self.qObject.update()
|
|
2468
2471
|
|
|
2469
2472
|
def _applyThickness(self):
|
|
2470
2473
|
"""No-op — QGraphicsPixmapItem has no pen or brush."""
|
|
2471
2474
|
pass
|
|
2472
2475
|
|
|
2476
|
+
def _setAlpha(self, args, responseId):
|
|
2477
|
+
alpha = args.get('alpha', 255)
|
|
2478
|
+
self.qObject.setOpacity(alpha / 255.0)
|
|
2479
|
+
|
|
2473
2480
|
# ── Size ───────────────────────────────────────────────────────────────────
|
|
2474
2481
|
|
|
2475
2482
|
def _getSize(self, args, responseId):
|
|
@@ -2908,8 +2915,7 @@ class _ControlMirror(_DrawableMirror):
|
|
|
2908
2915
|
- dimensions: setRect(), setPath(), etc. -> setFixedSize()
|
|
2909
2916
|
- color: [r, g, b] -> stylesheets
|
|
2910
2917
|
|
|
2911
|
-
Controls
|
|
2912
|
-
handle their own input directly.
|
|
2918
|
+
Controls handle their own input directly via Qt's widget event system.
|
|
2913
2919
|
|
|
2914
2920
|
Concrete classes must:
|
|
2915
2921
|
1. Call super().__init__(objectId, guiRenderer, args) first.
|
|
@@ -2950,48 +2956,6 @@ class _ControlMirror(_DrawableMirror):
|
|
|
2950
2956
|
def _setRotation(self, args, responseId):
|
|
2951
2957
|
pass # Controls cannot be rotated; gui.py warns at the call site
|
|
2952
2958
|
|
|
2953
|
-
# ── Hit testing ────────────────────────────────────────────────────────────
|
|
2954
|
-
|
|
2955
|
-
def _contains(self, args, responseId):
|
|
2956
|
-
"""Returns True if the point (x, y) is inside this widget's bounding box."""
|
|
2957
|
-
x = args.get('x', 0)
|
|
2958
|
-
y = args.get('y', 0)
|
|
2959
|
-
rect = QtCore.QRectF(self.qObject.geometry())
|
|
2960
|
-
result = rect.contains(QtCore.QPointF(x, y))
|
|
2961
|
-
self.guiRenderer.sendResponse(responseId, [result])
|
|
2962
|
-
|
|
2963
|
-
def _intersects(self, args, responseId):
|
|
2964
|
-
"""Returns True if this widget's bounding box intersects another item."""
|
|
2965
|
-
otherObjectId = args.get('otherObjectId')
|
|
2966
|
-
otherMirror = self.guiRenderer._objectRegistry.get(otherObjectId)
|
|
2967
|
-
result = False
|
|
2968
|
-
|
|
2969
|
-
if otherMirror is not None:
|
|
2970
|
-
rectA = QtCore.QRectF(self.qObject.geometry())
|
|
2971
|
-
if isinstance(otherMirror, _ControlMirror):
|
|
2972
|
-
rectB = QtCore.QRectF(otherMirror.qObject.geometry())
|
|
2973
|
-
else:
|
|
2974
|
-
rectB = otherMirror.qObject.sceneBoundingRect()
|
|
2975
|
-
result = rectA.intersects(rectB)
|
|
2976
|
-
|
|
2977
|
-
self.guiRenderer.sendResponse(responseId, [result])
|
|
2978
|
-
|
|
2979
|
-
def _encloses(self, args, responseId):
|
|
2980
|
-
"""Returns True if this widget's bounding box fully encloses another item."""
|
|
2981
|
-
otherObjectId = args.get('otherObjectId')
|
|
2982
|
-
otherMirror = self.guiRenderer._objectRegistry.get(otherObjectId)
|
|
2983
|
-
result = False
|
|
2984
|
-
|
|
2985
|
-
if otherMirror is not None:
|
|
2986
|
-
rectA = QtCore.QRectF(self.qObject.geometry())
|
|
2987
|
-
if isinstance(otherMirror, _ControlMirror):
|
|
2988
|
-
rectB = QtCore.QRectF(otherMirror.qObject.geometry())
|
|
2989
|
-
else:
|
|
2990
|
-
rectB = otherMirror.qObject.sceneBoundingRect()
|
|
2991
|
-
result = rectA.contains(rectB)
|
|
2992
|
-
|
|
2993
|
-
self.guiRenderer.sendResponse(responseId, [result])
|
|
2994
|
-
|
|
2995
2959
|
# ── Size ───────────────────────────────────────────────────────────────────
|
|
2996
2960
|
|
|
2997
2961
|
def _getSize(self, args, responseId):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: CreativePython
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.6
|
|
4
4
|
Summary: A Python-based software environment for developing algorithmic art projects.
|
|
5
5
|
Author-email: "Dr. Bill Manaris" <manaris@cofc.edu>, Taj Ballinger <ballingertj@g.cofc.edu>, Trevor Ritchie <ritchiets@g.cofc.edu>
|
|
6
6
|
License: MIT License
|
|
@@ -88,7 +88,11 @@ src/CreativePython/nevmuse/utilities/PowerLawRandom.py
|
|
|
88
88
|
src/CreativePython/nevmuse/utilities/__init__.py
|
|
89
89
|
src/bin/libportaudio.2.dylib
|
|
90
90
|
tests/testAnimate.py
|
|
91
|
+
tests/testCompress.py
|
|
92
|
+
tests/testGameboard.py
|
|
91
93
|
tests/testHitTesting.py
|
|
92
94
|
tests/testPeer.py
|
|
93
95
|
tests/testToolTips.py
|
|
94
|
-
tests/test_keyEvent.py
|
|
96
|
+
tests/test_keyEvent.py
|
|
97
|
+
tests/test_midi.py
|
|
98
|
+
tests/test_osc.py
|