diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index fefb727..49b85b4 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -24,9 +24,9 @@ jobs: env: DISPLAY: ':99.0' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Set up Python 3.12 - uses: actions/setup-python@v3 + uses: actions/setup-python@v6 with: python-version: "3.12" - name: Install system dependencies diff --git a/.gitignore b/.gitignore index 68c7fcb..5f7cabb 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ prof/ .env/ .vscode/ tests/data/config/log/ -tests/data/config/presets/ tests/data/config/settings.ini tests/data/config/autosave.avp *.mkv diff --git a/README.md b/README.md index 8efdf5d..fabec2c 100644 --- a/README.md +++ b/README.md @@ -113,19 +113,20 @@ python3 -m avp | Ctrl+A | Save Project As... | | Ctrl+O | Open Project | | Ctrl+N | New Project (prompts to save current project) | +| F2 | Open Projects Menu | +| F3 | Open Preset Manager | +| F4 | Open Undo History | | Ctrl+Z | Undo | | Ctrl+Shift+Z _or_ Ctrl+Y | Redo | | Ctrl+T _or_ Insert | Add Component | -| Ctrl+R _or_ Delete | Remove Component | +| Ctrl+W _or_ Delete | Remove Component | | Ctrl+Space | Focus Component List | -| Ctrl+Shift+S | Save Component Preset | -| Ctrl+Shift+C | Remove Preset from Component | +| Ctrl+Shift+S | Save Preset for Selected Component | +| Ctrl+Shift+C | Remove Preset from Selected Component | | Ctrl+Up | Move Selected Component Up | | Ctrl+Down | Move Selected Component Down | | Ctrl+Home | Move Selected Component to Top | | Ctrl+End | Move Selected Component to Bottom | -| Ctrl+Shift+U | Open Undo History | -| Ctrl+Shift+F | Show FFmpeg Command | ## Using Commandline Interface @@ -147,24 +148,22 @@ Projects can be created with the GUI then loaded from the commandline for easy a - Pillow 12.1.0 - NumPy 2.4.1 +### Developing a New Component + +- Information for developing a component is in our wiki: [How a Component Works](https://github.com/djfun/audio-visualizer-python/wiki/How-a-Component-Works) +- File an issue on GitHub if you need help fitting your visualizer into our component system; we would be happy to collaborate + ### Running Automatic Tests + Run unit and integration tests with `pytest`. - * First you will need to install with `pip install pytest pytest-qt` * You may omit the slowest test with `pytest -k "not commandline_export"` + * You may use [pytest-xdist](https://pypi.org/project/pytest-xdist/) for speedier test execution ### Installing from TestPyPI + Because some dependencies (namely numpy) are not always on TestPyPI, you must specify when installing that these dependencies should come from the real PyPI. * `pip install -i https://test.pypi.org/simple/ audio-visualizer-python==x.x.x --extra-index-url https://pypi.org/simple numpy` -### Getting Faster Export Times - -- [Pillow-SIMD](https://github.com/uploadcare/pillow-simd) may be used as a drop-in replacement for Pillow if you desire faster video export times, but it must be compiled from source. For help installing dependencies to compile Pillow-SIMD, see the [Pillow installation guide](https://pillow.readthedocs.io/en/stable/installation/building-from-source.html). - -### Developing a New Component - -- Information for developing a component is in our wiki: [How a Component Works](https://github.com/djfun/audio-visualizer-python/wiki/How-a-Component-Works) -- File an issue on GitHub if you need help fitting your visualizer into our component system; we would be happy to collaborate - ## License Source code of audio-visualizer-python is licensed under the MIT license. diff --git a/pyproject.toml b/pyproject.toml index b02fca5..862f355 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,17 @@ [build-system] -requires = ["uv_build>=0.9.23,<0.10.0"] +requires = ["uv_build>=0.9.23,<=0.11.16"] build-backend = "uv_build" [project] name = "audio-visualizer-python" description = "Create audio visualization videos from a GUI or commandline" readme = "README.md" -version = "2.2.4" +version = "2.3.0" requires-python = ">= 3.12" license = "MIT" license-files = ["LICENSE", "AUTHORS"] classifiers=[ "Development Status :: 5 - Production/Stable", - "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3 :: Only", "Intended Audience :: End Users/Desktop", "Topic :: Multimedia :: Video", @@ -36,7 +35,7 @@ maintainers = [ ] dependencies = [ "numpy>=2.4.1", - "pillow>=12.1.0", + "pillow>=13.0.0", "pyqt6>=6.10.2", ] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9942cd5..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -numpy==2.4.1 -pillow==12.1.0 -PyQt6==6.10.2 -PyQt6-Qt6==6.10.1 -PyQt6_sip==13.11.0 diff --git a/src/avp/__init__.py b/src/avp/__init__.py index 184afda..fa49a9c 100644 --- a/src/avp/__init__.py +++ b/src/avp/__init__.py @@ -1,34 +1,8 @@ import sys import os -import logging -__version__ = "2.2.4" - - -class Logger(logging.getLoggerClass()): - """ - Custom Logger class to handle custom VERBOSE log level. - Levels used in this program are as follows: - VERBOSE Annoyingly frequent debug messages (e.g, in loops) - DEBUG Ordinary debug information - INFO Expected events that are expensive or irreversible - WARNING A non-fatal error or suspicious behaviour - ERROR Any error that would interrupt the user - CRITICAL Things that really shouldn't happen at all - """ - - def __init__(self, name, level=logging.NOTSET): - super().__init__(name, level) - logging.addLevelName(5, "VERBOSE") - - def verbose(self, msg, *args, **kwargs): - if self.isEnabledFor(5): - self._log(5, msg, args, **kwargs) - - -logging.setLoggerClass(Logger) -logging.VERBOSE = 5 +__version__ = "2.3.0" if getattr(sys, "frozen", False): diff --git a/src/avp/__main__.py b/src/avp/__main__.py index a27bb88..124b82c 100644 --- a/src/avp/__main__.py +++ b/src/avp/__main__.py @@ -1,5 +1,6 @@ import sys -from avp.cli import main +from .cli import main + if __name__ == "__main__": if sys.argv[0].endswith("-script.pyw"): sys.argv[0] = sys.argv[0][:-11] diff --git a/src/avp/cli.py b/src/avp/cli.py index 7d58fe1..ebb795d 100644 --- a/src/avp/cli.py +++ b/src/avp/cli.py @@ -10,7 +10,7 @@ # Core class must store settings as class variables # before we can use many things in AVP Core.storeSettings() -log = logging.getLogger("AVP.Main") +log = logging.getLogger(__name__) def main() -> int: @@ -56,11 +56,11 @@ def main() -> int: # Both branches here may occur in one execution: # Commandline parsing could change mode back to GUI if mode == "GUI": - from avp.gui.mainwindow import MainWindow + from .gui.mainwindow import MainWindow - mainWindow = MainWindow(proj, dpi) + main = MainWindow(proj, dpi) log.debug("Finished creating MainWindow") - mainWindow.raise_() + main.raise_() return app.exec() diff --git a/src/avp/command.py b/src/avp/command.py index b6700a5..73365d1 100644 --- a/src/avp/command.py +++ b/src/avp/command.py @@ -18,7 +18,7 @@ from .core import Core -log = logging.getLogger("AVP.Commandline") +log = logging.getLogger(__name__) class Command(QtCore.QObject): @@ -53,15 +53,24 @@ def parseArgs(self): "--version", "-V", action="version", version=f"%(prog)s {__version__}" ) + parser.add_argument( + "--size", + "-s", + help="set output frame size (resolution)", + choices=Core.resolutions, + ) + # input/output automatic-export commands - parser.add_argument("-i", "--input", metavar="SOUND", help="input audio file") parser.add_argument( - "-o", "--output", metavar="OUTPUT", help="output video file" + "-i", "--input", metavar="", help="input audio filename" + ) + parser.add_argument( + "-o", "--output", metavar="", help="output video's filename" ) parser.add_argument( "--export-project", action="store_true", - help="use input and output files from project file if -i or -o is missing", + help="use input and output filenames from project file if -i or -o is missing", ) # mutually exclusive debug options @@ -74,8 +83,9 @@ def parseArgs(self): debugCommands.add_argument( "--verbose", "-v", - action="store_true", - help="send log messages and ffmpeg output to stdout, and create more verbose log files (good to use before --log)", + action="count", + default=0, + help="send log messages and FFmpeg output to stdout, and create more verbose log files (good to use before --log)", ) # project/GUI options @@ -88,9 +98,11 @@ def parseArgs(self): parser.add_argument( "-c", "--comp", - metavar=("LAYER", "ARG"), - help="first arg must be component NAME to insert at LAYER." - '"help" for information about possible args for a component.', + metavar=("", ""), + help="Insert component at (a number from -1 to 50, " + "where 0 is rendered below 50 and -1 is always on top). " + "First argument must be the name of a component. More arguments configure the component. " + "(For example, use '-c 0 classic help' for help with Classic Visualizer component.)", nargs="*", action="append", ) @@ -102,8 +114,8 @@ def parseArgs(self): args = parser.parse_args() - if args.verbose: - Core.stdoutLogLvl = logging.DEBUG + if args.verbose > 0: + Core.stdoutLogLvl -= 10 * args.verbose Core.makeLogger(deleteOldLogs=False, fileLogLvl=logging.DEBUG) if args.log: @@ -142,6 +154,14 @@ def parseArgs(self): for arg in compargs: self.core.selectedComponents[i].command(arg) + if args.size: + print("Setting output size to %s" % args.size) + w, h = args.size.split("x") + self.core.settings.setValue("outputWidth", w) + self.core.settings.setValue("outputHeight", h) + for i in range(len(self.core.selectedComponents)): + self.core.selectedComponents[i].updateResolution() + if args.export_project and args.projpath: errcode, data = self.core.parseAvFile(projPath) input_ = None @@ -177,6 +197,7 @@ def parseArgs(self): and "help" not in sys.argv and "--verbose" not in sys.argv and "-v" not in sys.argv + and "-vv" not in sys.argv and "--log" not in sys.argv ): parser.print_help() @@ -195,7 +216,9 @@ def createAudioVisualization(self, input, output): # quit(0) after video is created self.worker.videoCreated.connect(self.videoCreated) self.lastProgressUpdate = time.time() + self.lastEstimatedTimeUpdate = time.time() self.worker.progressBarSetText.connect(self.progressBarSetText) + self.worker.estimatedTimeUpdate.connect(self.estimatedTimeUpdate) self.createVideo.emit() def stopVideo(self, *args): @@ -203,6 +226,13 @@ def stopVideo(self, *args): self.worker.cancelExport() self.worker.cancel() + @QtCore.pyqtSlot(str) + def estimatedTimeUpdate(self, value): + if time.time() - self.lastEstimatedTimeUpdate < 5.0: + return + print(value) + self.lastEstimatedTimeUpdate = time.time() + @QtCore.pyqtSlot(str) def progressBarSetText(self, value): if "Export " in value or time.time() - self.lastProgressUpdate < 0.1: diff --git a/src/avp/components/__template__.ui b/src/avp/components/__template__.ui index 301a2b7..ee2fe84 100644 --- a/src/avp/components/__template__.ui +++ b/src/avp/components/__template__.ui @@ -19,7 +19,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -36,7 +36,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -53,7 +53,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -70,7 +70,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -87,7 +87,7 @@ - Qt::Horizontal + Qt::Orientation::Horizontal @@ -102,7 +102,7 @@ - Qt::Vertical + Qt::Orientation::Vertical diff --git a/src/avp/components/color.py b/src/avp/components/color.py index 826f37f..1fd8573 100644 --- a/src/avp/components/color.py +++ b/src/avp/components/color.py @@ -5,7 +5,7 @@ from ..toolkit.frame import BlankFrame, FloodFrame, FramePainter -log = logging.getLogger("AVP.Components.Color") +log = logging.getLogger(__name__) class Component(BaseComponent): @@ -20,8 +20,8 @@ def widget(self, *args): # disable color #2 until non-default 'fill' option gets changed self.page.lineEdit_color2.setDisabled(True) self.page.pushButton_color2.setDisabled(True) - self.page.spinBox_width.setValue(int(self.settings.value("outputWidth"))) - self.page.spinBox_height.setValue(int(self.settings.value("outputHeight"))) + self.page.spinBox_width.setValue(int(self.core.settings.value("outputWidth"))) + self.page.spinBox_height.setValue(int(self.core.settings.value("outputHeight"))) self.fillLabels = [ "Solid", diff --git a/src/avp/components/image.py b/src/avp/components/image.py index a082092..7a2a021 100644 --- a/src/avp/components/image.py +++ b/src/avp/components/image.py @@ -1,15 +1,18 @@ from PIL import Image, ImageOps, ImageEnhance -from PyQt6 import QtWidgets +from PyQt6 import QtWidgets, QtCore import os +import math from ..libcomponent import BaseComponent +from ..libcomponent.actions import ComponentCenterXYAction, ComponentPreviewXYClick +from ..toolkit import hasUndoStack, blockSignals from ..toolkit.frame import BlankFrame, addShadow from ..toolkit.visualizer import createSpectrumArray class Component(BaseComponent): name = "Image" - version = "2.1.0" + version = "2.2.0" def widget(self, *args): super().widget(*args) @@ -17,7 +20,11 @@ def widget(self, *args): # cache a modified image object in case we are rendering beyond frame 1 self.existingImage = None + # cache image size for reference when centering the image + self.imageSize = (0, 0) + self.page.pushButton_image.clicked.connect(self.pickImage) + self.page.pushButton_centerImage.clicked.connect(self.addCenterAction) self.page.comboBox_resizeMode.addItem("Scale") self.page.comboBox_resizeMode.addItem("Cover") self.page.comboBox_resizeMode.addItem("Stretch") @@ -35,13 +42,23 @@ def widget(self, *args): "respondToAudio": self.page.checkBox_respondToAudio, "sensitivity": self.page.spinBox_sensitivity, "shadow": self.page.checkBox_shadow, + "shadX": self.page.spinBox_shadX, + "shadY": self.page.spinBox_shadY, + "shadBlur": self.page.spinBox_shadBlur, }, presetNames={ "imagePath": "image", "xPosition": "x", "yPosition": "y", }, - relativeWidgets=["xPosition", "yPosition", "scale"], + relativeWidgets=[ + "xPosition", + "yPosition", + "scale", + "shadX", + "shadY", + "shadBlur", + ], ) def update(self): @@ -51,6 +68,61 @@ def update(self): self.page.spinBox_scale.setEnabled( self.page.comboBox_resizeMode.currentIndex() == 0 ) + if self.page.checkBox_shadow.isChecked(): + self.page.label_shadOffset.setHidden(False) + self.page.spinBox_shadX.setHidden(False) + self.page.spinBox_shadY.setHidden(False) + self.page.label_shadBlur.setHidden(False) + self.page.spinBox_shadBlur.setHidden(False) + else: + self.page.label_shadOffset.setHidden(True) + self.page.spinBox_shadX.setHidden(True) + self.page.spinBox_shadY.setHidden(True) + self.page.label_shadBlur.setHidden(True) + self.page.spinBox_shadBlur.setHidden(True) + + def previewClickEvent(self, pos, size, button): + if ( + not hasUndoStack(self.loader) + or self.imageSize == (0, 0) + or button != QtCore.Qt.MouseButton.LeftButton + ): + return + xSize = math.floor( + self.pixelValForAttr(None, self.imageSize[0] / self.width, axis=size[0]) / 2 + ) + ySize = math.floor( + self.pixelValForAttr(None, self.imageSize[1] / self.height, axis=size[1]) + / 2 + ) + action = ComponentPreviewXYClick( + self, (pos[0] - xSize, pos[1] - ySize), size, button + ) + self.loader.undoStack.push(action) + + def addCenterAction(self): + """Triggered when user clicks "center image" button.""" + if not hasUndoStack(self.loader) or self.imageSize == (0, 0): + return + action = ComponentCenterXYAction(self) + self.loader.undoStack.push(action) + + def centerXY(self): + with blockSignals(self): + self.setRelativeWidget( + "xPosition", + 0.5 + - self.floatValForAttr( + "xPosition", self.imageSize[0] / 2, (self.width, self.height) + ), + ) + self.setRelativeWidget( + "yPosition", + 0.5 + - self.floatValForAttr( + "yPosition", self.imageSize[1] / 2, (self.width, self.height) + ), + ) def previewRender(self): return self.drawFrame(self.width, self.height, None) @@ -121,13 +193,18 @@ def drawFrame(self, width, height, dynamicScale): image = image.resize( (newWidth, newHeight), Image.Resampling.LANCZOS ) + if self.rotate != 0: + image = image.rotate(self.rotate) self.existingImage = image + self.imageSize = (image.width, image.height) - # Respond to audio + # Shadow-related variables (modified below if "respond to audio") resolutionFactor = height / 1080 - shadX = int(resolutionFactor * 1) - shadY = int(resolutionFactor * -1) - shadBlur = resolutionFactor * 3.50 + shadX = int(resolutionFactor * self.shadX) + shadY = int(resolutionFactor * self.shadY) + shadBlur = resolutionFactor * (self.shadBlur / 10) + + # Respond to audio scale = 0 if dynamicScale is not None: scale = dynamicScale[36 * 4] / 4 @@ -151,18 +228,17 @@ def drawFrame(self, width, height, dynamicScale): self.yPosition - (0 if not self.respondToAudio else int(scale / 2)), ), ) - if self.rotate != 0: - frame = frame.rotate(self.rotate) if self.shadow: frame = addShadow(frame, shadBlur, shadX, shadY) - + else: + self.imageSize = (0, 0) return frame def postFrameRender(self): self.existingImage = None def pickImage(self): - imgDir = self.settings.value("componentDir", os.path.expanduser("~")) + imgDir = self.core.settings.value("componentDir", os.path.expanduser("~")) filename, _ = QtWidgets.QFileDialog.getOpenFileName( self.page, "Choose Image", @@ -170,7 +246,7 @@ def pickImage(self): "Image Files (%s)" % " ".join(self.core.imageFormats), ) if filename: - self.settings.setValue("componentDir", os.path.dirname(filename)) + self.core.settings.setValue("componentDir", os.path.dirname(filename)) self.mergeUndo = False self.page.lineEdit_image.setText(filename) self.mergeUndo = True diff --git a/src/avp/components/image.ui b/src/avp/components/image.ui index b53c4b0..6b8d68b 100644 --- a/src/avp/components/image.ui +++ b/src/avp/components/image.ui @@ -98,7 +98,7 @@ - + 0 @@ -133,7 +133,7 @@ - + 0 @@ -194,13 +194,52 @@ - + + + + 0 + 0 + + + + + + + + Qt::Orientation::Horizontal + + + QSizePolicy::Policy::Minimum + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Center Image + + Qt::Orientation::Horizontal + + QSizePolicy::Policy::Minimum + 40 @@ -294,30 +333,7 @@ - - - Qt::Orientation::Horizontal - - - - 40 - 20 - - - - - - - - Qt::LayoutDirection::RightToLeft - - - Shadow - - - - - + 0 @@ -354,12 +370,8 @@ - - - - - + Qt::Orientation::Horizontal @@ -373,6 +385,12 @@ + + + 0 + 0 + + Scale image in response to input audio file @@ -412,6 +430,110 @@ + + + + QLayout::SizeConstraint::SetFixedSize + + + + + + 0 + 0 + + + + Qt::LayoutDirection::LeftToRight + + + Shadow + + + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Shadow Offset + + + + + + + + 0 + 0 + + + + + + + + + + -1000 + + + 1000 + + + 1 + + + + + + + -1000 + + + 1000 + + + -1 + + + + + + + Shadow Blur + + + + + + + 35 + + + 10 + + + + + @@ -419,6 +541,9 @@ Qt::Orientation::Vertical + + QSizePolicy::Policy::Preferred + 20 diff --git a/src/avp/components/life.py b/src/avp/components/life.py index 374b299..d065608 100644 --- a/src/avp/components/life.py +++ b/src/avp/components/life.py @@ -7,11 +7,13 @@ from ..libcomponent import BaseComponent +from ..libcomponent.actions import ComponentPreviewClick +from ..toolkit import hasUndoStack from ..toolkit.frame import BlankFrame, scale, addShadow from ..toolkit.visualizer import createSpectrumArray -log = logging.getLogger("AVP.Component.Life") +log = logging.getLogger(__name__) class Component(BaseComponent): @@ -90,7 +92,7 @@ def shift(): self.page.spinBox_scale.valueChanged.connect(self.updateGridSize) def pickImage(self): - imgDir = self.settings.value("componentDir", os.path.expanduser("~")) + imgDir = self.core.settings.value("componentDir", os.path.expanduser("~")) filename, _ = QtWidgets.QFileDialog.getOpenFileName( self.page, "Choose Image", @@ -98,14 +100,18 @@ def pickImage(self): "Image Files (%s)" % " ".join(self.core.imageFormats), ) if filename: - self.settings.setValue("componentDir", os.path.dirname(filename)) + self.core.settings.setValue("componentDir", os.path.dirname(filename)) self.mergeUndo = False self.page.lineEdit_image.setText(filename) self.mergeUndo = True def shiftGrid(self, d): action = ShiftGrid(self, d) - self.parent.undoStack.push(action) + self.loader.undoStack.push(action) + + def updateResolution(self): + super().updateResolution() + self.updateGridSize() def update(self): self.updateGridSize() @@ -145,12 +151,14 @@ def update(self): widget.setEnabled(enabled) def previewClickEvent(self, pos, size, button): + if not hasUndoStack(self.loader): + return pos = ( math.ceil((pos[0] / size[0]) * self.gridWidth) - 1, math.ceil((pos[1] / size[1]) * self.gridHeight) - 1, ) - action = ClickGrid(self, pos, button) - self.parent.undoStack.push(action) + action = ClickGrid(self, pos, size, button) + self.loader.undoStack.push(action) def updateGridSize(self): w, h = self.core.resolutions[-1].split("x") @@ -549,6 +557,7 @@ def loadPreset(self, pr, *args): for widget in self.shiftButtons: widget.setEnabled(True) super().loadPreset(pr, *args) + self.updateGridSize() def nearbyCoords(self, x, y): yield x + 1, y + 1 @@ -561,23 +570,7 @@ def nearbyCoords(self, x, y): yield x - 1, y -class ClickGrid(QUndoCommand): - def __init__(self, comp, pos, button): - super().__init__("click %s component #%s" % (comp.name, comp.compPos)) - self.comp = comp - self.pos = [pos] - if button == QtCore.Qt.MouseButton.RightButton: - self.button = 2 - else: - self.button = 1 - - def id(self): - return self.button - - def mergeWith(self, other): - self.pos.extend(other.pos) - return True - +class ClickGrid(ComponentPreviewClick): def add(self): for pos in self.pos[:]: self.comp.startingGrid.add(pos) @@ -588,22 +581,14 @@ def remove(self): self.comp.startingGrid.discard(pos) self.comp.update(auto=True) - def redo(self): - if self.button == 1: # Left-click - self.add() - elif self.button == 2: # Right-click - self.remove() - - def undo(self): - if self.button == 1: # Left-click - self.remove() - elif self.button == 2: # Right-click - self.add() - class ShiftGrid(QUndoCommand): def __init__(self, comp, direction): - super().__init__("change %s component #%s" % (comp.name, comp.compPos)) + dirName = {0: "up", 1: "down", 2: "left", 3: "right"} + super().__init__( + "shift %s component #%s grid %s" + % (comp.name, comp.compPos, dirName[direction]) + ) self.comp = comp self.direction = direction self.distance = 1 diff --git a/src/avp/components/sound.py b/src/avp/components/sound.py index c212870..6f8f72f 100644 --- a/src/avp/components/sound.py +++ b/src/avp/components/sound.py @@ -48,7 +48,7 @@ def audio(self): return (self.sound, params) def pickSound(self): - sndDir = self.settings.value("componentDir", os.path.expanduser("~")) + sndDir = self.core.settings.value("componentDir", os.path.expanduser("~")) filename, _ = QtWidgets.QFileDialog.getOpenFileName( self.page, "Choose Sound", @@ -56,7 +56,7 @@ def pickSound(self): "Audio Files (%s)" % " ".join(self.core.audioFormats), ) if filename: - self.settings.setValue("componentDir", os.path.dirname(filename)) + self.core.settings.setValue("componentDir", os.path.dirname(filename)) self.mergeUndo = False self.page.lineEdit_sound.setText(filename) self.mergeUndo = True diff --git a/src/avp/components/spectrum.py b/src/avp/components/spectrum.py index 0446865..589deba 100644 --- a/src/avp/components/spectrum.py +++ b/src/avp/components/spectrum.py @@ -1,11 +1,12 @@ -from PIL import Image +from PIL import Image, ImageOps import os import subprocess import logging +from ..core import Core from ..libcomponent import BaseComponent -from ..toolkit.frame import BlankFrame, scale from ..toolkit import connectWidget +from ..toolkit.frame import BlankFrame, scale from ..toolkit.ffmpeg import ( openPipe, closePipe, @@ -15,7 +16,7 @@ ) -log = logging.getLogger("AVP.Components.Spectrum") +log = logging.getLogger(__name__) class Component(BaseComponent): @@ -27,13 +28,14 @@ def widget(self, *args): super().widget(*args) self._image = BlankFrame(self.width, self.height) self.chunkSize = 4 * self.width * self.height + self.previewFrame = {resolution: None for resolution in Core.resolutions} self.changedOptions = True self.previewSize = (214, 120) self.previewPipe = None - if hasattr(self.parent, "lineEdit_audioFile"): + if hasattr(self.loader, "lineEdit_audioFile"): # update preview when audio file changes (if genericPreview is off) - self.parent.lineEdit_audioFile.textChanged.connect(self.update) + self.loader.lineEdit_audioFile.textChanged.connect(self.update) self.trackWidgets( { @@ -66,6 +68,8 @@ def widget(self, *args): def changed(self): self.changedOptions = True + for key in self.previewFrame: + self.previewFrame[key] = None def update(self): filterType = self.page.comboBox_filterType.currentIndex() @@ -80,24 +84,46 @@ def update(self): self.page.checkBox_mono.setEnabled(True) def previewRender(self): + def reusePreviewFrame(): + log.debug("Spectrum #%s is reusing old preview frame", self.compPos) + return self.previewFrame[res] + + self.changedOptions = False + res = f"{self.width}x{self.height}" changedSize = self.updateChunksize() + if changedSize and not self.changedOptions: + if self.previewFrame[res] is not None: + return reusePreviewFrame() + if ( not changedSize and not self.changedOptions - and self.previewFrame is not None + and self.previewFrame[res] is not None ): - log.debug("Spectrum #%s is reusing old preview frame" % self.compPos) - return self.previewFrame + return reusePreviewFrame() + + if self.previewFrame[res] is None: + for frame_ in self.previewFrame.values(): + if frame_ is not None: + self.previewFrame[res] = ImageOps.fit( + frame_, + ( + self.width, + self.height, + ), + Image.Resampling.LANCZOS, + ) + log.debug( + "Spectrum #%s resized an existing preview frame instead of using FFmpeg.", + self.compPos, + ) + return self.previewFrame[res] frame = self.getPreviewFrame() - self.changedOptions = False - if not frame: - log.warning("Spectrum #%s failed to create a preview frame" % self.compPos) - self.previewFrame = None + if frame is None: return BlankFrame(self.width, self.height) - else: - self.previewFrame = frame - return frame + self.previewFrame[res] = frame + return frame def preFrameRender(self, **kwargs): super().preFrameRender(**kwargs) @@ -111,8 +137,8 @@ def preFrameRender(self, **kwargs): width=w, height=h, chunkSize=self.chunkSize, - frameRate=int(self.settings.value("outputFrameRate")), - parent=self.parent, + frameRate=int(self.core.settings.value("outputFrameRate")), + parent=self.loader, component=self, ) @@ -122,13 +148,13 @@ def frameRender(self, frameNo): return self.finalizeFrame(self.video.frame(frameNo)) def postFrameRender(self): - closePipe(self.video.pipe) + self.video.stop() def getPreviewFrame(self): - genericPreview = self.settings.value("pref_genericPreview") + genericPreview = self.core.settings.value("pref_genericPreview") startPt = 0 if not genericPreview: - inputFile = self.parent.lineEdit_audioFile.text() + inputFile = self.loader.lineEdit_audioFile.text() if not inputFile or not os.path.exists(inputFile): return duration = getAudioDuration(inputFile) @@ -141,7 +167,7 @@ def getPreviewFrame(self): "-thread_queue_size", "512", "-r", - str(self.settings.value("outputFrameRate")), + str(self.core.settings.value("outputFrameRate")), "-ss", "{0:.3f}".format(startPt), "-i", @@ -200,7 +226,7 @@ def makeFfmpegFilter(self, preview=False, startPt=0): def getFilterComplexCommand(): """Inner function that creates the final, complex part of the filter command""" nonlocal self - genericPreview = self.settings.value("pref_genericPreview") + genericPreview = self.core.settings.value("pref_genericPreview") def getFilterComplexCommandForType(): """Determine portion of filter command that changes depending on selected type""" @@ -249,7 +275,7 @@ def getFilterComplexCommandForType(): elif self.display == 4: display = "rlog" filter_ = ( - f'ahistogram=r={str(self.settings.value("outputFrameRate"))}:' + f'ahistogram=r={str(self.core.settings.value("outputFrameRate"))}:' f"s={w}x{h}:" "dmode=separate:" f"ascale={amplitude}:" @@ -274,7 +300,7 @@ def getFilterComplexCommandForType(): ) elif self.filterType == 3: # Musical Scale filter_ = ( - f'showcqt=r={str(self.settings.value("outputFrameRate"))}:' + f'showcqt=r={str(self.core.settings.value("outputFrameRate"))}:' f"s={w}x{h}:" "count=30:" "text=0:" @@ -284,7 +310,7 @@ def getFilterComplexCommandForType(): ) elif self.filterType == 4: # Phase filter_ = ( - f'aphasemeter=r={str(self.settings.value("outputFrameRate"))}:' + f'aphasemeter=r={str(self.core.settings.value("outputFrameRate"))}:' f"s={w}x{h}:" "video=1 [atrash][vtmp1]; " "[atrash] anullsink; " diff --git a/src/avp/components/text.py b/src/avp/components/text.py index d248772..2e51adf 100644 --- a/src/avp/components/text.py +++ b/src/avp/components/text.py @@ -3,14 +3,16 @@ import logging from ..libcomponent import BaseComponent +from ..libcomponent.actions import ComponentCenterXYAction, ComponentPreviewXYClick +from ..toolkit import hasUndoStack, blockSignals from ..toolkit.frame import FramePainter, addShadow -log = logging.getLogger("AVP.Components.Text") +log = logging.getLogger(__name__) class Component(BaseComponent): name = "Title Text" - version = "1.0.1" + version = "1.1.0" def widget(self, *args): super().widget(*args) @@ -24,7 +26,7 @@ def widget(self, *args): self.page.comboBox_textAlign.addItem("Right") self.page.comboBox_textAlign.setCurrentIndex(int(self.alignment)) self.page.spinBox_fontSize.setValue(int(self.fontSize)) - self.page.pushButton_center.clicked.connect(self.centerXY) + self.page.pushButton_center.clicked.connect(self.addCenterAction) self.page.fontComboBox_titleFont.currentFontChanged.connect( self._sendUpdateSignal @@ -32,7 +34,7 @@ def widget(self, *args): # The QFontComboBox must be connected directly to the Qt Signal # which triggers the preview to update. # This unfortunately makes changing the font into a non-undoable action. - # Fix requires updating ComponentAction to handle fonts + # Fix requires updating ComponentTrackedWidgetUpdate to handle fonts self.trackWidgets( { @@ -69,34 +71,49 @@ def widget(self, *args): def update(self): self.titleFont = self.page.fontComboBox_titleFont.currentFont() if self.page.checkBox_shadow.isChecked(): - self.page.label_shadX.setHidden(False) + self.page.label_shadOffset.setHidden(False) self.page.spinBox_shadX.setHidden(False) self.page.spinBox_shadY.setHidden(False) self.page.label_shadBlur.setHidden(False) self.page.spinBox_shadBlur.setHidden(False) else: - self.page.label_shadX.setHidden(True) + self.page.label_shadOffset.setHidden(True) self.page.spinBox_shadX.setHidden(True) self.page.spinBox_shadY.setHidden(True) self.page.label_shadBlur.setHidden(True) self.page.spinBox_shadBlur.setHidden(True) + def previewClickEvent(self, pos, size, button): + if not hasUndoStack(self.loader): + return + if button != QtCore.Qt.MouseButton.LeftButton: + return + action = ComponentPreviewXYClick(self, pos, size, button) + self.loader.undoStack.push(action) + + def addCenterAction(self): + """Triggered when user clicks "center text" button.""" + if not hasUndoStack(self.loader): + return + action = ComponentCenterXYAction(self) + self.loader.undoStack.push(action) + def centerXY(self): - self.setRelativeWidget("xPosition", 0.5) + with blockSignals(self): + self.setRelativeWidget("xPosition", 0.5) self.setRelativeWidget("yPosition", 0.521) def getXY(self): """Returns true x, y after considering alignment settings""" fm = QtGui.QFontMetrics(self.titleFont) text_width = fm.boundingRect(self.title).width() - x = self.pixelValForAttr("xPosition") + x = self.xPosition + offset = 0 if self.alignment == 1: # Middle offset = int(text_width / 2) elif self.alignment == 2: # Right offset = text_width - else: - raise ValueError(f"Alignment value {self.alignment} unknown") x -= offset diff --git a/src/avp/components/text.ui b/src/avp/components/text.ui index ce961fe..312b530 100644 --- a/src/avp/components/text.ui +++ b/src/avp/components/text.ui @@ -87,7 +87,7 @@ - Text Layout + Alignment @@ -557,7 +557,7 @@ - + 0 diff --git a/src/avp/components/video.py b/src/avp/components/video.py index 1e9b788..797164f 100644 --- a/src/avp/components/video.py +++ b/src/avp/components/video.py @@ -1,15 +1,17 @@ -from PIL import Image +from PIL import Image, ImageOps from PyQt6 import QtWidgets import os import subprocess import logging +from ..core import Core from ..libcomponent import BaseComponent +from ..toolkit import connectWidget from ..toolkit.frame import BlankFrame, scale from ..toolkit.ffmpeg import openPipe, closePipe, testAudioStream, FfmpegVideo -log = logging.getLogger("AVP.Components.Video") +log = logging.getLogger(__name__) class Component(BaseComponent): @@ -22,6 +24,9 @@ def widget(self, *args): self.x = 0 self.y = 0 self.loopVideo = False + self.chunkSize = 4 * self.width * self.height + self.previewFrame = {resolution: None for resolution in Core.resolutions} + self.changedOptions = True super().widget(*args) self._image = BlankFrame(self.width, self.height) self.page.pushButton_video.clicked.connect(self.pickVideo) @@ -47,6 +52,13 @@ def widget(self, *args): "yPosition", ], ) + for widget in self._trackedWidgets.values(): + connectWidget(widget, lambda: self.changed()) + + def changed(self): + self.changedOptions = True + for key in self.previewFrame: + self.previewFrame[key] = None def update(self): if self.page.checkBox_useAudio.isChecked(): @@ -57,19 +69,52 @@ def update(self): self.page.spinBox_volume.setEnabled(False) def previewRender(self): - self.updateChunksize() + def reusePreviewFrame(): + log.debug("Video #%s is reusing old preview frame", self.compPos) + return self.previewFrame[res] + + self.changedOptions = False + res = f"{self.width}x{self.height}" + changedSize = self.updateChunksize() + if changedSize and not self.changedOptions: + if self.previewFrame[res] is not None: + return reusePreviewFrame() + + if ( + not changedSize + and not self.changedOptions + and self.previewFrame[res] is not None + ): + return reusePreviewFrame() + + if self.previewFrame[res] is None: + for frame_ in self.previewFrame.values(): + if frame_ is not None: + self.previewFrame[res] = ImageOps.fit( + frame_, + ( + self.width, + self.height, + ), + Image.Resampling.LANCZOS, + ) + log.debug( + "Video #%s resized an existing preview frame instead of using FFmpeg." + ) + return self.previewFrame[res] + frame = self.getPreviewFrame(self.width, self.height) - if not frame: + if frame is None: return BlankFrame(self.width, self.height) - else: - return frame + self.previewFrame[res] = frame + return frame def properties(self): props = [] outputFile = None - if hasattr(self.parent, "lineEdit_outputFile"): + if hasattr(self.loader, "lineEdit_outputFile"): # check only happens in GUI mode - outputFile = self.parent.lineEdit_outputFile.text() + outputFile = self.loader.lineEdit_outputFile.text() if not self.videoPath: self.lockError("There is no video selected.") @@ -103,8 +148,8 @@ def preFrameRender(self, **kwargs): width=self.width, height=self.height, chunkSize=self.chunkSize, - frameRate=int(self.settings.value("outputFrameRate")), - parent=self.parent, + frameRate=int(self.core.settings.value("outputFrameRate")), + parent=self.loader, loopVideo=self.loopVideo, component=self, ) @@ -118,10 +163,10 @@ def frameRender(self, frameNo): return self.finalizeFrame(self.video.frame(frameNo)) def postFrameRender(self): - closePipe(self.video.pipe) + self.video.stop() def pickVideo(self): - imgDir = self.settings.value("componentDir", os.path.expanduser("~")) + imgDir = self.core.settings.value("componentDir", os.path.expanduser("~")) filename, _ = QtWidgets.QFileDialog.getOpenFileName( self.page, "Choose Video", @@ -129,7 +174,7 @@ def pickVideo(self): "Video Files (%s)" % " ".join(self.core.videoFormats), ) if filename: - self.settings.setValue("componentDir", os.path.dirname(filename)) + self.core.settings.setValue("componentDir", os.path.dirname(filename)) self.mergeUndo = False self.page.lineEdit_video.setText(filename) self.mergeUndo = True @@ -166,7 +211,7 @@ def getPreviewFrame(self, width, height): logFilename = os.path.join( self.core.logDir, "preview_%s.log" % str(self.compPos) ) - log.debug("Creating ffmpeg process (log at %s)" % logFilename) + log.debug("Creating ffmpeg process (log at %s)", logFilename) with open(logFilename, "w") as logf: logf.write(" ".join(command) + "\n\n") with open(logFilename, "a") as logf: @@ -203,7 +248,9 @@ def updateChunksize(self): width, height = scale(self.scale, self.width, self.height, int) else: width, height = self.width, self.height + oldChunkSize = int(self.chunkSize) self.chunkSize = 4 * width * height + return self.chunkSize != oldChunkSize def command(self, arg): if "=" in arg: diff --git a/src/avp/components/waveform.py b/src/avp/components/waveform.py index bfebc30..ea93f97 100644 --- a/src/avp/components/waveform.py +++ b/src/avp/components/waveform.py @@ -16,7 +16,7 @@ ) -log = logging.getLogger("AVP.Components.Waveform") +log = logging.getLogger(__name__) class Component(BaseComponent): @@ -35,8 +35,8 @@ def widget(self, *args): super().widget(*args) self._image = BlankFrame(self.width, self.height) - if hasattr(self.parent, "lineEdit_audioFile"): - self.parent.lineEdit_audioFile.textChanged.connect(self.update) + if hasattr(self.loader, "lineEdit_audioFile"): + self.loader.lineEdit_audioFile.textChanged.connect(self.update) self.trackWidgets( { @@ -83,8 +83,8 @@ def preFrameRender(self, **kwargs): width=w, height=h, chunkSize=self.chunkSize, - frameRate=int(self.settings.value("outputFrameRate")), - parent=self.parent, + frameRate=int(self.core.settings.value("outputFrameRate")), + parent=self.loader, component=self, debug=True, ) @@ -119,7 +119,9 @@ def frameRender(self, frameNo): if frameDiff == 0 or isValidPeak: self._lastUpdatedFrame = frameNo self._fadingImage = self._prevImage - self._prevImage = self._image + self._prevImage = ( + BlankFrame() if self._currImage is None else self._currImage.copy() + ) self._currImage = newFrame usualAlpha = 0.0 + (1 / self.updateInterval) * frameDiff alpha = max( @@ -148,13 +150,13 @@ def frameRender(self, frameNo): return Image.alpha_composite(self._currImage, baseImage) def postFrameRender(self): - closePipe(self.video.pipe) + self.video.stop() def getPreviewFrame(self, width, height): - genericPreview = self.settings.value("pref_genericPreview") + genericPreview = self.core.settings.value("pref_genericPreview") startPt = 0 if not genericPreview: - inputFile = self.parent.lineEdit_audioFile.text() + inputFile = self.loader.lineEdit_audioFile.text() if not inputFile or not os.path.exists(inputFile): return duration = getAudioDuration(inputFile) @@ -169,7 +171,7 @@ def getPreviewFrame(self, width, height): "-thread_queue_size", "512", "-r", - str(self.settings.value("outputFrameRate")), + str(self.core.settings.value("outputFrameRate")), "-ss", "{0:.3f}".format(startPt), "-i", @@ -233,18 +235,18 @@ def makeFfmpegFilter(self, preview=False, startPt=0): amplitude = "lin" hexcolor = QColor(*self.color).name() opacity = "{0:.1f}".format(self.opacity / 100) - genericPreview = self.settings.value("pref_genericPreview") + genericPreview = self.core.settings.value("pref_genericPreview") if self.mode > 1: filter_ = ( "showwaves=" - f'r={str(self.settings.value("outputFrameRate"))}:' - f's={self.settings.value("outputWidth")}x{self.settings.value("outputHeight")}:' + f'r={str(self.core.settings.value("outputFrameRate"))}:' + f"s={self.width}x{self.height}:" f'mode={self.page.comboBox_mode.currentText().lower() if self.mode != 3 else "p2p"}:' f"colors={hexcolor}@{opacity}:scale={amplitude}" ) elif self.mode < 2: filter_ = ( - f'showfreqs=s={str(self.settings.value("outputWidth"))}x{str(self.settings.value("outputHeight"))}:' + f"showfreqs=s={str(self.width)}x{str(self.height)}:" f'mode={"line" if self.mode == 0 else "bar"}:' f"colors={hexcolor}@{opacity}" f":ascale={amplitude}:fscale={'log' if self.mono else 'lin'}" diff --git a/src/avp/core.py b/src/avp/core.py index c8e070b..80e4b17 100644 --- a/src/avp/core.py +++ b/src/avp/core.py @@ -13,7 +13,7 @@ from . import toolkit appName = "Audio Visualizer Python" -log = logging.getLogger("AVP.Core") +log = logging.getLogger(__name__) class Core: @@ -69,6 +69,17 @@ def componentListChanged(self): for i, component in enumerate(self.selectedComponents): component.compPos = i + def createComponent(self, component, loader): + """ + Creates and returns a Component object + `component`: string component name or int componentModuleIndex + """ + if type(component) == str: + component = self.moduleIndexFor(component) + component = self.modules[component].Component(component, self) + component.widget(loader) + return component + def insertComponent(self, compPos, component, loader): """ Creates a new component using these args: @@ -85,12 +96,16 @@ def insertComponent(self, compPos, component, loader): # create component using module index in self.modules moduleIndex = int(component) log.debug("Creating new component from module #%s", str(moduleIndex)) - component = self.modules[moduleIndex].Component(moduleIndex, compPos, self) - component.widget(loader) + component = self.createComponent(moduleIndex, loader) else: moduleIndex = -1 - log.debug("Inserting previously-created %s component", component.name) + log.debug( + "Inserting previously-created %s component at %s", + component.name, + compPos, + ) + component.compPos = compPos component._error.connect(loader.videoThreadError) self.selectedComponents.insert(compPos, component) if hasattr(loader, "insertComponent"): @@ -117,16 +132,21 @@ def clearComponents(self): def updateComponent(self, i): log.debug("Auto-updating %s #%s", self.selectedComponents[i], str(i)) - self.selectedComponents[i].update(auto=True) + self.selectedComponents[i].update(auto=True, origin="core") def moduleIndexFor(self, compName): - try: + index = None + if compName in self.compNames: index = self.compNames.index(compName) - return self.moduleIndexes[index] - except ValueError: + else: for altName, modI in self.altCompNames: if altName == compName: - return self.moduleIndexes[modI] + index = modI + try: + return self.moduleIndexes[index] + except TypeError: + log.error("Module index not found.") + return def clearPreset(self, compIndex): self.selectedComponents[compIndex].currentPreset = None @@ -166,8 +186,8 @@ def openProject(self, loader, filepath): errcode, data = self.parseAvFile(filepath) if errcode == 0: - self.openingProject = True try: + self.openingProject = True if hasattr(loader, "window"): for widget, value in data["WindowFields"]: widget = eval("loader.%s" % widget) @@ -201,8 +221,10 @@ def openProject(self, loader, filepath): ) continue if i == -1: - loader.showMessage(msg="Invalid components!") - break + loader.showMessage( + msg=f"Invalid component '{name}' was removed." + ) + continue try: if "preset" in preset and preset["preset"] is not None: @@ -220,11 +242,12 @@ def openProject(self, loader, filepath): self.clearPreset(i) if hasattr(loader, "updateComponentTitle"): loader.updateComponentTitle(i, modified) - self.openingProject = False return True except Exception: errcode = 1 data = sys.exc_info() + finally: + self.openingProject = False if errcode == 1: typ, value, tb = data @@ -462,6 +485,7 @@ def storeSettings(cls, dataDir=None): "logDir": os.path.join(dataDir, "log"), "logEnabled": False, "previewEnabled": True, + "maxResolution": (1920, 1080), } settings["videoFormats"] = toolkit.appendUppercase( @@ -518,8 +542,8 @@ def storeSettings(cls, dataDir=None): def loadDefaultSettings(cls): # settings that get saved into the ini file cls.defaultSettings = { - "outputWidth": 1280, - "outputHeight": 720, + "outputWidth": 1920, + "outputHeight": 1080, "outputFrameRate": 30, "outputAudioCodec": "AAC", "outputAudioBitrate": "192", @@ -561,7 +585,7 @@ def makeLogger(deleteOldLogs=False, fileLogLvl=None): logStream.setLevel(Core.stdoutLogLvl) streamFormatter = logging.Formatter("<%(name)s> %(levelname)s: %(message)s") logStream.setFormatter(streamFormatter) - log = logging.getLogger("AVP") + log = logging.getLogger(__package__) log.addHandler(logStream) if fileLogLvl is not None: diff --git a/src/avp/gui/actions.py b/src/avp/gui/actions.py index 6a01bdd..380fa6e 100644 --- a/src/avp/gui/actions.py +++ b/src/avp/gui/actions.py @@ -8,9 +8,63 @@ from copy import copy from ..core import Core +from ..toolkit import blockSignals -log = logging.getLogger("AVP.Gui.Actions") +log = logging.getLogger(__name__) + + +# =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ +# ENCODER SETTINGS ACTIONS +# =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ + + +class ChangeResolution(QUndoCommand): + id_ = sum([ord(letter) for letter in "updateResolution"]) + + def __init__(self, window, oldResolutionIndex, newResolutionIndex): + super().__init__( + "change resolution to %s" + % window.comboBox_resolution.itemText(newResolutionIndex) + ) + self.window = window + self.newResolutionIndex = newResolutionIndex + self.newResolution = tuple(Core.resolutions[newResolutionIndex].split("x")) + self.oldResolutionIndex = oldResolutionIndex + self.oldResolution = tuple(Core.resolutions[oldResolutionIndex].split("x")) + + def updateResolution(self, resolution, index): + log.debug("Updating resolution to %sx%s" % resolution) + self.window.settings.setValue("outputWidth", resolution[0]) + self.window.settings.setValue("outputHeight", resolution[1]) + self.window.previewWorker.newBackground() + with blockSignals( + [self.window.comboBox_resolution, *self.window.core.selectedComponents] + ): + self.window.comboBox_resolution.setCurrentIndex(index) + for i in range(len(self.window.core.selectedComponents)): + self.window.core.selectedComponents[i].updateResolution() + self.window.drawPreview() + + def id(self): + return self.id_ + + def mergeWith(self, other): + if self.oldResolutionIndex == other.newResolutionIndex: + self.setObsolete(True) + self.newResolution = other.newResolution + self.newResolutionIndex = other.newResolutionIndex + self.setText( + "change resolution to %s" + % self.window.comboBox_resolution.itemText(self.newResolutionIndex) + ) + return True + + def redo(self): + self.updateResolution(self.newResolution, self.newResolutionIndex) + + def undo(self): + self.updateResolution(self.oldResolution, self.oldResolutionIndex) # =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ @@ -31,21 +85,16 @@ def __init__(self, parent, compI, moduleI): def redo(self): if self.comp is None: - i = self.parent.core.insertComponent(self.compI, self.moduleI, self.parent) - if i != self.compI: - self.valid = False - if i is not None: - log.error( - f"Expected new component index to be {self.compI} but received {i}" - ) - else: - # inserting previously-created component - self.parent.core.insertComponent(self.compI, self.comp, self.parent) + self.comp = self.parent.core.createComponent(self.moduleI, self.parent) + i = self.parent.core.insertComponent(self.compI, self.comp, self.parent) + if i != self.compI: + log.error( + "Component could not insert at layer %s (inserted at %s instead)", + self.compI, + i, + ) def undo(self): - if not self.valid: - return - self.comp = self.parent.core.selectedComponents[self.compI] self.parent._removeComponent(self.compI) @@ -61,7 +110,6 @@ def redo(self): self.parent._removeComponent(self.selectedRows[0]) def undo(self): - componentList = self.parent.listWidget_componentList for index, comp in zip(self.selectedRows, self.components): self.parent.core.insertComponent(index, comp, self.parent) self.parent.drawPreview() diff --git a/src/avp/gui/mainwindow.py b/src/avp/gui/mainwindow.py index fac1e41..c3ca872 100644 --- a/src/avp/gui/mainwindow.py +++ b/src/avp/gui/mainwindow.py @@ -6,10 +6,8 @@ """ from PyQt6 import QtCore, QtWidgets, uic -import PyQt6.QtWidgets as QtWidgets from PyQt6.QtGui import QShortcut from PIL import Image -from queue import Queue import sys import os import signal @@ -29,12 +27,12 @@ from ..toolkit import ( disableWhenEncoding, disableWhenOpeningProject, - checkOutput, blockSignals, ) -log = logging.getLogger("AVP.Gui.MainWindow") +log = logging.getLogger(__name__) +SYSPLATFORM = sys.platform class MainWindow(QtWidgets.QMainWindow): @@ -51,236 +49,337 @@ class MainWindow(QtWidgets.QMainWindow): newTask = QtCore.pyqtSignal(list) # for the preview window processTask = QtCore.pyqtSignal() - def __init__(self, project, dpi): + def __init__(self, project, dpi, testMode=False): super().__init__() - log.debug("Main thread id: {}".format(int(QtCore.QThread.currentThreadId()))) + self.testMode = testMode uic.loadUi(os.path.join(Core.wd, "gui", "mainwindow.ui"), self) - - if dpi: - self.resize( - int(self.width() * (dpi / 144)), - int(self.height() * (dpi / 144)), - ) - - self.core = Core() - Core.mode = "GUI" - # widgets of component settings - self.pages = [] - self.lastAutosave = time.time() - # list of previous five autosave times, used to reduce update spam - self.autosaveTimes = [] - self.autosaveCooldown = 0.2 - self.encoding = False - - # Find settings created by Core object - self.dataDir = Core.dataDir - self.presetDir = Core.presetDir - self.autosavePath = os.path.join(self.dataDir, "autosave.avp") - self.settings = Core.settings - - # Create stack of undoable user actions - self.undoStack = UndoStack(self) - undoLimit = self.settings.value("pref_undoLimit") - self.undoStack.setUndoLimit(undoLimit) - - # Create Undo Dialog - A standard QUndoView on a standard QDialog - self.undoDialog = QtWidgets.QDialog(self) - self.undoDialog.setWindowTitle("Undo History") - undoView = QtWidgets.QUndoView(self.undoStack) - layout = QtWidgets.QVBoxLayout() - layout.addWidget(undoView) - self.undoDialog.setLayout(layout) - self.undoDialog.setMinimumWidth(int(self.width() / 2)) - - # Create Preset Manager - self.presetManager = PresetManager(self) - - # Create the preview window and its thread, queues, and timers - log.debug("Creating preview window") - self.previewWindow = PreviewWindow( - self, os.path.join(Core.wd, "gui", "background.png") + log.info("Pillow version %s", Image.__version__) + log.info( + "PyQt version %s (Qt version %s)", + QtCore.PYQT_VERSION_STR, + QtCore.QT_VERSION_STR, ) - self.verticalLayout_previewWrapper.addWidget(self.previewWindow) - log.debug("Starting preview thread") - self.previewQueue = Queue() - self.previewThread = QtCore.QThread(self) - self.previewWorker = preview_thread.Worker( - self.core, self.settings, self.previewQueue - ) - self.previewWorker.moveToThread(self.previewThread) - self.newTask.connect(self.previewWorker.createPreviewImage) - self.processTask.connect(self.previewWorker.process) - self.previewWorker.error.connect(self.previewWindow.threadError) - self.previewWorker.imageCreated.connect(self.showPreviewImage) - self.previewThread.start() - self.previewThread.finished.connect( - lambda: log.info("Preview thread finished.") - ) + def setupHotkeys(): + # Hotkeys for projects + QShortcut("Ctrl+S", self, self.saveCurrentProject) + QShortcut("Ctrl+A", self, self.openSaveProjectDialog) + QShortcut("Ctrl+O", self, self.openOpenProjectDialog) + QShortcut("Ctrl+N", self, self.createNewProject) + QShortcut("F2", self, lambda: self.pushButton_projects.click()) + + # Hotkeys for undo/redo + QShortcut("Ctrl+Z", self, self.undoStack.undo) + for redoKey in ("Ctrl+Y", "Ctrl+Shift+Z"): + QShortcut(redoKey, self, self.undoStack.redo) + for showUndoStackKey in ("Ctrl+Shift+U", "F4"): + QShortcut(showUndoStackKey, self, self.showUndoStack) + + # Hotkeys for component list + for insertKey in ("Ctrl+T", QtCore.Qt.Key.Key_Insert): + QShortcut(insertKey, self, lambda: self.pushButton_addComponent.click()) + for deleteKey in ("Ctrl+W", QtCore.Qt.Key.Key_Delete): + QShortcut( + deleteKey, self.listWidget_componentList, self.removeComponent + ) + QShortcut( + "Ctrl+Space", self, lambda: self.listWidget_componentList.setFocus() + ) + QShortcut( + "Ctrl+Up", + self.listWidget_componentList, + lambda: self.moveComponent(-1), + ) + QShortcut( + "Ctrl+Down", + self.listWidget_componentList, + lambda: self.moveComponent(1), + ) + QShortcut( + "Ctrl+Home", + self.listWidget_componentList, + lambda: self.moveComponent("top"), + ) + QShortcut( + "Ctrl+End", + self.listWidget_componentList, + lambda: self.moveComponent("bottom"), + ) - timeout = 500 - log.debug("Preview timer set to trigger when idle for %sms" % str(timeout)) - self.timer = QtCore.QTimer(self) - self.timer.timeout.connect(self.processTask.emit) - self.timer.start(timeout) + # Hotkeys for preset management in component list + QShortcut("Ctrl+Shift+S", self, self.presetManager.openSavePresetDialog) + for clearPresetKey in ("Ctrl+Shift+C", "Ctrl+Shift+Del"): + QShortcut(clearPresetKey, self, self.presetManager.clearPreset) + QShortcut("F3", self, self.openPresetManager) + + # Debug assistance hotkeys + QShortcut("F1", self, self.showHelpWindow) + QShortcut("F5", self, self.drawPreview) + + def setupMainWindowWidgets(): + def setupUndoDialog(): + """Create Undo Dialog - A standard QUndoView on a standard QDialog""" + self.undoDialog = QtWidgets.QDialog(self) + self.undoDialog.setWindowTitle("Undo History") + undoView = QtWidgets.QUndoView(self.undoStack) + layout = QtWidgets.QVBoxLayout() + layout.addWidget(undoView) + self.undoDialog.setLayout(layout) + self.undoDialog.setMinimumWidth(int(self.width() / 2)) + + def setupPreviewWindow(): + """Create the preview window and its thread, queues, and timers""" + log.debug("Creating preview window") + self.previewWindow = PreviewWindow( + self, os.path.join(Core.wd, "gui", "background.png") + ) + self.verticalLayout_previewWrapper.addWidget(self.previewWindow) + + log.debug("Starting preview thread") + self.previewThread = QtCore.QThread(self) + self.previewWorker = preview_thread.Worker(self.core, self.settings) + self.previewWorker.moveToThread(self.previewThread) + self.newTask.connect(self.previewWorker.createPreviewImage) + self.processTask.connect(self.previewWorker.process) + self.previewWorker.error.connect(self.previewWindow.threadError) + self.previewWorker.imageCreated.connect(self.showPreviewImage) + self.previewWorker.imageCreated.connect(lambda: self.updateResolution()) + self.previewThread.start() + self.previewThread.finished.connect( + lambda: log.info("Preview thread finished.") + ) - # Begin decorating the window and connecting events - componentList = self.listWidget_componentList + def setupUndoFeature(): + def toggleUndoButtonEnabled(*_): + """Enable/disable undo button depending on whether UndoStack contains Actions""" + try: + undoButton.setEnabled(self.undoStack.count()) + except RuntimeError: + # program is probably in midst of exiting + pass + + style = self.pushButton_undo.style() + undoButton = self.pushButton_undo + undoButton.setIcon( + style.standardIcon( + QtWidgets.QStyle.StandardPixmap.SP_FileDialogBack + ) + ) + undoButton.clicked.connect(self.undoStack.undo) + undoButton.setEnabled(False) + self.undoStack.cleanChanged.connect(toggleUndoButtonEnabled) + self.undoMenu = QtWidgets.QMenu() + self.undoMenu.addAction(self.undoStack.createUndoAction(self)) + self.undoMenu.addAction(self.undoStack.createRedoAction(self)) + action = self.undoMenu.addAction("Show History...") + action.triggered.connect(lambda _: self.showUndoStack()) + undoButton.setMenu(self.undoMenu) + + def setupProgressBar(): + if SYSPLATFORM == "darwin": + log.debug( + "Darwin detected: showing progress label above progress bar" + ) + self.progressBar_createVideo.setTextVisible(False) + self.estimatedTimeLabel.setAlignment( + QtCore.Qt.AlignmentFlag.AlignLeft + | QtCore.Qt.AlignmentFlag.AlignVCenter + ) + self.progressLabel.setHidden(True) - # Undo Feature - def toggleUndoButtonEnabled(*_): - """Enable/disable undo button depending on whether UndoStack contains Actions""" - try: - undoButton.setEnabled(self.undoStack.count()) - except RuntimeError: - # program is probably in midst of exiting - pass + def setupExportVideoTab(): + self.toolButton_selectAudioFile.clicked.connect( + self.openInputFileDialog + ) - style = self.pushButton_undo.style() - undoButton = self.pushButton_undo - undoButton.setIcon( - style.standardIcon(QtWidgets.QStyle.StandardPixmap.SP_FileDialogBack) - ) - undoButton.clicked.connect(self.undoStack.undo) - undoButton.setEnabled(False) - self.undoStack.cleanChanged.connect(toggleUndoButtonEnabled) - self.undoMenu = QtWidgets.QMenu() - self.undoMenu.addAction(self.undoStack.createUndoAction(self)) - self.undoMenu.addAction(self.undoStack.createRedoAction(self)) - action = self.undoMenu.addAction("Show History...") - action.triggered.connect(lambda _: self.showUndoStack()) - undoButton.setMenu(self.undoMenu) - # end of Undo Feature - - style = self.pushButton_listMoveUp.style() - self.pushButton_listMoveUp.setIcon( - style.standardIcon(QtWidgets.QStyle.StandardPixmap.SP_ArrowUp) - ) - style = self.pushButton_listMoveDown.style() - self.pushButton_listMoveDown.setIcon( - style.standardIcon(QtWidgets.QStyle.StandardPixmap.SP_ArrowDown) - ) - style = self.pushButton_removeComponent.style() - self.pushButton_removeComponent.setIcon( - style.standardIcon(QtWidgets.QStyle.StandardPixmap.SP_DialogDiscardButton) - ) + self.toolButton_selectOutputFile.clicked.connect( + self.openOutputFileDialog + ) - if sys.platform == "darwin": - log.debug("Darwin detected: showing progress label below progress bar") - self.progressBar_createVideo.setTextVisible(False) - else: - self.progressLabel.setHidden(True) + def changedField(): + self.autosave() + self.updateWindowTitle() - self.toolButton_selectAudioFile.clicked.connect(self.openInputFileDialog) + self.lineEdit_audioFile.textChanged.connect(changedField) + self.lineEdit_outputFile.textChanged.connect(changedField) - self.toolButton_selectOutputFile.clicked.connect(self.openOutputFileDialog) + self.progressBar_createVideo.setValue(0) - def changedField(): - self.autosave() - self.updateWindowTitle() + self.pushButton_createVideo.clicked.connect( + self.createAudioVisualization + ) - self.lineEdit_audioFile.textChanged.connect(changedField) - self.lineEdit_outputFile.textChanged.connect(changedField) + self.pushButton_Cancel.clicked.connect(self.stopVideo) - self.progressBar_createVideo.setValue(0) + def setupEncoderSettingsTab(): + for i, container in enumerate(Core.encoderOptions["containers"]): + self.comboBox_videoContainer.addItem(container["name"]) + if container["name"] == self.settings.value("outputContainer"): + selectedContainer = i - self.pushButton_createVideo.clicked.connect(self.createAudioVisualization) + self.comboBox_videoContainer.setCurrentIndex(selectedContainer) + self.comboBox_videoContainer.currentIndexChanged.connect( + self.updateCodecs + ) - self.pushButton_Cancel.clicked.connect(self.stopVideo) + self.updateCodecs() - for i, container in enumerate(Core.encoderOptions["containers"]): - self.comboBox_videoContainer.addItem(container["name"]) - if container["name"] == self.settings.value("outputContainer"): - selectedContainer = i + for i in range(self.comboBox_videoCodec.count()): + codec = self.comboBox_videoCodec.itemText(i) + if codec == self.settings.value("outputVideoCodec"): + self.comboBox_videoCodec.setCurrentIndex(i) - self.comboBox_videoContainer.setCurrentIndex(selectedContainer) - self.comboBox_videoContainer.currentIndexChanged.connect(self.updateCodecs) + for i in range(self.comboBox_audioCodec.count()): + codec = self.comboBox_audioCodec.itemText(i) + if codec == self.settings.value("outputAudioCodec"): + self.comboBox_audioCodec.setCurrentIndex(i) - self.updateCodecs() + self.comboBox_videoCodec.currentIndexChanged.connect( + self.updateCodecSettings + ) - for i in range(self.comboBox_videoCodec.count()): - codec = self.comboBox_videoCodec.itemText(i) - if codec == self.settings.value("outputVideoCodec"): - self.comboBox_videoCodec.setCurrentIndex(i) + self.comboBox_audioCodec.currentIndexChanged.connect( + self.updateCodecSettings + ) - for i in range(self.comboBox_audioCodec.count()): - codec = self.comboBox_audioCodec.itemText(i) - if codec == self.settings.value("outputAudioCodec"): - self.comboBox_audioCodec.setCurrentIndex(i) + vBitrate = int(self.settings.value("outputVideoBitrate")) + aBitrate = int(self.settings.value("outputAudioBitrate")) - self.comboBox_videoCodec.currentIndexChanged.connect(self.updateCodecSettings) + self.spinBox_vBitrate.setValue(vBitrate) + self.spinBox_aBitrate.setValue(aBitrate) + self.spinBox_vBitrate.valueChanged.connect(self.updateCodecSettings) + self.spinBox_aBitrate.valueChanged.connect(self.updateCodecSettings) - self.comboBox_audioCodec.currentIndexChanged.connect(self.updateCodecSettings) + currentRes = ( + str(self.settings.value("outputWidth")) + + "x" + + str(self.settings.value("outputHeight")) + ) + for i, res in enumerate(Core.resolutions): + self.comboBox_resolution.addItem(res) + if res == currentRes: + currentRes = i + self.comboBox_resolution.setCurrentIndex(currentRes) + self.comboBox_resolution.currentIndexChanged.connect( + self.updateResolution + ) - vBitrate = int(self.settings.value("outputVideoBitrate")) - aBitrate = int(self.settings.value("outputAudioBitrate")) + def setupComponentListWidgets(): + componentList = self.listWidget_componentList + style = self.pushButton_listMoveUp.style() + self.pushButton_listMoveUp.setIcon( + style.standardIcon(QtWidgets.QStyle.StandardPixmap.SP_ArrowUp) + ) + style = self.pushButton_listMoveDown.style() + self.pushButton_listMoveDown.setIcon( + style.standardIcon(QtWidgets.QStyle.StandardPixmap.SP_ArrowDown) + ) + style = self.pushButton_removeComponent.style() + self.pushButton_removeComponent.setIcon( + style.standardIcon( + QtWidgets.QStyle.StandardPixmap.SP_DialogDiscardButton + ) + ) - self.spinBox_vBitrate.setValue(vBitrate) - self.spinBox_aBitrate.setValue(aBitrate) - self.spinBox_vBitrate.valueChanged.connect(self.updateCodecSettings) - self.spinBox_aBitrate.valueChanged.connect(self.updateCodecSettings) + self.compMenu = QtWidgets.QMenu() + for i, comp in enumerate(self.core.modules): + action = self.compMenu.addAction(comp.Component.name) + action.triggered.connect( + lambda _, item=i: self.addComponent(0, item) + ) - # Make component buttons - self.compMenu = QtWidgets.QMenu() - for i, comp in enumerate(self.core.modules): - action = self.compMenu.addAction(comp.Component.name) - action.triggered.connect(lambda _, item=i: self.addComponent(0, item)) + self.pushButton_addComponent.setMenu(self.compMenu) - self.pushButton_addComponent.setMenu(self.compMenu) + componentList.dropEvent = self.dragComponent + componentList.itemSelectionChanged.connect(self.changeComponentWidget) + componentList.itemSelectionChanged.connect( + self.presetManager.clearPresetListSelection + ) + self.pushButton_removeComponent.clicked.connect( + lambda: self.removeComponent() + ) - componentList.dropEvent = self.dragComponent - componentList.itemSelectionChanged.connect(self.changeComponentWidget) - componentList.itemSelectionChanged.connect( - self.presetManager.clearPresetListSelection - ) - self.pushButton_removeComponent.clicked.connect(lambda: self.removeComponent()) + componentList.setContextMenuPolicy( + QtCore.Qt.ContextMenuPolicy.CustomContextMenu + ) + componentList.customContextMenuRequested.connect( + self.componentContextMenu + ) - componentList.setContextMenuPolicy( - QtCore.Qt.ContextMenuPolicy.CustomContextMenu - ) - componentList.customContextMenuRequested.connect(self.componentContextMenu) + self.pushButton_listMoveUp.clicked.connect( + lambda: self.moveComponent(-1) + ) + self.pushButton_listMoveDown.clicked.connect( + lambda: self.moveComponent(1) + ) - currentRes = ( - str(self.settings.value("outputWidth")) - + "x" - + str(self.settings.value("outputHeight")) - ) - for i, res in enumerate(Core.resolutions): - self.comboBox_resolution.addItem(res) - if res == currentRes: - currentRes = i - self.comboBox_resolution.setCurrentIndex(currentRes) - self.comboBox_resolution.currentIndexChanged.connect( - self.updateResolution + def setupProjectsMenu(): + """Configure the Projects Menu""" + self.projectMenu = QtWidgets.QMenu() + self.menuButton_newProject = self.projectMenu.addAction("New Project") + self.menuButton_newProject.triggered.connect( + lambda: self.createNewProject() + ) + self.menuButton_openProject = self.projectMenu.addAction("Open Project") + self.menuButton_openProject.triggered.connect( + lambda: self.openOpenProjectDialog() ) - self.pushButton_listMoveUp.clicked.connect(lambda: self.moveComponent(-1)) - self.pushButton_listMoveDown.clicked.connect(lambda: self.moveComponent(1)) + action = self.projectMenu.addAction("Save Project") + action.triggered.connect(self.saveCurrentProject) - # Configure the Projects Menu - self.projectMenu = QtWidgets.QMenu() - self.menuButton_newProject = self.projectMenu.addAction("New Project") - self.menuButton_newProject.triggered.connect(lambda: self.createNewProject()) - self.menuButton_openProject = self.projectMenu.addAction("Open Project") - self.menuButton_openProject.triggered.connect( - lambda: self.openOpenProjectDialog() - ) + action = self.projectMenu.addAction("Save Project As") + action.triggered.connect(self.openSaveProjectDialog) - action = self.projectMenu.addAction("Save Project") - action.triggered.connect(self.saveCurrentProject) + self.pushButton_projects.setMenu(self.projectMenu) - action = self.projectMenu.addAction("Save Project As") - action.triggered.connect(self.openSaveProjectDialog) + setupUndoDialog() + setupPreviewWindow() + setupUndoFeature() + setupProgressBar() + setupExportVideoTab() + setupEncoderSettingsTab() + setupComponentListWidgets() + setupProjectsMenu() - self.pushButton_projects.setMenu(self.projectMenu) + self.core = Core() + Core.mode = "GUI" + # widgets of component settings + self.pages = [] + self.lastAutosave = time.time() + # list of previous five autosave times, used to reduce update spam + self.autosaveTimes = [] + self.autosaveCooldown = 0.2 + self.encoding = False + self.updatingResolution = False + + # Find settings created by Core object + self.dataDir = Core.dataDir + self.presetDir = Core.presetDir + self.autosavePath = os.path.join(self.dataDir, "autosave.avp") + self.settings = Core.settings - # Configure the Presets Button + # Create Preset Manager + self.presetManager = PresetManager(self) self.pushButton_presets.clicked.connect(self.openPresetManager) - self.updateWindowTitle() - log.debug("Showing main window") + # Create widgets and hotkeys + self.undoStack = UndoStack(self) + undoLimit = self.settings.value("pref_undoLimit") + self.undoStack.setUndoLimit(undoLimit) + setupMainWindowWidgets() + setupHotkeys() + + # Resize and show main window + if dpi: + self.resize( + int(self.width() * (dpi / 144)), + int(self.height() * (dpi / 144)), + ) + self.setWindowTitle(appName) self.show() + # Load project and prompt user to restore unsaved changes if project and project != self.autosavePath: if not project.endswith(".avp"): project += ".avp" @@ -311,16 +410,8 @@ def changedField(): os.remove(self.autosavePath) self.openProject(self.currentProject, prompt=False) - self.drawPreview(True) - log.info("Pillow version %s", Image.__version__) - log.info( - "PyQt version %s (Qt version %s)", - QtCore.PYQT_VERSION_STR, - QtCore.QT_VERSION_STR, - ) - - # verify Ffmpeg version + # Verify FFmpeg version if not self.core.FFMPEG_BIN: self.showMessage( msg="FFmpeg could not be found. This is a critical error. " @@ -333,97 +424,52 @@ def changedField(): ffmpegGoodVersion, ffmpegVersionNum = checkFfmpegVersion() if not ffmpegGoodVersion: self.showMessage( - msg="The version of FFmpeg ({ffmpegVersionNum}) is " + msg=f"The version of FFmpeg ({ffmpegVersionNum}) is " "not recognized. Some features may not work as expected." ) self.settings.setValue("ffmpegMsgShown", True) - # Hotkeys for projects - - QShortcut("Ctrl+S", self, self.saveCurrentProject) - QShortcut("Ctrl+A", self, self.openSaveProjectDialog) - QShortcut("Ctrl+O", self, self.openOpenProjectDialog) - QShortcut("Ctrl+N", self, self.createNewProject) - - # Hotkeys for undo/redo - QShortcut("Ctrl+Z", self, self.undoStack.undo) - QShortcut("Ctrl+Y", self, self.undoStack.redo) - QShortcut("Ctrl+Shift+Z", self, self.undoStack.redo) - - # Hotkeys for component list - for inskey in ("Ctrl+T", QtCore.Qt.Key.Key_Insert): - QShortcut( - inskey, - self, - activated=lambda: self.pushButton_addComponent.click(), - ) - for delkey in ("Ctrl+R", QtCore.Qt.Key.Key_Delete): - QShortcut(delkey, self.listWidget_componentList, self.removeComponent) - QShortcut( - "Ctrl+Space", - self, - activated=lambda: self.listWidget_componentList.setFocus(), - ) - QShortcut("Ctrl+Shift+S", self, self.presetManager.openSavePresetDialog) - QShortcut("Ctrl+Shift+C", self, self.presetManager.clearPreset) - - QShortcut( - "Ctrl+Up", - self.listWidget_componentList, - activated=lambda: self.moveComponent(-1), - ) - QShortcut( - "Ctrl+Down", - self.listWidget_componentList, - activated=lambda: self.moveComponent(1), - ) - QShortcut( - "Ctrl+Home", - self.listWidget_componentList, - activated=lambda: self.moveComponent("top"), - ) - QShortcut( - "Ctrl+End", - self.listWidget_componentList, - activated=lambda: self.moveComponent("bottom"), - ) - - QShortcut("F1", self, self.showHelpWindow) - QShortcut("Ctrl+Shift+F", self, self.showFfmpegCommand) - QShortcut("Ctrl+Shift+U", self, self.showUndoStack) - - if log.isEnabledFor(logging.DEBUG): - QShortcut("Ctrl+Alt+Shift+R", self, self.drawPreview) - QShortcut("Ctrl+Alt+Shift+A", self, lambda: log.debug(repr(self))) - # Close MainWindow when receiving Ctrl+C from terminal signal.signal(signal.SIGINT, lambda *args: self.close()) # Add initial components if none are in the list if not self.core.selectedComponents: - self.core.insertComponent( - 0, self.core.moduleIndexFor("Classic Visualizer"), self + log.info("Inserting default components") + classicVisComponent = self.core.createComponent( + self.core.moduleIndexFor("Classic Visualizer"), self ) - self.core.insertComponent(1, self.core.moduleIndexFor("Color"), self) - # set colors to white and black to match classic appearance of program - self.core.selectedComponents[0].page.lineEdit_visColor.setText( - "255,255,255" + colorComponent = self.core.createComponent( + self.core.moduleIndexFor("Color"), self ) - self.core.selectedComponents[1].page.lineEdit_color1.setText("0,0,0") + with blockSignals([classicVisComponent, colorComponent]): + self.core.insertComponent(0, classicVisComponent, self) + self.core.insertComponent(1, colorComponent, self) + # set colors to white and black to match classic appearance of program + with blockSignals(self.core.selectedComponents): + self.core.selectedComponents[0].page.lineEdit_visColor.setText( + "255,255,255" + ) + self.core.selectedComponents[1].page.lineEdit_color1.setText("0,0,0") self.undoStack.clear() + self.drawPreview() + + # Start timer to process preview images every 500ms + self.timer = QtCore.QTimer(self) + self.timer.timeout.connect(self.processTask.emit) + self.timer.start(500) def __repr__(self): return ( "%s\n" - "\n%s\n" "#####\n" "Preview thread is %s\n" % ( - super().__repr__(), ( "core not initialized" if not hasattr(self, "core") - else repr(self.core) + else "#####\n".join( + [repr(comp) for comp in self.core.selectedComponents] + ) ), ( "live" @@ -438,11 +484,12 @@ def closeEvent(self, event): self.timer.stop() self.previewThread.quit() self.previewThread.wait() + self.presetManager.close() + self.undoDialog.close() return super().closeEvent(event) @disableWhenOpeningProject def updateWindowTitle(self): - log.debug("Setting main window's title") windowTitle = appName try: if self.currentProject: @@ -453,7 +500,7 @@ def updateWindowTitle(self): windowTitle += "*" except AttributeError: pass - log.verbose(f'Window title is "{windowTitle}"') + log.debug("Setting MainWindow title to %s" % windowTitle) self.setWindowTitle(windowTitle) @QtCore.pyqtSlot(int, dict) @@ -561,7 +608,7 @@ def autosaveExists(self, identical=True): and filecmp.cmp(self.autosavePath, self.currentProject) == identical ): log.debug( - "Autosave found %s to be identical" % "not" if not identical else "" + "Autosave found %s to be identical", "not" if not identical else "" ) return True except FileNotFoundError: @@ -611,6 +658,7 @@ def stopVideo(self): log.info("Export cancelled") self.videoWorker.cancel() self.canceled = True + self.core.stopVideoThread() def createAudioVisualization(self): # create output video if mandatory settings are filled in @@ -642,6 +690,7 @@ def createAudioVisualization(self): self.videoWorker = self.core.newVideoWorker(self, audioFile, outputPath) self.videoWorker.progressBarUpdate.connect(self.progressBarUpdated) self.videoWorker.progressBarSetText.connect(self.progressBarSetText) + self.videoWorker.estimatedTimeUpdate.connect(self.estimatedTimeUpdated) self.videoWorker.imageCreated.connect(self.showPreviewImage) self.videoWorker.encoding.connect(self.changeEncodingStatus) self.createVideo.emit() @@ -653,17 +702,19 @@ def videoThreadError(self, msg, detail): except AttributeError as e: if "videoWorker" not in str(e): raise + log.info("MainWindow state: %s", repr(self)) self.showMessage( msg=msg, detail=detail, icon="Critical", ) - log.info("%s", repr(self)) def changeEncodingStatus(self, status): self.encoding = status if status: # Disable many widgets when starting to export + if SYSPLATFORM == "darwin": + self.progressLabel.setHidden(False) self.pushButton_createVideo.setEnabled(False) self.pushButton_Cancel.setEnabled(True) self.comboBox_resolution.setEnabled(False) @@ -685,10 +736,9 @@ def changeEncodingStatus(self, status): self.menuButton_openProject.setEnabled(False) # Close undo history dialog if open self.undoDialog.close() - # Show label under progress bar on macOS - if sys.platform == "darwin": - self.progressLabel.setHidden(False) else: + self.estimatedTimeLabel.setText("") + self.progressLabel.setHidden(True) self.pushButton_createVideo.setEnabled(True) self.pushButton_Cancel.setEnabled(False) self.comboBox_resolution.setEnabled(True) @@ -708,16 +758,21 @@ def changeEncodingStatus(self, status): self.menuButton_newProject.setEnabled(True) self.menuButton_openProject.setEnabled(True) self.listWidget_componentList.setEnabled(True) - self.progressLabel.setHidden(True) self.drawPreview(True) + @QtCore.pyqtSlot(str) + def estimatedTimeUpdated(self, value): + if SYSPLATFORM == "darwin": + value = "(%s)" % value + self.estimatedTimeLabel.setText(value) + @QtCore.pyqtSlot(int) def progressBarUpdated(self, value): self.progressBar_createVideo.setValue(value) @QtCore.pyqtSlot(str) def progressBarSetText(self, value): - if sys.platform == "darwin": + if SYSPLATFORM == "darwin": self.progressLabel.setText(value) else: self.progressBar_createVideo.setFormat(value) @@ -739,20 +794,28 @@ def progressBarSetText(self, value): # if the text is our main export progress print(f"\r{value}", end="") - def updateResolution(self): - resIndex = int(self.comboBox_resolution.currentIndex()) - res = Core.resolutions[resIndex].split("x") - changed = res[0] != self.settings.value("outputWidth") - self.settings.setValue("outputWidth", res[0]) - self.settings.setValue("outputHeight", res[1]) - if changed: - for i in range(len(self.core.selectedComponents)): - self.core.updateComponent(i) + def updateResolution(self, resIndex=None): + if self.updatingResolution: + return + if resIndex is None: + resIndex = int(self.comboBox_resolution.currentIndex()) + elif resIndex not in tuple(range(len(self.core.resolutions))): + log.error(f"Resolution {resIndex} unknown") + return + w = self.settings.value("outputWidth") + h = self.settings.value("outputHeight") + oldResIndex = Core.resolutions.index("%sx%s" % (w, h)) + if oldResIndex == resIndex: + return + self.updatingResolution = True + action = ChangeResolution(self, oldResIndex, resIndex) + self.undoStack.push(action) + if self.testMode: + self.updatingResolution = False def drawPreview(self, force=False, **kwargs): """Use autosave keyword arg to force saving or not saving if needed""" self.newTask.emit(self.core.selectedComponents) - # self.processTask.emit() if force or "autosave" in kwargs: if force or kwargs["autosave"]: self.autosave(True) @@ -763,24 +826,25 @@ def drawPreview(self, force=False, **kwargs): @QtCore.pyqtSlot("QImage") def showPreviewImage(self, image): self.previewWindow.changePixmap(image) + self.updatingResolution = False @disableWhenEncoding def showUndoStack(self): self.undoDialog.show() def showHelpWindow(self): - self.showMessage(msg=f"{appName} v{__version__}") - - def showFfmpegCommand(self): command = createFfmpegCommand( self.lineEdit_audioFile.text(), self.lineEdit_outputFile.text(), self.core.selectedComponents, ) command = " ".join(command) - log.info(f"FFmpeg command: {command}") lines = wrap(command, 49) - self.showMessage(msg=f"Current FFmpeg command:\n\n{' '.join(lines)}") + log.info(f"FFmpeg command: {command}") + log.info(f"MainWindow state: {repr(self)}") + self.showMessage( + msg=f"{appName} v{__version__}\n\nCurrent FFmpeg command:\n{' '.join(lines)}" + ) def addComponent(self, compPos, moduleIndex): """Creates an undoable action that adds a new component.""" @@ -798,8 +862,8 @@ def insertComponent(self, index): componentList.insertItem(index, self.core.selectedComponents[index].name) componentList.setCurrentRow(index) - # connect to signal that adds an asterisk when modified self.core.selectedComponents[index].modified.connect(self.updateComponentTitle) + self.core.selectedComponents[index].modified.connect(self.drawPreview) self.pages.insert(index, self.core.selectedComponents[index].page) stackedWidget.insertWidget(index, self.pages[index]) @@ -852,7 +916,6 @@ def getComponentListMousePos(self, position): if hasattr(position, "toPointF"): position = position.toPointF() position = position.toPoint() - modelIndexes = [ componentList.model().index(i) for i in range(componentList.count()) ] @@ -989,7 +1052,7 @@ def openProject(self, filepath, prompt=True): # actually load the project using core method self.core.openProject(self, filepath) self.drawPreview(autosave=False) - self.updateWindowTitle() + # self.updateWindowTitle() def showMessage(self, **kwargs): parent = kwargs["parent"] if "parent" in kwargs else self diff --git a/src/avp/gui/mainwindow.ui b/src/avp/gui/mainwindow.ui index cd8454d..93a52b4 100644 --- a/src/avp/gui/mainwindow.ui +++ b/src/avp/gui/mainwindow.ui @@ -23,7 +23,7 @@ - Qt::StrongFocus + Qt::FocusPolicy::StrongFocus MainWindow @@ -50,10 +50,10 @@ - Qt::Vertical + Qt::Orientation::Vertical - QSizePolicy::MinimumExpanding + QSizePolicy::Policy::MinimumExpanding @@ -66,7 +66,7 @@ - QLayout::SetDefaultConstraint + QLayout::SizeConstraint::SetDefaultConstraint 0 @@ -74,10 +74,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::MinimumExpanding + QSizePolicy::Policy::MinimumExpanding @@ -92,7 +92,7 @@ - QLayout::SetMinimumSize + QLayout::SizeConstraint::SetMinimumSize 3 @@ -100,7 +100,7 @@ - QLayout::SetMinimumSize + QLayout::SizeConstraint::SetMinimumSize 3 @@ -108,7 +108,7 @@ - QLayout::SetMinimumSize + QLayout::SizeConstraint::SetMinimumSize @@ -120,10 +120,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -152,10 +152,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Minimum + QSizePolicy::Policy::Minimum @@ -189,10 +189,10 @@ true - QFrame::StyledPanel + QFrame::Shape::StyledPanel - QFrame::Sunken + QFrame::Shadow::Sunken 1 @@ -207,10 +207,10 @@ false - QAbstractItemView::InternalMove + QAbstractItemView::DragDropMode::InternalMove - Qt::MoveAction + Qt::DropAction::MoveAction @@ -265,7 +265,7 @@ - QLayout::SetFixedSize + QLayout::SizeConstraint::SetFixedSize 4 @@ -294,10 +294,10 @@ - QTabWidget::North + QTabWidget::TabPosition::North - QTabWidget::Rounded + QTabWidget::TabShape::Rounded 0 @@ -307,11 +307,11 @@ Export Video - + 10 - + 0 @@ -345,7 +345,7 @@ Audio File - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter @@ -399,85 +399,81 @@ - - - - - - - - 0 - 0 - - - - - 85 - 0 - - - - - 0 - 0 - - - - Output File - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 0 - 28 - - - - - 16777215 - 28 - - - - - - - - - 0 - 28 - - - - - 16777215 - 28 - - - - ... - - - - + + + + + + 0 + 0 + + + + + 85 + 0 + + + + + 0 + 0 + + + + Output File + + + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 28 + + + + + 16777215 + 28 + + + + + + + + + 0 + 28 + + + + + 16777215 + 28 + + + + ... + + - - + + 0 @@ -496,10 +492,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Minimum + QSizePolicy::Policy::Minimum @@ -529,32 +525,47 @@ - - - - - - true - - - Qt::AlignCenter - - - -1 - - + + + + + + + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + + + + + + + true + + + Qt::AlignmentFlag::AlignCenter + + + -1 + + + + - progressLabel + horizontalLayoutWidget + Encoder Settings - + 10 @@ -591,10 +602,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Minimum + QSizePolicy::Policy::Minimum @@ -669,10 +680,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -738,10 +749,10 @@ - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -780,15 +791,15 @@ - QLayout::SetDefaultConstraint + QLayout::SizeConstraint::SetDefaultConstraint - Qt::Horizontal + Qt::Orientation::Horizontal - QSizePolicy::MinimumExpanding + QSizePolicy::Policy::MinimumExpanding diff --git a/src/avp/gui/presetmanager.py b/src/avp/gui/presetmanager.py index bdcff91..7a1675d 100644 --- a/src/avp/gui/presetmanager.py +++ b/src/avp/gui/presetmanager.py @@ -13,7 +13,7 @@ from .actions import * -log = logging.getLogger("AVP.Gui.PresetManager") +log = logging.getLogger(__name__) class PresetManager(QtWidgets.QDialog): @@ -200,9 +200,7 @@ def _openPreset(self, presetName, index): dirname = os.path.join(self.presetDir, componentName, str(version)) filepath = os.path.join(dirname, presetName) self.core.openPreset(filepath, index, presetName) - - self.parent.updateComponentTitle(index) - self.parent.drawPreview() + self.parent.updateComponentTitle(index, False) def openDeletePresetDialog(self): row = self.getPresetRow() @@ -298,7 +296,6 @@ def renamePreset(self, path, oldName, newName): if self.core.getPresetDir(comp) == path and comp.currentPreset == oldName: self.core.openPreset(newPath, i, newName) self.parent.updateComponentTitle(i, False) - self.parent.drawPreview() def openImportDialog(self): filename, _ = QtWidgets.QFileDialog.getOpenFileName( diff --git a/src/avp/gui/preview_thread.py b/src/avp/gui/preview_thread.py index 8507f45..604faa2 100644 --- a/src/avp/gui/preview_thread.py +++ b/src/avp/gui/preview_thread.py @@ -3,19 +3,19 @@ Processes a queue of component lists. """ -from PyQt6 import QtCore, QtGui, uic +from PyQt6 import QtCore, QtGui from PyQt6.QtCore import pyqtSignal, pyqtSlot from PIL import Image from PIL.ImageQt import ImageQt from queue import Queue, Empty -import os +import time import logging from ..toolkit.frame import Checkerboard from ..toolkit import disableWhenOpeningProject -log = logging.getLogger("AVP.Gui.PreviewThread") +log = logging.getLogger(__name__) class Worker(QtCore.QObject): @@ -23,13 +23,17 @@ class Worker(QtCore.QObject): imageCreated = pyqtSignal(QtGui.QImage) error = pyqtSignal(str) - def __init__(self, core, settings, queue): + def __init__(self, core, settings): super().__init__() self.core = core self.settings = settings + self.queue = Queue() + self.newBackground() + self.frameNo = 0 + + def newBackground(self): width = int(self.settings.value("outputWidth")) height = int(self.settings.value("outputHeight")) - self.queue = queue self.background = Checkerboard(width, height) @disableWhenOpeningProject @@ -39,34 +43,34 @@ def createPreviewImage(self, components): "components": components, } self.queue.put(dic) - log.debug("Preview thread id: {}".format(int(QtCore.QThread.currentThreadId()))) @pyqtSlot() def process(self): + """Process one preview image from the queue""" try: nextPreviewInformation = self.queue.get(block=False) while self.queue.qsize() >= 2: try: self.queue.get(block=False) except Empty: - continue - width = int(self.settings.value("outputWidth")) - height = int(self.settings.value("outputHeight")) - if self.background.width != width or self.background.height != height: - self.background = Checkerboard(width, height) - + break + timeElapsed = time.time() frame = self.background.copy() - log.info("Creating new preview frame") components = nextPreviewInformation["components"] for component in reversed(components): try: - component.lockSize(width, height) - if "composite" in component.properties(): + lockAcquired = component.lockSize(frame.width, frame.height) + if not lockAcquired: + break + isCompositeComponent = "composite" in component.properties() + if isCompositeComponent: newFrame = component.previewRender(frame) else: newFrame = component.previewRender() - component.unlockSize() - frame = Image.alpha_composite(frame, newFrame) + if isCompositeComponent: + frame = newFrame + else: + frame = Image.alpha_composite(frame, newFrame) except (AttributeError, ValueError) as e: errMsg = ( @@ -79,7 +83,12 @@ def process(self): "is None" if newFrame is None else "size was %s*%s; should be %s*%s" - % (newFrame.width, newFrame.height, width, height) + % ( + newFrame.width, + newFrame.height, + frame.width, + frame.height, + ) ), ) ) @@ -87,12 +96,27 @@ def process(self): self.error.emit(errMsg) break except RuntimeError as e: - log.error(str(e)) + log.critical(str(e)) + self.error.emit(str(e)) + break + finally: + try: + component.unlockSize() + except RuntimeError: + log.critical(str(e)) + break else: # We must store a reference to this QImage # or else Qt will garbage-collect it on the C++ side self.frame = ImageQt(frame) + timeElapsed = time.time() - timeElapsed + self.frameNo += 1 + log.info( + "Generated preview frame #{0} in {1:.3f}s using {2} components".format( + self.frameNo, timeElapsed, len(components) + ) + ) self.imageCreated.emit(QtGui.QImage(self.frame)) except Empty: - True + pass diff --git a/src/avp/gui/preview_win.py b/src/avp/gui/preview_win.py index f52f8a3..83e4c44 100644 --- a/src/avp/gui/preview_win.py +++ b/src/avp/gui/preview_win.py @@ -1,7 +1,7 @@ from PyQt6 import QtCore, QtGui, QtWidgets import logging -log = logging.getLogger("AVP.Gui.PreviewWindow") +log = logging.getLogger(__name__) class PreviewWindow(QtWidgets.QLabel): @@ -55,4 +55,4 @@ def mousePressEvent(self, event): @QtCore.pyqtSlot(str) def threadError(self, msg): self.parent.showMessage(msg=msg, icon="Critical", parent=self) - log.info("%", repr(self.parent)) + log.info("%s", repr(self.parent)) diff --git a/src/avp/gui/undostack.py b/src/avp/gui/undostack.py index fd1a3e9..394dc0d 100644 --- a/src/avp/gui/undostack.py +++ b/src/avp/gui/undostack.py @@ -1,5 +1,5 @@ from PyQt6.QtGui import QUndoStack -from ..toolkit.common import disableWhenEncoding +from ..toolkit import disableWhenEncoding class UndoStack(QUndoStack): diff --git a/src/avp/libcomponent/__init__.py b/src/avp/libcomponent/__init__.py index 5b04b45..1fcc37b 100644 --- a/src/avp/libcomponent/__init__.py +++ b/src/avp/libcomponent/__init__.py @@ -1,4 +1,4 @@ -from .component import Component as BaseComponent +from .component import BaseComponent from .exceptions import ComponentError __all__ = [BaseComponent, ComponentError] diff --git a/src/avp/libcomponent/actions.py b/src/avp/libcomponent/actions.py index f534685..5027e34 100644 --- a/src/avp/libcomponent/actions.py +++ b/src/avp/libcomponent/actions.py @@ -1,62 +1,48 @@ """ -QUndoCommand class for generic undoable user actions performed to a BaseComponent - -See `../life.py` for an example of a component that uses a custom QUndoCommand +QUndoCommand classes for undoable user actions performed to a component """ +from PyQt6 import QtCore from PyQt6.QtGui import QUndoCommand from copy import copy import logging -log = logging.getLogger("AVP.ComponentHandler") +from ..toolkit.common import blockSignals + +log = logging.getLogger(__name__) -class ComponentUpdate(QUndoCommand): - """Command object for making a component action undoable""" +class ComponentTrackedWidgetUpdate(QUndoCommand): + """ + This QUndoCommand represents value changes in a component's `page` (its UI widget) + It is used by the BaseComponent class for input widgets tracked by `trackWidgets()` + """ def __init__(self, parent, oldWidgetVals, modifiedVals): - super().__init__("change %s component #%s" % (parent.name, parent.compPos)) + super().__init__( + "change %s component #%s %s" + % ( + parent.name, + parent.compPos, + list(modifiedVals.keys())[0], + ) + ) self.undone = False self.res = (int(parent.width), int(parent.height)) self.parent = parent self.oldWidgetVals = { - attr: ( - copy(val) - if attr not in self.parent._relativeWidgets - else self.parent.floatValForAttr(attr, val, axis=self.res) - ) + attr: (copy(val)) for attr, val in oldWidgetVals.items() if attr in modifiedVals } - self.modifiedVals = { - attr: ( - val - if attr not in self.parent._relativeWidgets - else self.parent.floatValForAttr(attr, val, axis=self.res) - ) - for attr, val in modifiedVals.items() - } - - # Because relative widgets change themselves every update based on - # their previous value, we must store ALL their values in case of undo - self.relativeWidgetValsAfterUndo = { - attr: copy(getattr(self.parent, attr)) - for attr in self.parent._relativeWidgets - } + self.modifiedVals = {attr: (val) for attr, val in modifiedVals.items()} # Determine if this update is mergeable self.id_ = -1 if self.parent.mergeUndo: - if len(self.modifiedVals) == 1: - attr, val = self.modifiedVals.popitem() - self.id_ = sum([ord(letter) for letter in attr[-14:]]) - self.modifiedVals[attr] = val - return - log.warning( - "%s component settings changed at once. (%s)", - len(self.modifiedVals), - repr(self.modifiedVals), - ) + attr, val = self.modifiedVals.popitem() + self.id_ = sum([ord(letter) for letter in attr[-14:]]) + self.modifiedVals[attr] = val def id(self): """If 2 consecutive updates have same id, Qt will call mergeWith()""" @@ -64,41 +50,151 @@ def id(self): def mergeWith(self, other): self.modifiedVals.update(other.modifiedVals) + for attr, val in self.modifiedVals.items(): + if self.oldWidgetVals[attr] == val: + self.setObsolete(True) return True - def setWidgetValues(self, attrDict): - """ - Mask the component's usual method to handle our - relative widgets in case the resolution has changed. - """ - newAttrDict = { - attr: ( - val - if attr not in self.parent._relativeWidgets - else self.parent.pixelValForAttr(attr, val) - ) - for attr, val in attrDict.items() - } - self.parent.setWidgetValues(newAttrDict) + def do(self, widgetValues): + self.parent.setWidgetValues(widgetValues) + self.parent.update(auto=True, origin="tracked widget update") def redo(self): if self.undone: - log.info("Redoing component update") - self.parent.oldAttrs = self.relativeWidgetValsAfterUndo - self.setWidgetValues(self.modifiedVals) - self.parent.update(auto=True) - self.parent.oldAttrs = None - if not self.undone: - self.relativeWidgetValsAfterRedo = { - attr: copy(getattr(self.parent, attr)) - for attr in self.parent._relativeWidgets - } - self.parent._sendUpdateSignal() + log.info( + "Redoing %s #%s tracked widget update", + self.parent.name, + self.parent.compPos, + ) + self.do(self.modifiedVals) def undo(self): - log.info("Undoing component update") + log.info( + "Undoing %s #%s tracked widget update", + self.parent.name, + self.parent.compPos, + ) self.undone = True - self.parent.oldAttrs = self.relativeWidgetValsAfterRedo - self.setWidgetValues(self.oldWidgetVals) - self.parent.update(auto=True) - self.parent.oldAttrs = None + self.do(self.oldWidgetVals) + + +class ComponentPreviewClick(QUndoCommand): + """ + This QUndoCommand represents the user clicking the preview window. + A component that responds to preview click events must define a subclass + which defines `add()` and `remove()` to respond to left and right mouse buttons. + This component should then create instances of its subclass and + add them to the undoStack within a `previewClickEvent` method. + """ + + def __init__(self, comp, pos, size, button): + super().__init__("click %s component #%s" % (comp.name, comp.compPos)) + self.comp = comp + self.pos = [pos] + self.size = size + if button == QtCore.Qt.MouseButton.RightButton: + self.button = 2 + else: + self.button = 1 + + def id(self): + return self.button + + def mergeWith(self, other): + self.pos.extend(other.pos) + return True + + def redo(self): + if self.button == 1: # Left-click + self.add() + elif self.button == 2: # Right-click + self.remove() + + def undo(self): + if self.button == 1: # Left-click + self.remove() + elif self.button == 2: # Right-click + self.add() + + def add(self): ... + + def remove(self): ... + + +class ComponentSettingsUpdate(QUndoCommand): + """ + This QUndoCommand represents any change to a component's settings + not already covered by another action type above. + A component should define a subclass to define `redo()` and `undo()`, + manually create instances, and add them to the undoStack when needed. + """ + + def __init__(self, comp, title=""): + super().__init__("bring %s component #%s %s" % (comp.name, comp.compPos, title)) + self.comp = comp + self.res = (int(comp.width), int(comp.height)) + + def id(self): + return -1 + + def mergeWith(self): + return True + + def redo(self): ... + + def undo(self): ... + + +class ComponentPreviewXYClick(ComponentPreviewClick): + def __init__(self, *args): + super().__init__(*args) + self.res = (self.comp.width, self.comp.height) + self.oldXY = ( + self.comp.floatValForAttr("xPosition", axis=self.res), + self.comp.floatValForAttr("yPosition", axis=self.res), + ) + + def add(self): + for pos in self.pos[:]: + with blockSignals(self.comp): + self.comp.setRelativeWidget("xPosition", pos[0] / self.size[0]) + self.comp.setRelativeWidget("yPosition", pos[1] / self.size[1]) + self.comp.update(auto=True, origin="ClickPreviewAction") + + def remove(self): + self.comp.setWidgetValues( + { + "xPosition": self.comp.pixelValForAttr( + "xPosition", self.oldXY[0], self.res + ), + "yPosition": self.comp.pixelValForAttr( + "yPosition", self.oldXY[1], self.res + ), + } + ) + self.comp.update(auto=True, origin="ClickPreviewXYAction") + + +class ComponentCenterXYAction(ComponentSettingsUpdate): + def __init__(self, comp): + super().__init__(comp, "to center") + self.oldXY = ( + self.comp.floatValForAttr("xPosition", axis=self.res), + self.comp.floatValForAttr("yPosition", axis=self.res), + ) + + def redo(self): + self.comp.centerXY() + + def undo(self): + self.comp.setWidgetValues( + { + "xPosition": self.comp.pixelValForAttr( + "xPosition", self.oldXY[0], self.res + ), + "yPosition": self.comp.pixelValForAttr( + "yPosition", self.oldXY[1], self.res + ), + } + ) + self.comp.update(auto=True, origin="ComponentCenterXYAction") diff --git a/src/avp/libcomponent/component.py b/src/avp/libcomponent/component.py index 1f81e07..a18f22b 100644 --- a/src/avp/libcomponent/component.py +++ b/src/avp/libcomponent/component.py @@ -6,13 +6,14 @@ from PyQt6 import uic, QtCore, QtWidgets from PyQt6.QtGui import QColor import os -import math import logging from copy import copy + from .metaclass import ComponentMetaclass -from .actions import ComponentUpdate +from .actions import ComponentTrackedWidgetUpdate from .exceptions import ComponentError +from ..toolkit import logWidgetValues from ..toolkit.frame import BlankFrame from ..toolkit import ( @@ -21,54 +22,59 @@ rgbFromString, randomColor, blockSignals, + isVerticalWord, ) -log = logging.getLogger("AVP.BaseComponent") +log = logging.getLogger(__name__) -class Component(QtCore.QObject, metaclass=ComponentMetaclass): +class BaseComponent(QtCore.QObject, metaclass=ComponentMetaclass): """ The base class for components to inherit. """ - name = "Component" - # ui = 'name_Of_Non_Default_Ui_File' + name = "BaseComponent" + + # if `ui` is undefined, AVP assumes it shares a basename with this .py file + ui = "__template__.ui" - version = "1.0.0" + version = "2.0.0" # The major version (before the first dot) is used to determine # preset compatibility; the rest is ignored so it can be non-numeric. modified = QtCore.pyqtSignal(int, dict) _error = QtCore.pyqtSignal(str, str) - def __init__(self, moduleIndex, compPos, core): + def __init__(self, moduleIndex, core): super().__init__() self.moduleIndex = moduleIndex - self.compPos = compPos + self.compPos = -1 self.core = core - - # STATUS VARIABLES + self._width = int(core.settings.value("outputWidth")) + self._height = int(core.settings.value("outputHeight")) self.currentPreset = None self._allWidgets = {} self._trackedWidgets = {} self._presetNames = {} self._commandArgs = {} + + # Color widgets link a pushbutton and lineedit together + # for components to get a color choice from the user self._colorWidgets = {} self._colorFuncs = {} + + # Relative widgets are relative to the output size (resolution) self._relativeWidgets = {} - # Pixel values stored as floats - self._relativeValues = {} - # Maximum values of spinBoxes at 1080p (Core.resolutions[0]) - self._relativeMaximums = {} + self._relativeWidgetMaximums = {} + self._relativeWidgetFloats = {} - # LOCKING VARIABLES + # "Locks" self.openingPreset = False self.mergeUndo = True self._lockedProperties = None self._lockedError = None self._lockedSize = None - # If set to a dict, values are used as basis to update relative widgets - self.oldAttrs = None + # Stop lengthy processes in response to this variable self.canceled = False @@ -102,8 +108,9 @@ def previewRender(self): def preFrameRender(self, **kwargs): """ + Occurs once before export begins, before first call to frameRender Must call super() when subclassing - Triggered only before a video is exported (video_thread.py) + Triggered only before a video is exported (in `video_thread.py`) self.audioFile = filepath to the main input audio file self.completeAudioArray = a list of audio samples self.sampleSize = number of audio samples per video frame @@ -116,12 +123,17 @@ def preFrameRender(self, **kwargs): setattr(self, key, value) def frameRender(self, frameNo): + """Occurs once per frame exported""" + # Example code: audioArrayIndex = frameNo * self.sampleSize image = BlankFrame(self.width, self.height) return image def postFrameRender(self): - pass + """ + Occurs once after the final call to frameRender, + for cleaning up when export completes or is cancelled. + """ # =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ # Properties @@ -162,21 +174,23 @@ def audio(self): # Idle Methods # =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ - def widget(self, parent): + def widget(self, loader): """ Call super().widget(*args) to create the component widget which also auto-connects any common widgets (e.g., checkBoxes) to self.update(). Then in a subclass connect special actions (e.g., pushButtons to select a file) and initialize """ - self.parent = parent - self.settings = parent.settings - log.verbose( - "Creating UI for %s #%s's widget", - self.__class__.name, - self.compPos, - ) - self.page = self.loadUi(self.__class__.ui) + if loader.__class__.__name__ not in ("MainWindow", "Command"): + raise ValueError("`loader` must be a MainWindow or Command object") + self.loader = loader + + if not hasattr(self, "page"): + log.debug( + "Creating UI for %s's page widget", + self.__class__.name, + ) + self.page = self.loadUi(self.__class__.ui) # Find all normal widgets which will be connected after subclass method self._allWidgets = { @@ -192,60 +206,96 @@ def widget(self, parent): def update(self): """ Starting point for a component update. A subclass should override - this method, and the base class will then magically insert a call + this method, and the metaclass will then magically insert a call to either _autoUpdate() or _userUpdate() at the end. """ def loadPreset(self, presetDict, presetName=None): """ - Subclasses should take (presetDict, *args) as args. - Must use super().loadPreset(presetDict, *args) first, + Normally does not need to be implemented by the subclass. + If needed, subclasses should take (presetDict, *args) as args, + use super().loadPreset(presetDict, *args) first, then update self.page widgets using the preset dict. """ + getPresetAttrName = lambda attr: ( + attr if attr not in self._presetNames else self._presetNames[attr] + ) self.currentPreset = ( presetName if presetName is not None else presetDict["preset"] ) + currentResolution = (self.width, self.height) + + def upgradeFromOldVersion(presetDict): + """ + Fix relative widget values if resolution wasn't saved into preset + This happens if loading a file from before v2.3.0 + """ + if "resolution" not in presetDict: + log.warning( + "%s #%s's%s resolution was not saved. Using project resolution instead.", + self.name, + str(self.compPos), + "" if self.currentPreset is None else " %s" % self.currentPreset, + ) + presetDict["resolution"] = currentResolution + for attr in self._relativeWidgets: + if getPresetAttrName(attr) not in presetDict: + continue + if type(presetDict[getPresetAttrName(attr)]) == float: + presetDict[getPresetAttrName(attr)] = self.pixelValForAttr( + attr, presetDict[getPresetAttrName(attr)] + ) + return presetDict + + presetDict = upgradeFromOldVersion(presetDict) + + self._width, self._height = presetDict["resolution"] for attr, widget in self._trackedWidgets.items(): - key = attr if attr not in self._presetNames else self._presetNames[attr] + key = getPresetAttrName(attr) try: val = presetDict[key] except KeyError as e: - log.info( - "%s missing value %s. Outdated preset?", - self.currentPreset, + log.warning( + "%s #%s%s is missing value %s. Outdated preset?", + self.name, + self.compPos, + ( + "'s %s" % self.currentPreset + if self.currentPreset is not None + else "" + ), str(e), ) val = getattr(self, key) if attr in self._colorWidgets: - widget.setText("%s,%s,%s" % val) + with blockSignals(widget): + widget.setText("%s,%s,%s" % val) btnStyle = ( "QPushButton { background-color : %s; outline: none; }" % QColor(*val).name() ) self._colorWidgets[attr].setStyleSheet(btnStyle) - elif attr in self._relativeWidgets: - self._relativeValues[attr] = val - pixelVal = self.pixelValForAttr(attr, val) - setWidgetValue(widget, pixelVal) else: - setWidgetValue(widget, val) + if attr in self._relativeWidgets: + self._updateRelativeWidgetFloat(attr, val) + with blockSignals(widget): + setWidgetValue(widget, val) + if presetDict["resolution"] != currentResolution: + self.updateResolution() + else: + self.update(auto=True, origin="loadPreset") def savePreset(self): saveValueStore = {} - for attr, widget in self._trackedWidgets.items(): + for attr in self._trackedWidgets: presetAttrName = ( attr if attr not in self._presetNames else self._presetNames[attr] ) - if attr in self._relativeWidgets: - try: - val = self._relativeValues[attr] - except AttributeError: - val = self.floatValForAttr(attr) - else: - val = getattr(self, attr) + val = getattr(self, attr) saveValueStore[presetAttrName] = val + saveValueStore["resolution"] = (self.width, self.height) return saveValueStore def commandHelp(self): @@ -270,8 +320,6 @@ def command(self, arg=""): # =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ def _preUpdate(self): """Happens before subclass update()""" - for attr in self._relativeWidgets: - self.updateRelativeWidget(attr) def _userUpdate(self): """Happens after subclass update() for an undoable update by user.""" @@ -292,17 +340,61 @@ def _userUpdate(self): if val != oldWidgetVals[attr] } if modifiedWidgets: - action = ComponentUpdate(self, oldWidgetVals, modifiedWidgets) - self.parent.undoStack.push(action) + if len(modifiedWidgets) > 1: + for attr in self._relativeWidgets: + if attr in modifiedWidgets: + del modifiedWidgets[attr] + if len(modifiedWidgets) > 1: + log.warning( + "%s component settings changed at once. (%s)", + len(modifiedWidgets), + repr(modifiedWidgets), + ) + return + if modifiedWidgets: + action = ComponentTrackedWidgetUpdate(self, oldWidgetVals, modifiedWidgets) + self.loader.undoStack.push(action) - def _autoUpdate(self): + def _autoUpdate(self, origin=None): """Happens after subclass update() for an internal component update.""" newWidgetVals = { attr: getWidgetValue(widget) for attr, widget in self._trackedWidgets.items() } + for attr in self._relativeWidgets: + self._updateRelativeWidgetFloat(attr, newWidgetVals[attr]) self.setAttrs(newWidgetVals) self._sendUpdateSignal() + logWidgetValues( + self, + newWidgetVals, + f"{'unknown' if origin is None else origin} through autoupdate", + ) + + def updateResolution(self): + newWidth = int(self.core.settings.value("outputWidth")) + newHeight = int(self.core.settings.value("outputHeight")) + newResolution = (newWidth, newHeight) + log.debug( + "Updating relative widget values for %s #%s from %sx%s to %sx%s.", + self.name, + str(self.compPos), + self.width, + self.height, + *newResolution, + ) + for attr in self._relativeWidgets: + newVal = self.pixelValForAttr( + attr, + self._relativeWidgetFloats[attr], + axis=newResolution, + ) + self._updateRelativeWidgetMaximum(attr, newResolution) + with blockSignals(self._trackedWidgets[attr]): + self._trackedWidgets[attr].setValue(newVal) + self._width = newWidth + self._height = newHeight + self.update(auto=True, origin="updateResolution") def setAttrs(self, attrDict): """ @@ -326,7 +418,6 @@ def setAttrs(self, attrDict): else: # Normal tracked widget setattr(self, attr, val) - log.verbose("Setting %s self.%s to %s" % (self.__class__.name, attr, val)) def setWidgetValues(self, attrDict): """ @@ -339,14 +430,18 @@ def setWidgetValues(self, attrDict): widget = self._trackedWidgets[attr] if attr in self._colorWidgets: val = "%s,%s,%s" % val + if attr in self._relativeWidgets: + self._updateRelativeWidgetFloat(attr, val) setWidgetValue(widget, val) def _sendUpdateSignal(self): - if not self.core.openingProject: - self.parent.drawPreview() - saveValueStore = self.savePreset() - saveValueStore["preset"] = self.currentPreset - self.modified.emit(self.compPos, saveValueStore) + if self.core.openingProject: + # TODO use `disableWhenOpeningProject` decorator + return + saveValueStore = self.savePreset() + saveValueStore["preset"] = self.currentPreset + saveValueStore["resolution"] = (self.width, self.height) + self.modified.emit(self.compPos, saveValueStore) def trackWidgets(self, trackDict, **kwargs): """ @@ -404,15 +499,17 @@ def pickColor_(): ).name() ) - if kwarg == "relativeWidgets": + elif kwarg == "relativeWidgets": # store maximum values of spinBoxes to be scaled appropriately for attr in kwargs[kwarg]: - self._relativeMaximums[attr] = self._trackedWidgets[attr].maximum() - self.updateRelativeWidgetMaximum(attr) - setattr(self, attr, getWidgetValue(self._trackedWidgets[attr])) - - self._preUpdate() - self._autoUpdate() + self._relativeWidgetMaximums[attr] = self._trackedWidgets[ + attr + ].maximum() + self._updateRelativeWidgetMaximum(attr, (self.width, self.height)) + self._updateRelativeWidgetFloat( + attr, getWidgetValue(self._trackedWidgets[attr]) + ) + # self.update(auto=True, origin="trackWidgets") def pickColor(self, textWidget, button): """Use color picker to get color input from the user.""" @@ -441,7 +538,11 @@ def lockError(self, msg): self._lockedError = msg def lockSize(self, w, h): + if self._lockedSize is not None: + log.warning("%s #%s is already locked.", self.name, str(self.compPos)) + return False self._lockedSize = (w, h) + return True def unlockProperties(self): self._lockedProperties = None @@ -450,7 +551,11 @@ def unlockError(self): self._lockedError = None def unlockSize(self): + if self._lockedSize is None: + log.warning("%s #%s is already unlocked.", self.name, str(self.compPos)) + return False self._lockedSize = None + return True def loadUi(self, filename): """Load a Qt Designer ui file to use for this component's widget""" @@ -459,14 +564,14 @@ def loadUi(self, filename): @property def width(self): if self._lockedSize is None: - return int(self.settings.value("outputWidth")) + return self._width else: return self._lockedSize[0] @property def height(self): if self._lockedSize is None: - return int(self.settings.value("outputHeight")) + return self._height else: return self._lockedSize[1] @@ -479,105 +584,73 @@ def reset(self): self.unlockProperties() self.unlockError() - def relativeWidgetAxis(func): - def relativeWidgetAxis(self, attr, *args, **kwargs): - hasVerticalWords = ( - lambda attr: "height" in attr.lower() - or "ypos" in attr.lower() - or attr == "y" - ) - if "axis" not in kwargs: - axis = self.width - if hasVerticalWords(attr): - axis = self.height - kwargs["axis"] = axis - if "axis" in kwargs and type(kwargs["axis"]) is tuple: - axis = kwargs["axis"][0] - if hasVerticalWords(attr): - axis = kwargs["axis"][1] - kwargs["axis"] = axis - return func(self, attr, *args, **kwargs) - - return relativeWidgetAxis - - @relativeWidgetAxis - def pixelValForAttr(self, attr, val=None, **kwargs): + def pixelValForAttr(self, attr=None, val=None, axis=None): + """ + Get pixel value from a relativeWidget float. + `attr`: string name of relativeWidget + `val`: optional float; uses _relativeWidgets[attr] if None + `axis`: optional tuple of (width, height); height used if attr "seems vertical" + """ + if axis is None: + axis = (self.width, self.height) + if type(axis) not in (float, int): + axis = axis[1] if isVerticalWord(attr) else axis[0] if val is None: - val = self._relativeValues[attr] - if val > 50.0: - log.warning( - "%s #%s attempted to set %s to dangerously high number %s", - self.__class__.name, - self.compPos, - attr, - val, - ) - val = 50.0 - result = math.ceil(kwargs["axis"] * val) - log.verbose( - "Converting %s: f%s to px%s using axis %s", - attr, - val, - result, - kwargs["axis"], - ) - return result - - @relativeWidgetAxis - def floatValForAttr(self, attr, val=None, **kwargs): + if attr is None: + raise ValueError("`attr` must be a string if `val` is None.") + val = self._trackedWidgets[attr].value() / axis + return round(val * axis) + + def floatValForAttr(self, attr=None, val=None, axis=None): + """Return a value from 0.0 to 1.0 using the absolute value divided by maxResolution. + If `axis` is not maxResolution, value will be scaled up (mutated) appropriately. + If `axis` is a tuple, we guess whether to divide by width or height based on attr. + """ + if axis is None: + axis = (self.width, self.height) if val is None: + if attr is None: + raise ValueError("`attr` must be a string if `val` is None.") val = self._trackedWidgets[attr].value() - return val / kwargs["axis"] - def setRelativeWidget(self, attr, floatVal): + # Convert pixel value to 1080 if needed + convert = False + if axis != self.core.maxResolution: + convert = True + if type(axis) not in (int, float): + axis = axis[1] if isVerticalWord(attr) else axis[0] + + maxis = ( + self.core.maxResolution[1] + if isVerticalWord(attr) + else self.core.maxResolution[0] + ) + if convert: + val = (val / axis) * maxis + return val / maxis + + def setRelativeWidget(self, attr, floatVal, axis=None): """Set a relative widget using a float""" - pixelVal = self.pixelValForAttr(attr, floatVal) + if axis is None: + axis = (self.width, self.height) + self._updateRelativeWidgetFloat(attr, floatVal) + pixelVal = self.pixelValForAttr(attr, floatVal, axis) with blockSignals(self._trackedWidgets[attr]): self._trackedWidgets[attr].setValue(pixelVal) - self.update(auto=True) - - def getOldAttr(self, attr): - """ - Returns previous state of this attr. Used to determine whether - a relative widget must be updated. Required because undoing/redoing - can make determining the 'previous' value tricky. - """ - if self.oldAttrs is not None: - return self.oldAttrs[attr] - else: - try: - return getattr(self, attr) - except AttributeError: - log.error("Using visible values instead of oldAttrs") - return self._trackedWidgets[attr].value() - - def updateRelativeWidget(self, attr): - """Called by _preUpdate() for each relativeWidget before each update""" - oldUserValue = self.getOldAttr(attr) - newUserValue = self._trackedWidgets[attr].value() - newRelativeVal = self.floatValForAttr(attr, newUserValue) - - if attr in self._relativeValues: - oldRelativeVal = self._relativeValues[attr] - if oldUserValue == newUserValue and oldRelativeVal != newRelativeVal: - # Float changed without pixel value changing, which - # means the pixel value needs to be updated - # TODO QDoubleSpinBox doesn't work with relativeWidgets because of this - log.debug( - "Updating %s #%s's relative widget: %s", - self.__class__.name, - self.compPos, - attr, - ) - with blockSignals(self._trackedWidgets[attr]): - self.updateRelativeWidgetMaximum(attr) - pixelVal = self.pixelValForAttr(attr, oldRelativeVal) - self._trackedWidgets[attr].setValue(pixelVal) - - if attr not in self._relativeValues or oldUserValue != newUserValue: - self._relativeValues[attr] = newRelativeVal + self.update(auto=True, origin="setRelativeWidget") - def updateRelativeWidgetMaximum(self, attr): - maxRes = int(self.core.resolutions[0].split("x")[0]) - newMaximumValue = self.width * (self._relativeMaximums[attr] / maxRes) + def _updateRelativeWidgetMaximum(self, attr, newResolution): + newMaximumValue = newResolution[0] * ( + self._relativeWidgetMaximums[attr] + / int(self.core.resolutions[0].split("x")[0]) + ) self._trackedWidgets[attr].setMaximum(int(newMaximumValue)) + + def _updateRelativeWidgetFloat(self, attr, newVal): + if type(newVal) != float: + newVal = self.floatValForAttr(attr, newVal) + self._relativeWidgetFloats[attr] = newVal + if log.isEnabledFor(logging.INFO): + self._trackedWidgets[attr].setToolTip( + "relative value: {0:.3f}".format(newVal) + ) diff --git a/src/avp/libcomponent/exceptions.py b/src/avp/libcomponent/exceptions.py index 5498414..33f8471 100644 --- a/src/avp/libcomponent/exceptions.py +++ b/src/avp/libcomponent/exceptions.py @@ -5,7 +5,7 @@ from ..toolkit import formatTraceback -log = logging.getLogger("AVP.ComponentHandler") +log = logging.getLogger(__name__) class ComponentError(RuntimeError): diff --git a/src/avp/libcomponent/metaclass.py b/src/avp/libcomponent/metaclass.py index e8ad949..e56e81a 100644 --- a/src/avp/libcomponent/metaclass.py +++ b/src/avp/libcomponent/metaclass.py @@ -3,10 +3,10 @@ from PyQt6 import QtCore from .exceptions import ComponentError -from ..toolkit import connectWidget +from ..toolkit import connectWidget, hasUndoStack from ..toolkit.frame import BlankFrame -log = logging.getLogger("AVP.ComponentHandler") +log = logging.getLogger(__name__) class ComponentMetaclass(type(QtCore.QObject)): @@ -30,11 +30,6 @@ def initializationWrapper(self, *args, **kwargs): def renderWrapper(func): def renderWrapper(self, *args, **kwargs): try: - log.verbose( - "### %s #%s renders a preview frame ###", - self.__class__.name, - str(self.compPos), - ) return func(self, *args, **kwargs) except Exception as e: try: @@ -128,9 +123,10 @@ def updateWrapper(func): """ class wrap: - def __init__(self, comp, auto): + def __init__(self, comp, auto, origin): self.comp = comp self.auto = auto + self.origin = origin def __enter__(self): self.comp._preUpdate() @@ -139,17 +135,17 @@ def __exit__(self, *args): if ( self.auto or self.comp.openingPreset - or not hasattr(self.comp.parent, "undoStack") + or not hasUndoStack(self.comp.loader) ): - log.verbose("Automatic update") - self.comp._autoUpdate() + self.comp._autoUpdate(self.origin) else: - log.verbose("User update") self.comp._userUpdate() def updateWrapper(self, **kwargs): - auto = kwargs["auto"] if "auto" in kwargs else False - with wrap(self, auto): + auto = kwargs.get("auto", False) + origin = kwargs.get("origin", "metaclass") + + with wrap(self, auto, origin): try: return func(self) except Exception: @@ -171,13 +167,19 @@ def __enter__(self): pass def __exit__(self, *args): + connectedWidgets = 0 for widgetList in self.comp._allWidgets.values(): for widget in widgetList: - log.verbose("Connecting %s", str(widget.__class__.__name__)) + connectedWidgets += 1 connectWidget(widget, self.comp.update) + log.debug( + "Connected %s widgets from %s #%s", + str(connectedWidgets), + self.comp.name, + str(self.comp.compPos), + ) def widgetWrapper(self, *args, **kwargs): - auto = kwargs["auto"] if "auto" in kwargs else False with wrap(self): try: return func(self, *args, **kwargs) diff --git a/src/avp/toolkit/common.py b/src/avp/toolkit/common.py index a6195ed..c38d74e 100644 --- a/src/avp/toolkit/common.py +++ b/src/avp/toolkit/common.py @@ -12,7 +12,7 @@ from collections import OrderedDict -log = logging.getLogger("AVP.Toolkit.Common") +log = logging.getLogger(__name__) class blockSignals: @@ -28,16 +28,11 @@ def __init__(self, widgets): self.widgets = widgets if hasattr(widgets, "__iter__") else [widgets] def __enter__(self): - log.verbose( - "Blocking signals for %s", - ", ".join([str(w.__class__.__name__) for w in self.widgets]), - ) self.oldStates = [w.signalsBlocked() for w in self.widgets] for w in self.widgets: w.blockSignals(True) def __exit__(self, *args): - log.verbose("Resetting blockSignals to %s", str(bool(sum(self.oldStates)))) for w, state in zip(self.widgets, self.oldStates): w.blockSignals(state) @@ -154,8 +149,11 @@ def formatTraceback(tb=None): return "Traceback:\n%s" % "\n".join(traceback.format_tb(tb)) -def connectWidget(widget, func): - unsupportedWidgets = ["QtWidgets.QFontComboBox"] +def connectWidget(widget, func, unsupportedWidgets=None): + if unsupportedWidgets is None: + unsupportedWidgets = ["QFontComboBox"] + widgetClassName = widget.__class__.__name__ + if type(widget) == QtWidgets.QLineEdit: widget.textChanged.connect(func) elif type(widget) == QtWidgets.QSpinBox or type(widget) == QtWidgets.QDoubleSpinBox: @@ -164,19 +162,19 @@ def connectWidget(widget, func): widget.stateChanged.connect(func) elif type(widget) == QtWidgets.QComboBox: widget.currentIndexChanged.connect(func) - elif type(widget) in unsupportedWidgets: - log.info( - "Could not connect %s using connectWidget()", str(widget.__class__.__name__) + elif widgetClassName in unsupportedWidgets: + log.debug( + "%s is not supported by connectWidget()", + widgetClassName, ) else: - log.warning("Failed to connect %s ", str(widget.__class__.__name__)) + log.info("%s is unknown and unsupported by connectWidget()", widgetClassName) return False return True def setWidgetValue(widget, val): """Generic setValue method for use with any typical QtWidget""" - log.verbose("Setting %s to %s" % (str(widget.__class__.__name__), val)) if type(widget) == QtWidgets.QLineEdit: widget.setText(val) elif type(widget) == QtWidgets.QSpinBox or type(widget) == QtWidgets.QDoubleSpinBox: @@ -186,7 +184,9 @@ def setWidgetValue(widget, val): elif type(widget) == QtWidgets.QComboBox: widget.setCurrentIndex(val) else: - log.warning("Failed to set %s ", str(widget.__class__.__name__)) + log.warning( + "%s is not supported by setWidgetValue()", str(widget.__class__.__name__) + ) return False return True @@ -200,7 +200,35 @@ def getWidgetValue(widget): return widget.isChecked() elif type(widget) == QtWidgets.QComboBox: return widget.currentIndex() + log.warning( + "%s is not supported by getWidgetValue()", str(widget.__class__.__name__) + ) + + +def logWidgetValues(component, attrDict, origin=None): + log.debug( + "Set %s #%s's settings to %s by %s", + component.name, + str(component.compPos), + ", ".join( + ["'%s: %s'" % (key, str(getattr(component, key))) for key in attrDict] + ), + "unknown" if origin is None else str(origin), + ) def randomColor(): return (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)) + + +def hasUndoStack(loader): + """Receives a Command or MainWindow object""" + return hasattr(loader, "undoStack") + + +def isVerticalWord(word): + if not hasattr(word, "lower"): + return False + word = word.lower() + vertWords = ["height", "ypos"] + return any([vertWord in word for vertWord in vertWords]) or word.endswith("y") diff --git a/src/avp/toolkit/ffmpeg.py b/src/avp/toolkit/ffmpeg.py index 93aa725..62ca13b 100644 --- a/src/avp/toolkit/ffmpeg.py +++ b/src/avp/toolkit/ffmpeg.py @@ -8,14 +8,14 @@ import subprocess import threading import signal -from queue import PriorityQueue +from queue import PriorityQueue, Empty import logging from ..core import Core from .common import checkOutput, pipeWrapper -log = logging.getLogger("AVP.Toolkit.Ffmpeg") +log = logging.getLogger(__name__) class FfmpegVideo: @@ -88,14 +88,16 @@ def __init__(self, **kwargs): self.thread.start() def frame(self, num): - while True: + while not self.parent.canceled: if num in self.finishedFrames: image = self.finishedFrames.pop(num) return image - - i, image = self.frameBuffer.get() - self.finishedFrames[i] = image - self.frameBuffer.task_done() + try: + i, image = self.frameBuffer.get(block=False) + self.finishedFrames[i] = image + self.frameBuffer.task_done() + except Empty: + continue def fillBuffer(self): from ..libcomponent import ComponentError @@ -124,9 +126,7 @@ def fillBuffer(self): bufsize=10**8, ) - while True: - if self.parent.canceled: - break + while not self.parent.canceled: self.frameNo += 1 # If we run out of frames, use the last good frame and loop. @@ -157,6 +157,9 @@ def fillBuffer(self): self.frameBuffer.put((self.frameNo, self.currentFrame)) self.lastFrame = self.currentFrame + def stop(self): + closePipe(self.pipe) + @pipeWrapper def openPipe(commandList, **kwargs): diff --git a/src/avp/toolkit/frame.py b/src/avp/toolkit/frame.py index 829b05b..5b66cd5 100644 --- a/src/avp/toolkit/frame.py +++ b/src/avp/toolkit/frame.py @@ -3,17 +3,16 @@ """ from PyQt6 import QtGui -from PIL import Image, ImageEnhance, ImageChops, ImageFilter +from PIL import Image, ImageEnhance, ImageFilter from PIL.ImageQt import ImageQt from PyQt6 import QtCore -import sys import os import math import logging from .. import core -log = logging.getLogger("AVP.Toolkit.Frame") +log = logging.getLogger(__name__) class FramePainter(QtGui.QPainter): @@ -35,7 +34,7 @@ def setPen(self, penStyle): super().setPen(penStyle) def finalize(self): - log.verbose("Finalizing FramePainter") + log.debug("Finalizing FramePainter") buffer = QtCore.QBuffer() buffer.open(QtCore.QBuffer.OpenModeFlag.ReadWrite) self.image.save(buffer, "PNG") diff --git a/src/avp/video_thread.py b/src/avp/video_thread.py index ecd8c4c..a47ad6d 100644 --- a/src/avp/video_thread.py +++ b/src/avp/video_thread.py @@ -14,6 +14,8 @@ from PIL.ImageQt import ImageQt import numpy +import time +from math import ceil import subprocess as sp import sys import os @@ -30,13 +32,14 @@ ) -log = logging.getLogger("AVP.VideoThread") +log = logging.getLogger(__name__) class Worker(QtCore.QObject): imageCreated = pyqtSignal("QImage") videoCreated = pyqtSignal() + estimatedTimeUpdate = pyqtSignal(str) progressBarUpdate = pyqtSignal(int) progressBarSetText = pyqtSignal(str) encoding = pyqtSignal(bool) @@ -143,11 +146,13 @@ def preFrameRender(self): compNo, comp, ) + self.cancel() + canceledByComponent = True + break compProps = comp.properties() if "error" in compProps or comp._lockedError is not None: self.cancel() - self.canceled = True canceledByComponent = True compError = ( comp.error() if type(comp.error()) is tuple else (comp.error(), "") @@ -238,16 +243,14 @@ def err(): frame = Image.alpha_composite( frame, self.staticComponents[layerNo] ) - + elif frame is None: # bottom-most layer + frame = comp.frameRender(bgI) elif layerNo in self.compositeComponents: - # component that uses previous frame to draw - frame = Image.alpha_composite(frame, comp.frameRender(bgI, frame)) + # component that does its own compositing + frame = comp.frameRender(bgI, frame) else: - # animated component - if frame is None: # bottom-most layer - frame = comp.frameRender(bgI) - else: - frame = Image.alpha_composite(frame, comp.frameRender(bgI)) + # normal animated component + frame = Image.alpha_composite(frame, comp.frameRender(bgI)) except Exception as e: err() return frame @@ -324,6 +327,8 @@ def createVideo(self): # =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ # START CREATING THE VIDEO # =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ + progressTimeTotal = time.time() + progressTimeBetween = 0.0 progressBarValue = 0 self.progressBarUpdate.emit(progressBarValue) # Begin piping into ffmpeg! @@ -347,9 +352,21 @@ def createVideo(self): completion = (audioI / self.audioArrayLen) * 100 if progressBarValue + 1 <= completion: progressBarValue = numpy.floor(completion).astype(int) - msg = "Exporting video: %s%%" % str(int(progressBarValue)) self.progressBarUpdate.emit(progressBarValue) - self.progressBarSetText.emit(msg) + self.progressBarSetText.emit( + f"Exporting video: {int(progressBarValue)}%" + ) + + # update estimated time until finished + curTime = time.time() + progressTimeBetween = curTime - progressTimeTotal + progressTimeTotal = curTime + minutesRemaining = ceil( + (progressTimeBetween * (100 - progressBarValue)) / 60 + ) + s = "s" if minutesRemaining != 1 else "" + timeMessage = f"About {minutesRemaining} minute{s} remaining" + self.estimatedTimeUpdate.emit(timeMessage) # =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ # Finished creating the video! diff --git a/tests/__init__.py b/tests/__init__.py index b08a6bd..608ff03 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -40,7 +40,7 @@ def window(qtbot): initCore() # patch out any modal dialog that might happen MainWindow.showMessage = lambda self, msg, **kwargs: print(msg) - window = MainWindow(None, None) + window = MainWindow(None, None, True) window.clear() qtbot.addWidget(window) window.settings.setValue("outputWidth", 1920) @@ -72,11 +72,11 @@ def initCore(): # use test data path so we can easily see it after # a failed test, and help us understand the config configDir = getTestDataPath("config") - unwanted = ["autosave.avp", "settings.ini"] - for file in unwanted: - filename = os.path.join(configDir, "autosave.avp") - if os.path.exists(filename): - os.remove(filename) + unwantedFiles = ["autosave.avp", "settings.ini"] + for filename in unwantedFiles: + filepath = os.path.join(configDir, filename) + if os.path.exists(filepath): + os.remove(filepath) Core.storeSettings(configDir) return configDir if numWorkers > 0 else None diff --git a/tests/data/config/presets/Classic Visualizer/1/testPreset b/tests/data/config/presets/Classic Visualizer/1/testPreset new file mode 100644 index 0000000..9a659f3 --- /dev/null +++ b/tests/data/config/presets/Classic Visualizer/1/testPreset @@ -0,0 +1 @@ +OrderedDict({'bars': 63, 'invert': False, 'layout': 0, 'preset': 'testPreset', 'scale': 20, 'smooth': 0, 'visColor': (159, 233, 100), 'y': 0}) \ No newline at end of file diff --git a/tests/data/config/projects/testproject.avp b/tests/data/config/projects/testproject.avp index 9639716..471f18c 100644 --- a/tests/data/config/projects/testproject.avp +++ b/tests/data/config/projects/testproject.avp @@ -1,10 +1,10 @@ [Components] Classic Visualizer 1 -OrderedDict({'bars': 63, 'layout': 0, 'preset': None, 'scale': 20, 'smooth': 0, 'visColor': (255, 255, 255), 'y': 0.0}) +OrderedDict({'bars': 63, 'invert': False, 'layout': 0, 'preset': None, 'resolution': (1280, 720), 'scale': 20, 'smooth': 0, 'visColor': (255, 255, 255), 'y': 0}) Color 1 -OrderedDict({'LG_end': 0.0, 'LG_start': 0.0, 'RG_centre': 0.0015625, 'RG_end': 0.0, 'RG_start': 0.0, 'color1': (0, 0, 0), 'color2': (133, 133, 133), 'fillType': 0, 'height': 1.0, 'preset': None, 'spread': 0, 'stretch': False, 'trans': False, 'width': 1.0, 'x': 0.0, 'y': 0.0}) +OrderedDict({'LG_end': 0, 'LG_start': 0, 'RG_centre': 2, 'RG_end': 0, 'RG_start': 0, 'color1': (0, 0, 0), 'color2': (133, 133, 133), 'fillType': 0, 'height': 720, 'preset': None, 'resolution': (1280, 720), 'spread': 0, 'stretch': False, 'trans': False, 'width': 1280, 'x': 0, 'y': 0}) [Settings] componentDir=tests/data/inputfiles diff --git a/tests/data/config/projects/testproject_outdated.avp b/tests/data/config/projects/testproject_outdated.avp new file mode 100644 index 0000000..9639716 --- /dev/null +++ b/tests/data/config/projects/testproject_outdated.avp @@ -0,0 +1,17 @@ +[Components] +Classic Visualizer +1 +OrderedDict({'bars': 63, 'layout': 0, 'preset': None, 'scale': 20, 'smooth': 0, 'visColor': (255, 255, 255), 'y': 0.0}) +Color +1 +OrderedDict({'LG_end': 0.0, 'LG_start': 0.0, 'RG_centre': 0.0015625, 'RG_end': 0.0, 'RG_start': 0.0, 'color1': (0, 0, 0), 'color2': (133, 133, 133), 'fillType': 0, 'height': 1.0, 'preset': None, 'spread': 0, 'stretch': False, 'trans': False, 'width': 1.0, 'x': 0.0, 'y': 0.0}) + +[Settings] +componentDir=tests/data/inputfiles +inputDir=tests/data/inputfiles +presetDir=tests/data/config/presets +projectDir=tests/data/config/projects + +[WindowFields] +lineEdit_audioFile=tests/data/inputfiles/test.ogg +lineEdit_outputFile= diff --git a/tests/test_comp_image.py b/tests/test_comp_image.py index b221df4..db5ee83 100644 --- a/tests/test_comp_image.py +++ b/tests/test_comp_image.py @@ -43,8 +43,9 @@ def test_comp_image_scale_50_720p(coreWithImageComp): comp.page.spinBox_scale.setValue(50) image = comp.previewRender() sum = imageDataSum(image) - comp.parent.settings.setValue("outputHeight", 720) - comp.parent.settings.setValue("outputWidth", 1280) + coreWithImageComp.settings.setValue("outputHeight", 720) + coreWithImageComp.settings.setValue("outputWidth", 1280) + comp.updateResolution() newImage = comp.previewRender() assert image.width == 1920 assert newImage.width == 1280 diff --git a/tests/test_comp_spectrum.py b/tests/test_comp_spectrum.py index 3fddd44..32e4c8f 100644 --- a/tests/test_comp_spectrum.py +++ b/tests/test_comp_spectrum.py @@ -22,8 +22,8 @@ def test_comp_spectrum_previewRender(coreWithSpectrumComp): comp = coreWithSpectrumComp.selectedComponents[0] image = comp.previewRender() - accept_range = 719 # Accept images with ±0.001% difference - expected = 71992628 # This value was extracted on amd64 + accept_range = 719 # Accept images with ±0.001% difference + expected = 71992628 # This value was extracted on amd64 assert imageDataSum(image) == approx(expected, abs=accept_range) @@ -33,3 +33,13 @@ def test_comp_spectrum_renderFrame(coreWithSpectrumComp, audioData): image = comp.frameRender(0) comp.postFrameRender() assert imageDataSum(image) == 117 + + +def test_comp_spectrum_reuses_preview_frame(coreWithSpectrumComp): + comp = coreWithSpectrumComp.selectedComponents[0] + comp.previewRender() + assert comp.previewFrame is not None + assert not comp.changedOptions + oldChunkSize = int(comp.chunkSize) + assert not comp.updateChunksize() + assert oldChunkSize == comp.chunkSize diff --git a/tests/test_comp_text.py b/tests/test_comp_text.py index 20b202d..7075c68 100644 --- a/tests/test_comp_text.py +++ b/tests/test_comp_text.py @@ -1,8 +1,9 @@ from avp.command import Command +from PyQt6 import QtCore from PyQt6.QtGui import QFont from pytestqt import qtbot from pytest import fixture, mark -from . import audioData, command, MockSignal, imageDataSum +from . import audioData, command, window, MockSignal, imageDataSum @fixture @@ -12,6 +13,12 @@ def coreWithTextComp(qtbot, command): yield command.core +@fixture +def windowWithTextComp(qtbot, window): + window.core.insertComponent(0, window.core.moduleIndexFor("Title Text"), window) + yield window + + def setTextSettings(comp): comp.page.spinBox_fontSize.setValue(40) comp.page.checkBox_shadow.setChecked(True) @@ -29,8 +36,9 @@ def setTextSettings(comp): def test_comp_text_renderFrame(coreWithTextComp, width, height): """Call renderFrame of Title Text component added to Command object.""" comp = coreWithTextComp.selectedComponents[0] - comp.parent.settings.setValue("outputWidth", width) - comp.parent.settings.setValue("outputHeight", height) + coreWithTextComp.settings.setValue("outputWidth", width) + coreWithTextComp.settings.setValue("outputHeight", height) + comp.updateResolution() setTextSettings(comp) comp.centerXY() image = comp.frameRender(0) @@ -42,3 +50,70 @@ def test_comp_text_renderFrame(coreWithTextComp, width, height): assert comp.shadY == -2 assert comp.shadBlur == 0 assert imageDataSum(image) == 727403 or 738586 + + +@mark.parametrize("alignment", (0, 1, 2)) +def test_comp_text_alignment(coreWithTextComp, alignment): + comp = coreWithTextComp.selectedComponents[0] + comp.page.comboBox_textAlign.setCurrentIndex(alignment) + assert comp.alignment == alignment + + +def test_comp_text_previewClickEvent(windowWithTextComp): + comp = windowWithTextComp.core.selectedComponents[0] + comp.previewClickEvent((192, 108), (1920, 1080), QtCore.Qt.MouseButton.LeftButton) + assert comp.xPosition == 192 + assert comp.yPosition == 108 + + +def test_comp_text_previewClickEvent_undo_redo(windowWithTextComp): + comp = windowWithTextComp.core.selectedComponents[0] + oldValue = comp.xPosition + comp.previewClickEvent((192, 108), (1920, 1080), QtCore.Qt.MouseButton.LeftButton) + windowWithTextComp.undoStack.undo() + assert comp.xPosition == oldValue + windowWithTextComp.undoStack.redo() + assert comp.xPosition == 192 + + +def test_comp_text_centerText_undo_redo(windowWithTextComp): + comp = windowWithTextComp.core.selectedComponents[0] + comp.page.spinBox_xTextAlign.setValue(0) + comp.addCenterAction() + centeredX = comp.page.spinBox_xTextAlign.value() + windowWithTextComp.undoStack.undo() + assert comp.xPosition == 0 + windowWithTextComp.undoStack.redo() + assert comp.xPosition == centeredX + + +def test_comp_text_fontSize_relative_to_resolution(windowWithTextComp): + comp = windowWithTextComp.core.selectedComponents[0] + # resolution is 1920x1080 + comp.page.spinBox_fontSize.setValue(200) + # set resolution to 1280x720 + windowWithTextComp.updateResolution(1) + assert comp.fontSize == 133 + # set resolution to 854x480 + windowWithTextComp.updateResolution(2) + assert comp.fontSize == 89 + + +def test_comp_text_fontSize_rounding_errors(windowWithTextComp): + """Test that `relativeWidgets` system does not interfere with setValue""" + comp = windowWithTextComp.core.selectedComponents[0] + for i in range(1, 501): + comp.page.spinBox_fontSize.setValue(i) + assert comp.fontSize == i + + +def test_comp_text_fontSize_maximum(windowWithTextComp): + comp = windowWithTextComp.core.selectedComponents[0] + # resolution is 1920x1080 + assert comp.page.spinBox_fontSize.maximum() == 500 + # set resolution to 1280x720 + windowWithTextComp.updateResolution(1) + assert comp.page.spinBox_fontSize.maximum() == 333 + # set resolution to 854x480 + windowWithTextComp.updateResolution(2) + assert comp.page.spinBox_fontSize.maximum() == 222 diff --git a/tests/test_comp_waveform.py b/tests/test_comp_waveform.py index d295dbe..44c6dae 100644 --- a/tests/test_comp_waveform.py +++ b/tests/test_comp_waveform.py @@ -37,4 +37,4 @@ def test_comp_waveform_renderFrame(coreWithWaveformComp, audioData): preFrameRender(audioData, comp) image = comp.frameRender(0) comp.postFrameRender() - assert imageDataSum(image) == 8331360 + assert imageDataSum(image) == 8288016 diff --git a/tests/test_libcomponent.py b/tests/test_libcomponent.py new file mode 100644 index 0000000..4cfd1ab --- /dev/null +++ b/tests/test_libcomponent.py @@ -0,0 +1,84 @@ +from PyQt6 import QtWidgets +from pytestqt import qtbot +from pytest import fixture +from . import command + +from avp.libcomponent import BaseComponent +from avp.toolkit import connectWidget + + +@fixture +def coreWithBaseComp(qtbot, command): + """ + Fixture providing a Command object with BaseComponent component added. + Adding a BaseComponent component is not usually possible, + because it lives outside the `avp.components` module, + but we force it to work by manually instantiating the object. + This allows us to test BaseComponent methods without using a subclass. + """ + baseComp = BaseComponent(-1, command.core) + baseComp.widget(command) + command.core.insertComponent(0, baseComp, command) + yield command.core + + +def addSpinBox(comp, name): + widget = QtWidgets.QSpinBox() + widget.setObjectName(name) + comp.page.horizontalLayout_2.addWidget(widget) + + # Metaclass normally calls connectWidget after a call to widget() + # For some reason this doesn't work with the BaseComponent + # comp.widget(comp.loader) + connectWidget(widget, comp.update) + return widget + + +def test_libcomponent_basecomp_added(coreWithBaseComp): + """Add BaseComponent to core""" + assert len(coreWithBaseComp.selectedComponents) == 1 + + +def test_libcomponent_addWidget_after_widget_method(coreWithBaseComp): + comp = coreWithBaseComp.selectedComponents[0] + name = "spinBox_testValue" + widget = addSpinBox(comp, name) + comp.trackWidgets({"testValue": widget}) + widget.setValue(50) + assert comp.testValue == 50 + + +def test_libcomponent_relativeWidgetFloats(coreWithBaseComp): + comp = coreWithBaseComp.selectedComponents[0] + name = "spinBox_testValue" + widget = addSpinBox(comp, name) + comp.trackWidgets( + {"testValue": widget}, + relativeWidgets=["testValue"], + ) + widget.setValue(50) + assert comp._relativeWidgetFloats["testValue"] == comp.floatValForAttr( + "testValue", 50 + ) + + +def test_libcomponent_relativeWidget_pixelVal_after_repeated_resizes(coreWithBaseComp): + comp = coreWithBaseComp.selectedComponents[0] + name = "spinBox_testValue" + widget = addSpinBox(comp, name) + comp.trackWidgets( + {"testValue": widget}, + relativeWidgets=["testValue"], + ) + widget.setValue(50) + assert comp.testValue == 50 + coreWithBaseComp.settings.setValue("outputWidth", 1280) + coreWithBaseComp.settings.setValue("outputHeight", 720) + comp.updateResolution() + assert comp.testValue == 33 + assert widget.value() == 33 + coreWithBaseComp.settings.setValue("outputWidth", 1920) + coreWithBaseComp.settings.setValue("outputHeight", 1080) + comp.updateResolution() + assert comp.testValue == 50 + assert widget.value() == 50 diff --git a/tests/test_mainwindow_comp_actions.py b/tests/test_mainwindow_comp_actions.py index 5d3cc7a..1b2a9b2 100644 --- a/tests/test_mainwindow_comp_actions.py +++ b/tests/test_mainwindow_comp_actions.py @@ -1,11 +1,26 @@ -"""Tests of MainWindow undoing certain ComponentActions (changes to component settings)""" +""" +Tests of MainWindow undoing certain ComponentTrackedWidgetUpdates +""" -from pytest import fixture +from PyQt6 import QtCore +from avp.toolkit.common import isVerticalWord +from pytest import fixture, mark from pytestqt import qtbot from avp.gui.mainwindow import MainWindow from . import getTestDataPath, window +def test_undo_stack_size_after_3_trackedWidgetUpdates(window, qtbot): + window.core.insertComponent( + 0, window.core.moduleIndexFor("Classic Visualizer"), window + ) + comp = window.core.selectedComponents[0] + comp.page.spinBox_scale.setValue(99) + comp.page.spinBox_y.setValue(100) + comp.page.spinBox_scale.setValue(50) + assert window.undoStack.count() == 3 + + def test_undo_classic_visualizer_sensitivity(window, qtbot): """Undo Classic Visualizer component sensitivity setting should undo multiple merged actions.""" @@ -26,14 +41,11 @@ def test_undo_image_scale(window, qtbot): window.core.insertComponent(0, window.core.moduleIndexFor("Image"), window) comp = window.core.selectedComponents[0] comp.imagePath = getTestDataPath("inputfiles/test.jpg") - comp.page.spinBox_scale.setValue(100) for i in range(10, 401): comp.page.spinBox_scale.setValue(i) assert comp.scale == 400 window.undoStack.undo() assert comp.scale == 10 - window.undoStack.undo() - assert comp.scale == 100 def test_undo_image_resizeMode(window, qtbot): @@ -64,3 +76,98 @@ def test_undo_title_text_not_merged(window, qtbot): comp.page.lineEdit_title.setText("test") window.undoStack.undo() assert comp.title == "avp" + + +def test_undo_randomColor_is_saved(window, qtbot): + window.addComponent(0, window.core.moduleIndexFor("Color")) + comp = window.core.selectedComponents[0] + randomText = comp.page.lineEdit_color1.text() + randomTuple = comp.color1 + window.undoStack.undo() + window.undoStack.redo() + comp = window.core.selectedComponents[0] + assert comp.page.lineEdit_color1.text() == randomText + assert comp.color1 == randomTuple + + +@mark.parametrize("compName", ("Title Text", "Image")) +def test_comp_undo_centerXYAction_through_resolution_change(window, qtbot, compName): + """Test if CenterTextAction works properly with changes to resolution""" + window.core.insertComponent(0, window.core.moduleIndexFor(compName), window) + comp = window.core.selectedComponents[0] + if compName == "Image": + comp.imageSize = (1, 1) + widget = comp._trackedWidgets["xPosition"] + widget.setValue(450) + window.updateResolution(1) + resizedX = comp.xPosition + comp.addCenterAction() + centeredX = comp.xPosition + widget.setValue(333) + window.undoStack.undo() + assert comp.xPosition == centeredX + # undo centering + window.undoStack.undo() + assert comp.xPosition == resizedX + # undo change of resolution + window.undoStack.undo() + assert comp.xPosition == 450 + + +@mark.parametrize("compName", ("Title Text", "Image")) +@mark.parametrize("attr", ("xPosition", "yPosition")) +def test_comp_undo_previewXYClick_through_resolution_change( + window, qtbot, compName, attr +): + """Test if PreviewClickAction works properly with changes to resolution""" + window.core.insertComponent(0, window.core.moduleIndexFor(compName), window) + comp = window.core.selectedComponents[0] + widget = comp._trackedWidgets[attr] + valueAt1080 = 450 + + # value from which x, y would be offset (for components not anchored at x, y) + offset = (100, 100) + if compName == "Image": + comp.imageSize = offset + useOffset = compName in ("Image") + + # Set widget value at 1920x1080 + widget.setValue(valueAt1080) + # Change resolution to 1280x720 + window.updateResolution(1) + # Remember resized widget value + valueAt720 = getattr(comp, attr) + # Send previewClickEvent at 1/10th of resolution + comp.previewClickEvent((128, 72), (1280, 720), QtCore.Qt.MouseButton.LeftButton) + assert getattr(comp, attr) == (72 if isVerticalWord(attr) else 128) - ( + (int(offset[1 if isVerticalWord(attr) else 0] / 2) if useOffset else 0) + ) + + # Undo previewClickEvent + window.undoStack.undo() + assert getattr(comp, attr) == valueAt720 + + # Undo resolution change, returning to 1920x1080 + window.undoStack.undo() + assert getattr(comp, attr) == valueAt1080 + + +def test_undo_merges_resolution_change_image(window, qtbot): + """Test if ChangeResolution QUndoCommand objects merge and obsolete themselves cleanly""" + window.core.insertComponent(0, window.core.moduleIndexFor("Image"), window) + comp = window.core.selectedComponents[0] + comp.page.spinBox_scale.setValue(50) + comp.page.spinBox_x.setValue(200) + window.updateResolution(1) + assert window.undoStack.count() == 3 + window.updateResolution(2) + assert window.undoStack.count() == 3 + window.updateResolution(0) + assert window.undoStack.count() == 2 + window.updateResolution(1) + comp.page.spinBox_y.setValue(100) + assert window.undoStack.count() == 4 + window.undoStack.undo() + assert window.undoStack.count() == 4 + window.undoStack.redo() + assert window.undoStack.count() == 4 diff --git a/tests/test_mainwindow_list_actions.py b/tests/test_mainwindow_list_actions.py index 5f8bde4..d3a5eb4 100644 --- a/tests/test_mainwindow_list_actions.py +++ b/tests/test_mainwindow_list_actions.py @@ -1,10 +1,9 @@ """Tests of `actions.py` - MainWindow component list manipulation via undoable actions""" from PyQt6 import QtCore -import os -from pytest import fixture +import pytest from pytestqt import qtbot -from . import getTestDataPath, window +from . import window def test_mainwindow_addComponent(qtbot, window): @@ -50,3 +49,45 @@ def test_mainwindow_moveComponent_undo(qtbot, window): window.undoStack.undo() # check if 0 is still 0 after undo assert window.core.selectedComponents[1].ui != comp0 + + +def test_mainwindow_componentList_qrect_sizes(qtbot, window): + """Add two components to MainWindow's componentList and test QRect sizes""" + window.compMenu.actions()[0].trigger() + window.compMenu.actions()[1].trigger() + componentListItem0 = window.listWidget_componentList.model().index(0) + componentListItem1 = window.listWidget_componentList.model().index(1) + rect0x, rect0y, rect0w, rect0h = window.listWidget_componentList.visualRect( + componentListItem0 + ).getRect() + rect1x, rect1y, rect1w, rect1h = window.listWidget_componentList.visualRect( + componentListItem1 + ).getRect() + + # only the y coordinate should be different between items in the component list + assert rect0x == rect1x + assert rect0y != rect1y + assert rect0w == rect1w + assert rect0h == rect1h + + +@pytest.mark.parametrize("row, movement", ((0, 1), (1, 0))) +def test_mainwindow_dragDropComponent(qtbot, window, row, movement): + """Add two components to MainWindow's componentList, + then call dragComponent with a fake QMouseEvent to simulate + drag-and-drop reordering components in the list""" + window.compMenu.actions()[0].trigger() + window.compMenu.actions()[1].trigger() + comp0 = window.core.selectedComponents[0].ui + rect0x, rect0y, rect0w, rect0h = window.listWidget_componentList.visualRect( + window.listWidget_componentList.model().index(0) + ).getRect() + + class FakeEvent: + def position(self): + return QtCore.QPoint(rect0x, rect0y + (rect0h * movement)) + + window.listWidget_componentList.setCurrentRow(row) + assert window.core.selectedComponents[0].ui == comp0 + window.dragComponent(FakeEvent()) + assert window.core.selectedComponents[1].ui == comp0 diff --git a/tests/test_mainwindow_projects.py b/tests/test_mainwindow_projects.py index a6df476..fd0f8ef 100644 --- a/tests/test_mainwindow_projects.py +++ b/tests/test_mainwindow_projects.py @@ -29,6 +29,14 @@ def test_mainwindow_openProject(qtbot, window): assert len(window.core.selectedComponents) == 2 +def test_mainwindow_openProject_with_outdated_file(qtbot, window): + """Open outdated project file using MainWindow.openProject()""" + window.openProject( + getTestDataPath("config/projects/testproject_outdated.avp"), prompt=False + ) + assert len(window.core.selectedComponents) == 2 + + def test_mainwindow_newProject_without_unsaved_changes(qtbot, window): """Starting new project without unsaved changes""" didCallFunction = False diff --git a/tests/test_presetmanager.py b/tests/test_presetmanager.py new file mode 100644 index 0000000..d97f10b --- /dev/null +++ b/tests/test_presetmanager.py @@ -0,0 +1,84 @@ +import os +import shutil +from pytest import fixture +from pytestqt import qtbot +from avp.gui.presetmanager import PresetManager +from avp.gui.actions import RenamePreset, DeletePreset +from . import getTestDataPath, window + + +@fixture +def presetmanager(window, qtbot): + window.core.insertComponent( + 0, window.core.moduleIndexFor("Classic Visualizer"), window + ) + comp = window.core.selectedComponents[0] + saveValueStore = comp.savePreset() + saveValueStore["preset"] = "testPreset" + window.core.createPresetFile(comp.name, comp.version, "testPreset", saveValueStore) + window.presetDir = os.path.join( + os.path.basename(window.core.settings.value("projectDir")), "presets" + ) + window.presetManager.findPresets() + qtbot.addWidget(window.presetManager) + yield window.presetManager + + +def test_presetmanager_createPresetFile(presetmanager, qtbot): + assert "Classic Visualizer" in presetmanager.presets + + +def test_presetmanager_list(presetmanager, qtbot): + # Must use findPresets() because the preset provided by our setup function + # wasn't created using the presetmanager's createNewPreset method + presetmanager.findPresets() + assert presetmanager.presets == { + "Classic Visualizer": [ + ( + 1, + "testPreset", + ), + ], + } + + +def test_presetmanager_rename_preset(presetmanager, qtbot): + vers = presetmanager.presets["Classic Visualizer"][0][0] + path = os.path.join(presetmanager.presetDir, "Classic Visualizer", str(vers)) + try: + presetmanager.renamePreset(path, "testPreset", "testPresetNew") + assert presetmanager.presets["Classic Visualizer"][0][1] == "testPresetNew" + finally: + os.remove(os.path.join(path, "testPresetNew")) + + +def test_presetmanager_undo_redo_rename_preset(presetmanager, qtbot): + vers = presetmanager.presets["Classic Visualizer"][0][0] + path = os.path.join(presetmanager.presetDir, "Classic Visualizer", str(vers)) + action = RenamePreset(presetmanager, path, "testPreset", "testPresetNew") + presetmanager.parent.undoStack.push(action) + assert presetmanager.presets["Classic Visualizer"][0][1] == "testPresetNew" + presetmanager.parent.undoStack.undo() + assert presetmanager.presets["Classic Visualizer"][0][1] == "testPreset" + presetmanager.parent.undoStack.redo() + assert presetmanager.presets["Classic Visualizer"][0][1] == "testPresetNew" + presetmanager.parent.undoStack.undo() + + +def test_presetmanager_delete_preset(presetmanager, qtbot): + comp = presetmanager.core.selectedComponents[0].name + vers = presetmanager.presets["Classic Visualizer"][0][0] + presetmanager.deletePreset(comp, vers, "testPreset") + assert "Classic Visualizer" not in presetmanager.presets + + +def test_presetmanager_undo_redo_delete_preset(presetmanager, qtbot): + comp = presetmanager.core.selectedComponents[0].name + vers = presetmanager.presets["Classic Visualizer"][0][0] + action = DeletePreset(presetmanager, comp, vers, "testPreset") + presetmanager.parent.undoStack.push(action) + assert "Classic Visualizer" not in presetmanager.presets + presetmanager.parent.undoStack.undo() + assert "Classic Visualizer" in presetmanager.presets + presetmanager.parent.undoStack.redo() + assert "Classic Visualizer" not in presetmanager.presets diff --git a/tests/test_toolkit_common.py b/tests/test_toolkit_common.py index b20ae53..2937e4a 100644 --- a/tests/test_toolkit_common.py +++ b/tests/test_toolkit_common.py @@ -1,30 +1,42 @@ from pytest import fixture from pytestqt import qtbot from avp.command import Command -from avp.toolkit import blockSignals, rgbFromString +from avp.toolkit import blockSignals, rgbFromString, connectWidget from . import command +class UnsupportedWidget: + pass + + @fixture -def gotWarning(): - """Check if a function called log.warning""" +def getLogLevel(): + """Check if a function wrote a log message""" import avp.toolkit.common as tk - warning = False + logLevel = None - def gotWarning(): - nonlocal warning - return warning + def gotLogLevel(): + nonlocal logLevel + return logLevel class log: def warning(self, *args): - nonlocal warning - warning = True + nonlocal logLevel + logLevel = "warning" + + def info(self, *args): + nonlocal logLevel + logLevel = "info" + + def debug(self, *args): + nonlocal logLevel + logLevel = "debug" oldLog = tk.log tk.log = log() try: - yield gotWarning + yield gotLogLevel finally: tk.log = oldLog @@ -38,11 +50,27 @@ def test_blockSignals(qtbot, command): assert comp.page.spinBox_scale.signalsBlocked() == False -def test_rgbFromString(gotWarning): +def test_rgbFromString(getLogLevel): assert rgbFromString("255,255,255") == (255, 255, 255) - assert not gotWarning() + assert getLogLevel() is None -def test_rgbFromString_error(gotWarning): +def test_rgbFromString_log_warning(getLogLevel): assert rgbFromString("255,255,256") == (255, 255, 255) - assert gotWarning() + assert getLogLevel() == "warning" + + +def test_connectWidget_unsupportedWidget_log_debug(getLogLevel): + """A known unsupported widget causes a debug message""" + + connectWidget( + UnsupportedWidget(), lambda: ..., unsupportedWidgets=["UnsupportedWidget"] + ) + assert getLogLevel() == "debug" + + +def test_connectWidget_unsupportedWidget_log_info(getLogLevel): + """An unknown unsupported widget causes an info message""" + + connectWidget(UnsupportedWidget(), lambda: ...) + assert getLogLevel() == "info" diff --git a/uv.lock b/uv.lock index 461e725..ffcb979 100644 --- a/uv.lock +++ b/uv.lock @@ -4,7 +4,7 @@ requires-python = ">=3.12" [[package]] name = "audio-visualizer-python" -version = "2.2.4" +version = "2.3.0" source = { editable = "." } dependencies = [ { name = "numpy" }, @@ -21,7 +21,7 @@ dev = [ [package.metadata] requires-dist = [ { name = "numpy", specifier = ">=2.4.1" }, - { name = "pillow", specifier = ">=12.1.0" }, + { name = "pillow", specifier = ">=13.0.0" }, { name = "pyqt6", specifier = ">=6.10.2" }, ] @@ -121,71 +121,78 @@ wheels = [ [[package]] name = "pillow" -version = "12.1.0" +version = "13.0.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d0/02/d52c733a2452ef1ffcc123b68e6606d07276b0e358db70eabad7e40042b7/pillow-12.1.0.tar.gz", hash = "sha256:5c5ae0a06e9ea030ab786b0251b32c7e4ce10e58d983c0d5c56029455180b5b9", size = 46977283, upload-time = "2026-01-02T09:13:29.892Z" } +sdist = { url = "https://files.pythonhosted.org/packages/ce/a4/9cc30690a394a8305e8be4c9036aa16d0dfddadd09079860b582f562496d/pillow-13.0.0.tar.gz", hash = "sha256:cdcd1ba258178f7356d74170c9a81ba4eab6a5d55748bc402a5a2a6fe6be3510", size = 47058631, upload-time = "2026-10-16T22:18:09.718Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/20/31/dc53fe21a2f2996e1b7d92bf671cdb157079385183ef7c1ae08b485db510/pillow-12.1.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:a332ac4ccb84b6dde65dbace8431f3af08874bf9770719d32a635c4ef411b18b", size = 5262642, upload-time = "2026-01-02T09:11:10.138Z" }, - { url = "https://files.pythonhosted.org/packages/ab/c1/10e45ac9cc79419cedf5121b42dcca5a50ad2b601fa080f58c22fb27626e/pillow-12.1.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:907bfa8a9cb790748a9aa4513e37c88c59660da3bcfffbd24a7d9e6abf224551", size = 4657464, upload-time = "2026-01-02T09:11:12.319Z" }, - { url = "https://files.pythonhosted.org/packages/ad/26/7b82c0ab7ef40ebede7a97c72d473bda5950f609f8e0c77b04af574a0ddb/pillow-12.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:efdc140e7b63b8f739d09a99033aa430accce485ff78e6d311973a67b6bf3208", size = 6234878, upload-time = "2026-01-02T09:11:14.096Z" }, - { url = "https://files.pythonhosted.org/packages/76/25/27abc9792615b5e886ca9411ba6637b675f1b77af3104710ac7353fe5605/pillow-12.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:bef9768cab184e7ae6e559c032e95ba8d07b3023c289f79a2bd36e8bf85605a5", size = 8044868, upload-time = "2026-01-02T09:11:15.903Z" }, - { url = "https://files.pythonhosted.org/packages/0a/ea/f200a4c36d836100e7bc738fc48cd963d3ba6372ebc8298a889e0cfc3359/pillow-12.1.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:742aea052cf5ab5034a53c3846165bc3ce88d7c38e954120db0ab867ca242661", size = 6349468, upload-time = "2026-01-02T09:11:17.631Z" }, - { url = "https://files.pythonhosted.org/packages/11/8f/48d0b77ab2200374c66d344459b8958c86693be99526450e7aee714e03e4/pillow-12.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a6dfc2af5b082b635af6e08e0d1f9f1c4e04d17d4e2ca0ef96131e85eda6eb17", size = 7041518, upload-time = "2026-01-02T09:11:19.389Z" }, - { url = "https://files.pythonhosted.org/packages/1d/23/c281182eb986b5d31f0a76d2a2c8cd41722d6fb8ed07521e802f9bba52de/pillow-12.1.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:609e89d9f90b581c8d16358c9087df76024cf058fa693dd3e1e1620823f39670", size = 6462829, upload-time = "2026-01-02T09:11:21.28Z" }, - { url = "https://files.pythonhosted.org/packages/25/ef/7018273e0faac099d7b00982abdcc39142ae6f3bd9ceb06de09779c4a9d6/pillow-12.1.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:43b4899cfd091a9693a1278c4982f3e50f7fb7cff5153b05174b4afc9593b616", size = 7166756, upload-time = "2026-01-02T09:11:23.559Z" }, - { url = "https://files.pythonhosted.org/packages/8f/c8/993d4b7ab2e341fe02ceef9576afcf5830cdec640be2ac5bee1820d693d4/pillow-12.1.0-cp312-cp312-win32.whl", hash = "sha256:aa0c9cc0b82b14766a99fbe6084409972266e82f459821cd26997a488a7261a7", size = 6328770, upload-time = "2026-01-02T09:11:25.661Z" }, - { url = "https://files.pythonhosted.org/packages/a7/87/90b358775a3f02765d87655237229ba64a997b87efa8ccaca7dd3e36e7a7/pillow-12.1.0-cp312-cp312-win_amd64.whl", hash = "sha256:d70534cea9e7966169ad29a903b99fc507e932069a881d0965a1a84bb57f6c6d", size = 7033406, upload-time = "2026-01-02T09:11:27.474Z" }, - { url = "https://files.pythonhosted.org/packages/5d/cf/881b457eccacac9e5b2ddd97d5071fb6d668307c57cbf4e3b5278e06e536/pillow-12.1.0-cp312-cp312-win_arm64.whl", hash = "sha256:65b80c1ee7e14a87d6a068dd3b0aea268ffcabfe0498d38661b00c5b4b22e74c", size = 2452612, upload-time = "2026-01-02T09:11:29.309Z" }, - { url = "https://files.pythonhosted.org/packages/dd/c7/2530a4aa28248623e9d7f27316b42e27c32ec410f695929696f2e0e4a778/pillow-12.1.0-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7b5dd7cbae20285cdb597b10eb5a2c13aa9de6cde9bb64a3c1317427b1db1ae1", size = 4062543, upload-time = "2026-01-02T09:11:31.566Z" }, - { url = "https://files.pythonhosted.org/packages/8f/1f/40b8eae823dc1519b87d53c30ed9ef085506b05281d313031755c1705f73/pillow-12.1.0-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:29a4cef9cb672363926f0470afc516dbf7305a14d8c54f7abbb5c199cd8f8179", size = 4138373, upload-time = "2026-01-02T09:11:33.367Z" }, - { url = "https://files.pythonhosted.org/packages/d4/77/6fa60634cf06e52139fd0e89e5bbf055e8166c691c42fb162818b7fda31d/pillow-12.1.0-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:681088909d7e8fa9e31b9799aaa59ba5234c58e5e4f1951b4c4d1082a2e980e0", size = 3601241, upload-time = "2026-01-02T09:11:35.011Z" }, - { url = "https://files.pythonhosted.org/packages/4f/bf/28ab865de622e14b747f0cd7877510848252d950e43002e224fb1c9ababf/pillow-12.1.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:983976c2ab753166dc66d36af6e8ec15bb511e4a25856e2227e5f7e00a160587", size = 5262410, upload-time = "2026-01-02T09:11:36.682Z" }, - { url = "https://files.pythonhosted.org/packages/1c/34/583420a1b55e715937a85bd48c5c0991598247a1fd2eb5423188e765ea02/pillow-12.1.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:db44d5c160a90df2d24a24760bbd37607d53da0b34fb546c4c232af7192298ac", size = 4657312, upload-time = "2026-01-02T09:11:38.535Z" }, - { url = "https://files.pythonhosted.org/packages/1d/fd/f5a0896839762885b3376ff04878f86ab2b097c2f9a9cdccf4eda8ba8dc0/pillow-12.1.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:6b7a9d1db5dad90e2991645874f708e87d9a3c370c243c2d7684d28f7e133e6b", size = 6232605, upload-time = "2026-01-02T09:11:40.602Z" }, - { url = "https://files.pythonhosted.org/packages/98/aa/938a09d127ac1e70e6ed467bd03834350b33ef646b31edb7452d5de43792/pillow-12.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:6258f3260986990ba2fa8a874f8b6e808cf5abb51a94015ca3dc3c68aa4f30ea", size = 8041617, upload-time = "2026-01-02T09:11:42.721Z" }, - { url = "https://files.pythonhosted.org/packages/17/e8/538b24cb426ac0186e03f80f78bc8dc7246c667f58b540bdd57c71c9f79d/pillow-12.1.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e115c15e3bc727b1ca3e641a909f77f8ca72a64fff150f666fcc85e57701c26c", size = 6346509, upload-time = "2026-01-02T09:11:44.955Z" }, - { url = "https://files.pythonhosted.org/packages/01/9a/632e58ec89a32738cabfd9ec418f0e9898a2b4719afc581f07c04a05e3c9/pillow-12.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6741e6f3074a35e47c77b23a4e4f2d90db3ed905cb1c5e6e0d49bff2045632bc", size = 7038117, upload-time = "2026-01-02T09:11:46.736Z" }, - { url = "https://files.pythonhosted.org/packages/c7/a2/d40308cf86eada842ca1f3ffa45d0ca0df7e4ab33c83f81e73f5eaed136d/pillow-12.1.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:935b9d1aed48fcfb3f838caac506f38e29621b44ccc4f8a64d575cb1b2a88644", size = 6460151, upload-time = "2026-01-02T09:11:48.625Z" }, - { url = "https://files.pythonhosted.org/packages/f1/88/f5b058ad6453a085c5266660a1417bdad590199da1b32fb4efcff9d33b05/pillow-12.1.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5fee4c04aad8932da9f8f710af2c1a15a83582cfb884152a9caa79d4efcdbf9c", size = 7164534, upload-time = "2026-01-02T09:11:50.445Z" }, - { url = "https://files.pythonhosted.org/packages/19/ce/c17334caea1db789163b5d855a5735e47995b0b5dc8745e9a3605d5f24c0/pillow-12.1.0-cp313-cp313-win32.whl", hash = "sha256:a786bf667724d84aa29b5db1c61b7bfdde380202aaca12c3461afd6b71743171", size = 6332551, upload-time = "2026-01-02T09:11:52.234Z" }, - { url = "https://files.pythonhosted.org/packages/e5/07/74a9d941fa45c90a0d9465098fe1ec85de3e2afbdc15cc4766622d516056/pillow-12.1.0-cp313-cp313-win_amd64.whl", hash = "sha256:461f9dfdafa394c59cd6d818bdfdbab4028b83b02caadaff0ffd433faf4c9a7a", size = 7040087, upload-time = "2026-01-02T09:11:54.822Z" }, - { url = "https://files.pythonhosted.org/packages/88/09/c99950c075a0e9053d8e880595926302575bc742b1b47fe1bbcc8d388d50/pillow-12.1.0-cp313-cp313-win_arm64.whl", hash = "sha256:9212d6b86917a2300669511ed094a9406888362e085f2431a7da985a6b124f45", size = 2452470, upload-time = "2026-01-02T09:11:56.522Z" }, - { url = "https://files.pythonhosted.org/packages/b5/ba/970b7d85ba01f348dee4d65412476321d40ee04dcb51cd3735b9dc94eb58/pillow-12.1.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:00162e9ca6d22b7c3ee8e61faa3c3253cd19b6a37f126cad04f2f88b306f557d", size = 5264816, upload-time = "2026-01-02T09:11:58.227Z" }, - { url = "https://files.pythonhosted.org/packages/10/60/650f2fb55fdba7a510d836202aa52f0baac633e50ab1cf18415d332188fb/pillow-12.1.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:7d6daa89a00b58c37cb1747ec9fb7ac3bc5ffd5949f5888657dfddde6d1312e0", size = 4660472, upload-time = "2026-01-02T09:12:00.798Z" }, - { url = "https://files.pythonhosted.org/packages/2b/c0/5273a99478956a099d533c4f46cbaa19fd69d606624f4334b85e50987a08/pillow-12.1.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:e2479c7f02f9d505682dc47df8c0ea1fc5e264c4d1629a5d63fe3e2334b89554", size = 6268974, upload-time = "2026-01-02T09:12:02.572Z" }, - { url = "https://files.pythonhosted.org/packages/b4/26/0bf714bc2e73d5267887d47931d53c4ceeceea6978148ed2ab2a4e6463c4/pillow-12.1.0-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f188d580bd870cda1e15183790d1cc2fa78f666e76077d103edf048eed9c356e", size = 8073070, upload-time = "2026-01-02T09:12:04.75Z" }, - { url = "https://files.pythonhosted.org/packages/43/cf/1ea826200de111a9d65724c54f927f3111dc5ae297f294b370a670c17786/pillow-12.1.0-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0fde7ec5538ab5095cc02df38ee99b0443ff0e1c847a045554cf5f9af1f4aa82", size = 6380176, upload-time = "2026-01-02T09:12:06.626Z" }, - { url = "https://files.pythonhosted.org/packages/03/e0/7938dd2b2013373fd85d96e0f38d62b7a5a262af21ac274250c7ca7847c9/pillow-12.1.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0ed07dca4a8464bada6139ab38f5382f83e5f111698caf3191cb8dbf27d908b4", size = 7067061, upload-time = "2026-01-02T09:12:08.624Z" }, - { url = "https://files.pythonhosted.org/packages/86/ad/a2aa97d37272a929a98437a8c0ac37b3cf012f4f8721e1bd5154699b2518/pillow-12.1.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:f45bd71d1fa5e5749587613037b172e0b3b23159d1c00ef2fc920da6f470e6f0", size = 6491824, upload-time = "2026-01-02T09:12:10.488Z" }, - { url = "https://files.pythonhosted.org/packages/a4/44/80e46611b288d51b115826f136fb3465653c28f491068a72d3da49b54cd4/pillow-12.1.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:277518bf4fe74aa91489e1b20577473b19ee70fb97c374aa50830b279f25841b", size = 7190911, upload-time = "2026-01-02T09:12:12.772Z" }, - { url = "https://files.pythonhosted.org/packages/86/77/eacc62356b4cf81abe99ff9dbc7402750044aed02cfd6a503f7c6fc11f3e/pillow-12.1.0-cp313-cp313t-win32.whl", hash = "sha256:7315f9137087c4e0ee73a761b163fc9aa3b19f5f606a7fc08d83fd3e4379af65", size = 6336445, upload-time = "2026-01-02T09:12:14.775Z" }, - { url = "https://files.pythonhosted.org/packages/e7/3c/57d81d0b74d218706dafccb87a87ea44262c43eef98eb3b164fd000e0491/pillow-12.1.0-cp313-cp313t-win_amd64.whl", hash = "sha256:0ddedfaa8b5f0b4ffbc2fa87b556dc59f6bb4ecb14a53b33f9189713ae8053c0", size = 7045354, upload-time = "2026-01-02T09:12:16.599Z" }, - { url = "https://files.pythonhosted.org/packages/ac/82/8b9b97bba2e3576a340f93b044a3a3a09841170ab4c1eb0d5c93469fd32f/pillow-12.1.0-cp313-cp313t-win_arm64.whl", hash = "sha256:80941e6d573197a0c28f394753de529bb436b1ca990ed6e765cf42426abc39f8", size = 2454547, upload-time = "2026-01-02T09:12:18.704Z" }, - { url = "https://files.pythonhosted.org/packages/8c/87/bdf971d8bbcf80a348cc3bacfcb239f5882100fe80534b0ce67a784181d8/pillow-12.1.0-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:5cb7bc1966d031aec37ddb9dcf15c2da5b2e9f7cc3ca7c54473a20a927e1eb91", size = 4062533, upload-time = "2026-01-02T09:12:20.791Z" }, - { url = "https://files.pythonhosted.org/packages/ff/4f/5eb37a681c68d605eb7034c004875c81f86ec9ef51f5be4a63eadd58859a/pillow-12.1.0-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:97e9993d5ed946aba26baf9c1e8cf18adbab584b99f452ee72f7ee8acb882796", size = 4138546, upload-time = "2026-01-02T09:12:23.664Z" }, - { url = "https://files.pythonhosted.org/packages/11/6d/19a95acb2edbace40dcd582d077b991646b7083c41b98da4ed7555b59733/pillow-12.1.0-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:414b9a78e14ffeb98128863314e62c3f24b8a86081066625700b7985b3f529bd", size = 3601163, upload-time = "2026-01-02T09:12:26.338Z" }, - { url = "https://files.pythonhosted.org/packages/fc/36/2b8138e51cb42e4cc39c3297713455548be855a50558c3ac2beebdc251dd/pillow-12.1.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:e6bdb408f7c9dd2a5ff2b14a3b0bb6d4deb29fb9961e6eb3ae2031ae9a5cec13", size = 5266086, upload-time = "2026-01-02T09:12:28.782Z" }, - { url = "https://files.pythonhosted.org/packages/53/4b/649056e4d22e1caa90816bf99cef0884aed607ed38075bd75f091a607a38/pillow-12.1.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:3413c2ae377550f5487991d444428f1a8ae92784aac79caa8b1e3b89b175f77e", size = 4657344, upload-time = "2026-01-02T09:12:31.117Z" }, - { url = "https://files.pythonhosted.org/packages/6c/6b/c5742cea0f1ade0cd61485dc3d81f05261fc2276f537fbdc00802de56779/pillow-12.1.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:e5dcbe95016e88437ecf33544ba5db21ef1b8dd6e1b434a2cb2a3d605299e643", size = 6232114, upload-time = "2026-01-02T09:12:32.936Z" }, - { url = "https://files.pythonhosted.org/packages/bf/8f/9f521268ce22d63991601aafd3d48d5ff7280a246a1ef62d626d67b44064/pillow-12.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d0a7735df32ccbcc98b98a1ac785cc4b19b580be1bdf0aeb5c03223220ea09d5", size = 8042708, upload-time = "2026-01-02T09:12:34.78Z" }, - { url = "https://files.pythonhosted.org/packages/1a/eb/257f38542893f021502a1bbe0c2e883c90b5cff26cc33b1584a841a06d30/pillow-12.1.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0c27407a2d1b96774cbc4a7594129cc027339fd800cd081e44497722ea1179de", size = 6347762, upload-time = "2026-01-02T09:12:36.748Z" }, - { url = "https://files.pythonhosted.org/packages/c4/5a/8ba375025701c09b309e8d5163c5a4ce0102fa86bbf8800eb0d7ac87bc51/pillow-12.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:15c794d74303828eaa957ff8070846d0efe8c630901a1c753fdc63850e19ecd9", size = 7039265, upload-time = "2026-01-02T09:12:39.082Z" }, - { url = "https://files.pythonhosted.org/packages/cf/dc/cf5e4cdb3db533f539e88a7bbf9f190c64ab8a08a9bc7a4ccf55067872e4/pillow-12.1.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c990547452ee2800d8506c4150280757f88532f3de2a58e3022e9b179107862a", size = 6462341, upload-time = "2026-01-02T09:12:40.946Z" }, - { url = "https://files.pythonhosted.org/packages/d0/47/0291a25ac9550677e22eda48510cfc4fa4b2ef0396448b7fbdc0a6946309/pillow-12.1.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b63e13dd27da389ed9475b3d28510f0f954bca0041e8e551b2a4eb1eab56a39a", size = 7165395, upload-time = "2026-01-02T09:12:42.706Z" }, - { url = "https://files.pythonhosted.org/packages/4f/4c/e005a59393ec4d9416be06e6b45820403bb946a778e39ecec62f5b2b991e/pillow-12.1.0-cp314-cp314-win32.whl", hash = "sha256:1a949604f73eb07a8adab38c4fe50791f9919344398bdc8ac6b307f755fc7030", size = 6431413, upload-time = "2026-01-02T09:12:44.944Z" }, - { url = "https://files.pythonhosted.org/packages/1c/af/f23697f587ac5f9095d67e31b81c95c0249cd461a9798a061ed6709b09b5/pillow-12.1.0-cp314-cp314-win_amd64.whl", hash = "sha256:4f9f6a650743f0ddee5593ac9e954ba1bdbc5e150bc066586d4f26127853ab94", size = 7176779, upload-time = "2026-01-02T09:12:46.727Z" }, - { url = "https://files.pythonhosted.org/packages/b3/36/6a51abf8599232f3e9afbd16d52829376a68909fe14efe29084445db4b73/pillow-12.1.0-cp314-cp314-win_arm64.whl", hash = "sha256:808b99604f7873c800c4840f55ff389936ef1948e4e87645eaf3fccbc8477ac4", size = 2543105, upload-time = "2026-01-02T09:12:49.243Z" }, - { url = "https://files.pythonhosted.org/packages/82/54/2e1dd20c8749ff225080d6ba465a0cab4387f5db0d1c5fb1439e2d99923f/pillow-12.1.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:bc11908616c8a283cf7d664f77411a5ed2a02009b0097ff8abbba5e79128ccf2", size = 5268571, upload-time = "2026-01-02T09:12:51.11Z" }, - { url = "https://files.pythonhosted.org/packages/57/61/571163a5ef86ec0cf30d265ac2a70ae6fc9e28413d1dc94fa37fae6bda89/pillow-12.1.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:896866d2d436563fa2a43a9d72f417874f16b5545955c54a64941e87c1376c61", size = 4660426, upload-time = "2026-01-02T09:12:52.865Z" }, - { url = "https://files.pythonhosted.org/packages/5e/e1/53ee5163f794aef1bf84243f755ee6897a92c708505350dd1923f4afec48/pillow-12.1.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8e178e3e99d3c0ea8fc64b88447f7cac8ccf058af422a6cedc690d0eadd98c51", size = 6269908, upload-time = "2026-01-02T09:12:54.884Z" }, - { url = "https://files.pythonhosted.org/packages/bc/0b/b4b4106ff0ee1afa1dc599fde6ab230417f800279745124f6c50bcffed8e/pillow-12.1.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:079af2fb0c599c2ec144ba2c02766d1b55498e373b3ac64687e43849fbbef5bc", size = 8074733, upload-time = "2026-01-02T09:12:56.802Z" }, - { url = "https://files.pythonhosted.org/packages/19/9f/80b411cbac4a732439e629a26ad3ef11907a8c7fc5377b7602f04f6fe4e7/pillow-12.1.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bdec5e43377761c5dbca620efb69a77f6855c5a379e32ac5b158f54c84212b14", size = 6381431, upload-time = "2026-01-02T09:12:58.823Z" }, - { url = "https://files.pythonhosted.org/packages/8f/b7/d65c45db463b66ecb6abc17c6ba6917a911202a07662247e1355ce1789e7/pillow-12.1.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:565c986f4b45c020f5421a4cea13ef294dde9509a8577f29b2fc5edc7587fff8", size = 7068529, upload-time = "2026-01-02T09:13:00.885Z" }, - { url = "https://files.pythonhosted.org/packages/50/96/dfd4cd726b4a45ae6e3c669fc9e49deb2241312605d33aba50499e9d9bd1/pillow-12.1.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:43aca0a55ce1eefc0aefa6253661cb54571857b1a7b2964bd8a1e3ef4b729924", size = 6492981, upload-time = "2026-01-02T09:13:03.314Z" }, - { url = "https://files.pythonhosted.org/packages/4d/1c/b5dc52cf713ae46033359c5ca920444f18a6359ce1020dd3e9c553ea5bc6/pillow-12.1.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0deedf2ea233722476b3a81e8cdfbad786f7adbed5d848469fa59fe52396e4ef", size = 7191878, upload-time = "2026-01-02T09:13:05.276Z" }, - { url = "https://files.pythonhosted.org/packages/53/26/c4188248bd5edaf543864fe4834aebe9c9cb4968b6f573ce014cc42d0720/pillow-12.1.0-cp314-cp314t-win32.whl", hash = "sha256:b17fbdbe01c196e7e159aacb889e091f28e61020a8abeac07b68079b6e626988", size = 6438703, upload-time = "2026-01-02T09:13:07.491Z" }, - { url = "https://files.pythonhosted.org/packages/b8/0e/69ed296de8ea05cb03ee139cee600f424ca166e632567b2d66727f08c7ed/pillow-12.1.0-cp314-cp314t-win_amd64.whl", hash = "sha256:27b9baecb428899db6c0de572d6d305cfaf38ca1596b5c0542a5182e3e74e8c6", size = 7182927, upload-time = "2026-01-02T09:13:09.841Z" }, - { url = "https://files.pythonhosted.org/packages/fc/f5/68334c015eed9b5cff77814258717dec591ded209ab5b6fb70e2ae873d1d/pillow-12.1.0-cp314-cp314t-win_arm64.whl", hash = "sha256:f61333d817698bdcdd0f9d7793e365ac3d2a21c1f1eb02b32ad6aefb8d8ea831", size = 2545104, upload-time = "2026-01-02T09:13:12.068Z" }, + { url = "https://files.pythonhosted.org/packages/7a/b8/58d79332229482eb0d27c82973850808c19d37e5bdc14443d3417bd373f5/pillow-13.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:67c8d44ad89fa7eb88de5d6ef6199b1e03dd24974f85a67639fc8badb801fe79", size = 5568643, upload-time = "2026-10-16T22:15:44.474Z" }, + { url = "https://files.pythonhosted.org/packages/39/4b/f2ed53d83aa44ac19599ac0a54897f867fafb95f406980d1e24083f8cbe3/pillow-13.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fc481f742ccda20e9ed760b8f978dff50f2a4e9bc253ac167fb0a05b0783ef52", size = 4852329, upload-time = "2026-10-16T22:15:46.284Z" }, + { url = "https://files.pythonhosted.org/packages/3b/bb/9e30e8ed18c20800ee327a12107d5249ad8dc444867b3adfcc21654e3c71/pillow-13.0.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8bf295fe459343bc6093c8e5e0df60bfa189e0fcb775a22e2c2488fdeccc6c0d", size = 6519309, upload-time = "2026-10-16T22:15:48.14Z" }, + { url = "https://files.pythonhosted.org/packages/e6/99/fdf65cc539e266ab93546c261bdf98411fe165c6e4e13f9dbf597097192b/pillow-13.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:42d63be3af4f9b951b199b0a9d23365d37ab14687e6d77b74940432c8515c4ca", size = 7144542, upload-time = "2026-10-16T22:15:50.093Z" }, + { url = "https://files.pythonhosted.org/packages/26/9b/f38b7c4d8f599537e2d1a6d546cec9beef7536ff8f5c49a3f9c78179d8ac/pillow-13.0.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:4bd024d567eca931b668978d672dba914d4b8e2628e2c3073a2ad178de8a2620", size = 6618042, upload-time = "2026-10-16T22:15:52.054Z" }, + { url = "https://files.pythonhosted.org/packages/a8/7c/45ee28531f89ee4582967d8a17f7a26d71ca64cd902b93c269590cd60a00/pillow-13.0.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:23edf4ec4b6f4f240e8df6e4985e9ee2ced86474632433e55fb1e2548744bf40", size = 7228137, upload-time = "2026-10-16T22:15:54.009Z" }, + { url = "https://files.pythonhosted.org/packages/01/bc/9c2a969cb1b70201d04fa17fd5aedf02a732870b8da86bceaaa30b0ca385/pillow-13.0.0-cp312-cp312-win32.whl", hash = "sha256:02464da86f561f410e13b061ec37c3068a9cb557a095494157742d07b3c24a27", size = 6515423, upload-time = "2026-10-16T22:15:56.25Z" }, + { url = "https://files.pythonhosted.org/packages/ff/cd/73a79ecdc822076002eb24b5e1e4a530b0bb5310fcb6d239abbec877110b/pillow-13.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:ff3fe9eb621fbb9db4c4be33ab946f6bac5f98ab50ca8d3260503653656c961b", size = 7272166, upload-time = "2026-10-16T22:15:58.597Z" }, + { url = "https://files.pythonhosted.org/packages/4a/a3/be5a1236efd085b3984e4305da8f179ae9dab80c991d2ad78f2bd5c4c843/pillow-13.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:c3bc8ee0271387e0b1e3ad0ff893645990a656e79bf9c42f4f734a3642b11d51", size = 2698943, upload-time = "2026-10-16T22:16:00.637Z" }, + { url = "https://files.pythonhosted.org/packages/82/e2/9132d38df320e8099e2642d9fa538f18a7dfebf68a875a31725dc2a115aa/pillow-13.0.0-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:e98b4f91f99b24b1da72e10621ba181f7281922384a7403094debb4199de6c00", size = 4190620, upload-time = "2026-10-16T22:16:02.527Z" }, + { url = "https://files.pythonhosted.org/packages/cb/be/436dac0996876f65ef1916ffb711c5ef4af2ebc57414b6f16642e07f6b47/pillow-13.0.0-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:34fb3db1149c879343861831728c243c432d4a5afc8f1878ca7612ef8de2a033", size = 4290286, upload-time = "2026-10-16T22:16:04.861Z" }, + { url = "https://files.pythonhosted.org/packages/60/16/7c1007162e4169ea0d5bec47e2e0b2174f56c50cf5b8c02a1dc23e41037e/pillow-13.0.0-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:2d50500a4a3bc6469adcdb319cf05d688b08ca3bf0f22a05339f3b25b433a599", size = 3723169, upload-time = "2026-10-16T22:16:06.956Z" }, + { url = "https://files.pythonhosted.org/packages/08/bc/578ab2eaa04705a8978bd9be0fe15c3d43a8fc95097c4f7e39540e79e4fa/pillow-13.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:ef5fe6b7db3f501c56000ba8fe7c7e1a35ca1d45824fbeb95a67daa85cff4dbe", size = 5568469, upload-time = "2026-10-16T22:16:08.664Z" }, + { url = "https://files.pythonhosted.org/packages/98/c8/ccede3dcc4f274b80fb49199eed1ef34ba05566c8b71976b9d1f111da2e3/pillow-13.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f11a3c1358bb3c68012a7b1f41b223c3db9f7bfde90b481df028cfe1c3363313", size = 4852187, upload-time = "2026-10-16T22:16:10.693Z" }, + { url = "https://files.pythonhosted.org/packages/fb/3c/cd0770e96d20bfd990db024bcbd43897ff3e88da1f4782cf90ea231b1d4f/pillow-13.0.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:19b66ca0a4d25cc0200b381ce824c7ea090db61427315e73cfb05dbf1b35c369", size = 6515908, upload-time = "2026-10-16T22:16:12.896Z" }, + { url = "https://files.pythonhosted.org/packages/ef/fe/f5cdaa2d1c4086e757430f368c271a58ee29cfe7378e7ae7b9d964015c25/pillow-13.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5f56499c1a74d2b862beb0c33b8016f99d095858455df9d21583bbbc1c15b582", size = 7142544, upload-time = "2026-10-16T22:16:14.844Z" }, + { url = "https://files.pythonhosted.org/packages/fb/b5/a54f6d44adbcd23737c8c12953f42be107e4cca64e247c0ca3a5b563061c/pillow-13.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a2a14cd73d5e6c927f644b0110ee81f59c4ef506259ec9183904747f2caacc81", size = 6613097, upload-time = "2026-10-16T22:16:16.893Z" }, + { url = "https://files.pythonhosted.org/packages/e6/b4/9e6c1207c21b2e91db0d15c16d30f3701ce5add1bd4da0e787761e66cb6e/pillow-13.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:08b826a9bf1265c76de04a42061d61ea6b109418b7826f28ff1ecdfaa26c5502", size = 7224846, upload-time = "2026-10-16T22:16:19.195Z" }, + { url = "https://files.pythonhosted.org/packages/78/9f/d3c3cb0518f3dd1eee0ef501535f53d15597a53c5c4118d178086143397a/pillow-13.0.0-cp313-cp313-win32.whl", hash = "sha256:12b0fa15879fe5a9d9eebe66e4e2d74128a773b1a4448010c9c714f45e04b9d8", size = 6516013, upload-time = "2026-10-16T22:16:21.389Z" }, + { url = "https://files.pythonhosted.org/packages/d7/ed/1b16fb66a37e1b9e41370b93b2c614c7da761a5b2a41dc333f7af4639962/pillow-13.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:9dda0788a9932776a75d8bcc020076edc308ce2508b51f6739a45e3158b3fc42", size = 7284777, upload-time = "2026-10-16T22:16:23.393Z" }, + { url = "https://files.pythonhosted.org/packages/87/7d/8d02eba9f7ecc87f8e90f731e032cc4773802f2a843763afd0c66a535ff4/pillow-13.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:40a266371ece581e5de13b6635ef78d7487824af80561b6ca27694a88c19bc0f", size = 2698826, upload-time = "2026-10-16T22:16:25.382Z" }, + { url = "https://files.pythonhosted.org/packages/8e/45/fbad9c7f5e2f1745c373a434d46072bc84eddfefaa28b852425ac957fda6/pillow-13.0.0-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:44629d4498c9cb6b2051806155f22141df0d8a929c56134b166655232dfb2f8c", size = 4190721, upload-time = "2026-10-16T22:16:27.524Z" }, + { url = "https://files.pythonhosted.org/packages/a2/bf/2074902a259a90692c5dbf132885d21671644cbbd3f690047516243a55db/pillow-13.0.0-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:bf97ba1b5542050e9b0c74e632323b6d8136cc99d64e193abebee22fe6013c76", size = 4290236, upload-time = "2026-10-16T22:16:29.562Z" }, + { url = "https://files.pythonhosted.org/packages/ff/a5/3d1bb93b8ea38d15d21356c1b8e9f50971ac592aaa248f7fb71739094c0e/pillow-13.0.0-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:aa694c49787040943570d61c9b8fc01271bd2a2cfdd55f0d896f8aecdce1a981", size = 3723093, upload-time = "2026-10-16T22:16:31.249Z" }, + { url = "https://files.pythonhosted.org/packages/84/a1/be060135d85187b25fa8b2573786c0e45c62ae27527fff5257675eb97f4a/pillow-13.0.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:49c12af515073e9bf511e4ef736743bf70d531a643668722279314b937742ba4", size = 5572253, upload-time = "2026-10-16T22:16:33.103Z" }, + { url = "https://files.pythonhosted.org/packages/b5/f4/0bf6f1ac9ba7ee2ffe9914aeb410a1035a0c1a3c42f122388d7fc950bc4b/pillow-13.0.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:d9b0a2bee3f3e03e9f29057aedb807dbf1e1d96ee1b9d0f422d9db6c8583271d", size = 4852269, upload-time = "2026-10-16T22:16:35.102Z" }, + { url = "https://files.pythonhosted.org/packages/83/16/b603274617b3e6728da3a0133d4fba1ea8d7fbe0c4ea5fef9cbffa398b8b/pillow-13.0.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5933fcea5a5ba64c686f55c886a115cbfd92f2900460784a1e79909fdbafd7b6", size = 6516058, upload-time = "2026-10-16T22:16:37.228Z" }, + { url = "https://files.pythonhosted.org/packages/1d/f2/1371707ce438ba9a43f9d24089828494ec6f9396e28cd7903aa704dd6306/pillow-13.0.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e91c2b1cbeae768c98752e67e717e283d68dae45717b41f2d91eaee648e37b7d", size = 7142574, upload-time = "2026-10-16T22:16:39.172Z" }, + { url = "https://files.pythonhosted.org/packages/b9/a9/62cf68587f910bc87c5951bcb6e9430c7643a65076adf5f18b4bf350e2bd/pillow-13.0.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7f6299e494e46253d40c34653cac369412f44ca53b5f85d848d3f95b1ed0546c", size = 6614295, upload-time = "2026-10-16T22:16:41.117Z" }, + { url = "https://files.pythonhosted.org/packages/6c/c9/9e9b48178649730299be0bafbf5f810a5b6977538f5a92d47e4ba5f5d608/pillow-13.0.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:f9bd7d260d986f3553518c5d723544346fa48031f8aef3265d786aeb59845bc0", size = 7224841, upload-time = "2026-10-16T22:16:43.118Z" }, + { url = "https://files.pythonhosted.org/packages/8f/48/c44e91384b1b6c072a714a63d00608acc16a6a968735e478e4be4384e5ac/pillow-13.0.0-cp314-cp314-win32.whl", hash = "sha256:2e31c4e68cffd7b1f116127626813b82fcba19edf6b940a7b0c266d6484d0055", size = 6508694, upload-time = "2026-10-16T22:16:45.883Z" }, + { url = "https://files.pythonhosted.org/packages/50/e2/7ad17747517e4c813dca78257d6bb593466f8231baf1384bc98d92745edb/pillow-13.0.0-cp314-cp314-win_amd64.whl", hash = "sha256:f7cbb7a64e7ec664775195e4f81923bc8a93d9451b963f844e59118f63147a7a", size = 7281830, upload-time = "2026-10-16T22:16:47.725Z" }, + { url = "https://files.pythonhosted.org/packages/41/9f/e5b51f2ce8ef4563215334035403ce61a244f93a2e65c24a940131618f87/pillow-13.0.0-cp314-cp314-win_arm64.whl", hash = "sha256:a6aaa7871aebca081eb5c45f83e845bbd9712ae99fa9286dbfdcee835e63f4b4", size = 2695468, upload-time = "2026-10-16T22:16:49.515Z" }, + { url = "https://files.pythonhosted.org/packages/97/73/a53502f731f6c84805a4ce87a8881e86d07a65aee64728b900d112dc703e/pillow-13.0.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:7b999816b5850a35ada08443e6e03945f1f6488144a83afe2d37b240a552aafa", size = 5578196, upload-time = "2026-10-16T22:16:51.291Z" }, + { url = "https://files.pythonhosted.org/packages/21/50/7e949959a56b5559c78ef172b70fc6025706acb289f3f648a15329e4fa6f/pillow-13.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:67871a13cf47275201553b536c025da777f997fa562a19eb798af4ad4b97c18f", size = 4857276, upload-time = "2026-10-16T22:16:53.399Z" }, + { url = "https://files.pythonhosted.org/packages/c9/52/43ded0ac08e77e39d17bd6d894162572201b5e8fdc4a022b14c55a1960a4/pillow-13.0.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e8ca8f69b7c77fa96dad99f8638c1fc4f1c0bed4acaa1baf7a3c31bdb80a0ab1", size = 6607008, upload-time = "2026-10-16T22:16:55.525Z" }, + { url = "https://files.pythonhosted.org/packages/0d/2e/4a57ed216d5bf877387cba4d44c02aa87abe51ad2e06404aa6b597c4da39/pillow-13.0.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6bce6a29c3898191f4c9998e4d4e8f69790caeabde46e54da4bc235ce5bde683", size = 7224281, upload-time = "2026-10-16T22:16:57.738Z" }, + { url = "https://files.pythonhosted.org/packages/5c/3d/2929b248e135752d63aaeabf53f6de797e905b7b6263f9c1e2adade20aba/pillow-13.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:816752a5ef76a80484c8c441c85593b7ea9304f6231fc5776ad1fbff7e773058", size = 6695600, upload-time = "2026-10-16T22:16:59.842Z" }, + { url = "https://files.pythonhosted.org/packages/bc/33/fb0da992cf084ed1ee6ee05e96b6191e35c351eb707ca2df874feb24ce47/pillow-13.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5bdb38ba220b61b4ec31dd1046dea6b016d3c6850a23f43ed8b58332b2fc668e", size = 7300589, upload-time = "2026-10-16T22:17:01.686Z" }, + { url = "https://files.pythonhosted.org/packages/bb/af/c30dd9ef6a3dce84ecb1b2393cac629047a32e66279056c6cb46c3ffd65c/pillow-13.0.0-cp314-cp314t-win32.whl", hash = "sha256:06903aac074d00c988e77a1fc435286dc498506d4ca8d6f69df9babddf4ecc15", size = 6517204, upload-time = "2026-10-16T22:17:03.722Z" }, + { url = "https://files.pythonhosted.org/packages/85/d5/ef3a8ae7609c8ab26570abf18194882534b480d245a9148b895a2262c004/pillow-13.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:9a635068d9793c7f0d929f39f18b58f1bd86c236e8e7b64167b86af9232ebca0", size = 7286695, upload-time = "2026-10-16T22:17:05.543Z" }, + { url = "https://files.pythonhosted.org/packages/84/3c/0861db0c69a03689ebe3e7599d35668a414deb5aaafd8255215e4e62e3d3/pillow-13.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0d1a9cf7bc6917538b20f8d06b9ab2147e542f68849e96fc58eb66bdf6acc692", size = 2698098, upload-time = "2026-10-16T22:17:07.674Z" }, + { url = "https://files.pythonhosted.org/packages/6e/eb/e86a41962a3a31ad495a3d6a912d9002b01bba4a6fa71c28703abdca7f69/pillow-13.0.0-cp315-cp315-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7d5e097eabd5d4915c27ac9f6e9325bb1e01a7c94d7348b5c4451d3fc30e8521", size = 4191213, upload-time = "2026-10-16T22:17:09.449Z" }, + { url = "https://files.pythonhosted.org/packages/dd/04/7e7445e706afec84ef06dc25b2c77f9cecff242c23730c62928ad1089d4a/pillow-13.0.0-cp315-cp315-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:51ebb529fc5e8abdd55302f6c3f8943037348ec2384329a3e55677f69ae2fdfc", size = 4290650, upload-time = "2026-10-16T22:17:11.196Z" }, + { url = "https://files.pythonhosted.org/packages/46/85/d534089068ac40c0f61f650389a296c812eab745a8a733f81feec39ae955/pillow-13.0.0-cp315-cp315-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:c87a04e7f152ee4db5dbe15f0bfa3fe628a1aeedbe66b81c43b87f52c813f9ac", size = 3723078, upload-time = "2026-10-16T22:17:12.772Z" }, + { url = "https://files.pythonhosted.org/packages/ce/2b/00b5c3b401df538b5dbe311d3899730fae5ba1e21cb8b80a128887ac6747/pillow-13.0.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:20722cd5375533ad754053363a80b8fb30c79d37930a6f7228030e237ce3bd5d", size = 5572292, upload-time = "2026-10-16T22:17:14.539Z" }, + { url = "https://files.pythonhosted.org/packages/72/f5/a6b0610f946e9b54ae888ba7ad29d6e2f8d9b11f69e212d70416b7186c09/pillow-13.0.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:04a63720f79e22fd54d897c233a68314c50ca0603360f54ce2bd5db8f0f43782", size = 4852222, upload-time = "2026-10-16T22:17:16.521Z" }, + { url = "https://files.pythonhosted.org/packages/1e/d0/c0ff25bb0427ec70f32aac995453321fc3c4494a46c7292ff02d9d260b04/pillow-13.0.0-cp315-cp315-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4f8db54177035a2b5f717f94475b74907e12a96dc74f6d487f3966b0a4694071", size = 6527349, upload-time = "2026-10-16T22:17:18.534Z" }, + { url = "https://files.pythonhosted.org/packages/85/11/e46fa0bcc0fc117f1eacc206b3d51f04d583fab328b4b740672d0438d83f/pillow-13.0.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8f36aa77f74b14a2103622b196402c71330e4e7cf4122ee45c854e9a01e0eecf", size = 7152873, upload-time = "2026-10-16T22:17:20.415Z" }, + { url = "https://files.pythonhosted.org/packages/7c/53/2bdeca705f3a58679fa9201233193c86a30238340ca29b3a152c3fcc719b/pillow-13.0.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:149a1c323ba366f90b48e6f1a6db6582eb50512df374588de56fc909abc0f0f3", size = 6626871, upload-time = "2026-10-16T22:17:22.361Z" }, + { url = "https://files.pythonhosted.org/packages/14/de/3829030f209722ade3753bb456b805a0e7f885cf885b483407365c82e9ca/pillow-13.0.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:e892354a424b1e82a78ba16785822bdd40de06f19446a3d4a28047df1a4f8932", size = 7236439, upload-time = "2026-10-16T22:17:24.352Z" }, + { url = "https://files.pythonhosted.org/packages/44/b1/67fc37388382bc036a74f04da5bb6fcbf90ec3ac1f45893e06176c373fd3/pillow-13.0.0-cp315-cp315-win32.whl", hash = "sha256:8e459b613cf31f8980f584387b4fe47bf08e076e288d61aa8eba1f7fd4ddbb81", size = 6508688, upload-time = "2026-10-16T22:17:26.314Z" }, + { url = "https://files.pythonhosted.org/packages/44/05/fdb6a79aee10861165526b41b7b440e36ee1ff58613b2fbefe3acbf06d4f/pillow-13.0.0-cp315-cp315-win_amd64.whl", hash = "sha256:d4737f50d23ddd11d6685faacbb9252887dde0bc7997127757247983d74399d6", size = 7281107, upload-time = "2026-10-16T22:17:28.198Z" }, + { url = "https://files.pythonhosted.org/packages/e6/9c/6c6f7dc2a566467baf121394e83de25ac287cffe34cc030726beb4be0224/pillow-13.0.0-cp315-cp315-win_arm64.whl", hash = "sha256:2310e2adfc13c6d457d7d0f2ffdd5c56a74a317650cf765887df8d515a647ac0", size = 2695513, upload-time = "2026-10-16T22:17:30.013Z" }, + { url = "https://files.pythonhosted.org/packages/23/16/e9120defdb8bff693b582d035312acc6f530cdc2bc5238a87f410efccd82/pillow-13.0.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:21c32061a5512dc13f87cc7303e120e4d77c2f70df89a35af0e3ce246e5ac57f", size = 5578129, upload-time = "2026-10-16T22:17:31.642Z" }, + { url = "https://files.pythonhosted.org/packages/47/22/76faf2bb2448f48a84cf894c1e2bb1090d7d2b1aa521ece131cb2f05d631/pillow-13.0.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:1c774b9c0ba0d0b356f71530677b39028878a2cae5a93e0a13779cfd17120f88", size = 4857428, upload-time = "2026-10-16T22:17:33.43Z" }, + { url = "https://files.pythonhosted.org/packages/b3/64/0861ea4e03c50b14af9ed9dd8b9f388ab42f445c623a9fcbab19aef7aa55/pillow-13.0.0-cp315-cp315t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:20822140c9a2ba9c5e42df342b0a892ab2e102fc0e3db967a133bb9ce3f898bb", size = 6612582, upload-time = "2026-10-16T22:17:35.415Z" }, + { url = "https://files.pythonhosted.org/packages/5c/20/cd1e9b3f60a9f3d5ebe46da36955c26004092a501f7f2c42f9fcc26611bc/pillow-13.0.0-cp315-cp315t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ffea6b2986a797c84b6d1d27d4f43e0b83c73fc16281a930891cd237cf0d08fe", size = 7230176, upload-time = "2026-10-16T22:17:37.362Z" }, + { url = "https://files.pythonhosted.org/packages/b6/ef/ffb0a2fc85690714fb7ac662956949645d57f15bf4426f520da361e7b6e3/pillow-13.0.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:05cd2cd39055d0b9650060e4513ef4a9a0aea870083950bd046a0d6490f93a22", size = 6703640, upload-time = "2026-10-16T22:17:39.313Z" }, + { url = "https://files.pythonhosted.org/packages/e0/c2/6402ee3ccb3363aeed8fdb3f9fe56703ac5377a539f0b81b53999d7e121f/pillow-13.0.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:c6fd031333dedcad7ce3e03d244093f43504f209e86925ebdb2b868fa4037630", size = 7309231, upload-time = "2026-10-16T22:17:41.021Z" }, + { url = "https://files.pythonhosted.org/packages/fc/96/d6b82e8b8c06ad143b66b12e0b31051e4bf489b4fabca1f390a14fe1ebde/pillow-13.0.0-cp315-cp315t-win32.whl", hash = "sha256:c50c80e3591e5cf9a8dfa6007d4f10732f02e32263850999286e56ccd650cfb2", size = 6517200, upload-time = "2026-10-16T22:17:42.886Z" }, + { url = "https://files.pythonhosted.org/packages/60/d4/0062e6005e9b270b165015aafd343364ac378ec5a685431ea42baad33357/pillow-13.0.0-cp315-cp315t-win_amd64.whl", hash = "sha256:adb3c2124c68e480f4632d06cb7caa3b48a51678475f483b4edb1c6dee29ea43", size = 7287488, upload-time = "2026-10-16T22:17:45.56Z" }, + { url = "https://files.pythonhosted.org/packages/e4/81/b8eb349746be7bce47dd95337c6634e84910af91b59aaa9159c034c614fa/pillow-13.0.0-cp315-cp315t-win_arm64.whl", hash = "sha256:4a25756244bdcce3b50580baadf320fa48297f0eeb8e114ba64139a40d4d0fc8", size = 2698073, upload-time = "2026-10-16T22:17:47.556Z" }, + { url = "https://files.pythonhosted.org/packages/60/da/f6d644e631c5b370c5d0b899f3ccadd2780aab070b29a110527cf4e1fd2c/pillow-13.0.0-pp312-pypy312_pp80-macosx_10_15_x86_64.whl", hash = "sha256:8619685cad8efc4c38c66d3b36aad854523297c43d748b3b6f0cc03c90ba3463", size = 5523188, upload-time = "2026-10-16T22:17:59.334Z" }, + { url = "https://files.pythonhosted.org/packages/e4/b0/2594f202d743a35d4fe80682bfd96f277e5ca7aecb27cf64ef5bfc1d000b/pillow-13.0.0-pp312-pypy312_pp80-macosx_11_0_arm64.whl", hash = "sha256:7e91e97a929232cdb828889ee6ad0e48d7f40f4ec38818f4e4a8968b2b1af22e", size = 4806808, upload-time = "2026-10-16T22:18:01.188Z" }, + { url = "https://files.pythonhosted.org/packages/8e/ed/d504165ef79af6fafe25c76726cf30f544cc236002f7ed054f1d51adc4ff/pillow-13.0.0-pp312-pypy312_pp80-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:93ff9c9c3663ce23aaa5d0b6b6abac55359e2a0c06c7e30f3771829af816be63", size = 5464358, upload-time = "2026-10-16T22:18:02.779Z" }, + { url = "https://files.pythonhosted.org/packages/7b/fe/a10aba5503ca13e9e009b8bd0a1a4ce5584bdce246245fd6f3a83701369c/pillow-13.0.0-pp312-pypy312_pp80-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e65dd6e75de67b2362a4fa3e16aa627595f65054dc4ec73d64680c84d592fa61", size = 6043514, upload-time = "2026-10-16T22:18:04.538Z" }, + { url = "https://files.pythonhosted.org/packages/c0/37/66b12dc476041fe523bca29c9d58fbf1ea92a4eaf73acfb9e993948f1191/pillow-13.0.0-pp312-pypy312_pp80-win_amd64.whl", hash = "sha256:567f20f1c75897d7663830da6ea8af719e03d712b1d9ee7f813319f9ece42e5a", size = 7366030, upload-time = "2026-10-16T22:18:06.638Z" }, ] [[package]]