diff options
| author | Brianna Rainey | 2026-01-29 16:30:43 -0500 |
|---|---|---|
| committer | Brianna Rainey | 2026-01-29 16:30:43 -0500 |
| commit | b283aa418a1c0016a63a328fec6259dfe110cefe (patch) | |
| tree | bfdc6f4700df9ffcf16f731a505217a153186aff | |
| parent | 71a22c6a121d1294a05ef35020c525fa70cae2fd (diff) | |
fix `settings.ini` not located in correct path
| -rw-r--r-- | .gitignore | 6 | ||||
| -rw-r--r-- | pyproject.toml | 2 | ||||
| -rw-r--r-- | src/avp/__init__.py | 2 | ||||
| -rw-r--r-- | src/avp/core.py | 21 | ||||
| -rw-r--r-- | tests/__init__.py | 2 | ||||
| -rw-r--r-- | tests/data/config/projects/testproject.avp (renamed from tests/data/projects/testproject.avp) | 6 | ||||
| -rw-r--r-- | tests/test_core_init.py | 13 | ||||
| -rw-r--r-- | tests/test_mainwindow_projects.py | 12 | ||||
| -rw-r--r-- | uv.lock | 2 |
9 files changed, 48 insertions, 18 deletions
| @@ -9,9 +9,9 @@ prof/ | |||
| 9 | .venv/ | 9 | .venv/ |
| 10 | .env/ | 10 | .env/ |
| 11 | .vscode/ | 11 | .vscode/ |
| 12 | tests/data/log/ | 12 | tests/data/config/log/ |
| 13 | tests/data/settings.ini | 13 | tests/data/config/settings.ini |
| 14 | tests/data/autosave.avp | 14 | tests/data/config/autosave.avp |
| 15 | *.mkv | 15 | *.mkv |
| 16 | *.mp4 | 16 | *.mp4 |
| 17 | *.wav | 17 | *.wav |
diff --git a/pyproject.toml b/pyproject.toml index ea27839..2d604f5 100644 --- a/pyproject.toml +++ b/pyproject.toml | |||
| @@ -6,7 +6,7 @@ build-backend = "uv_build" | |||
| 6 | name = "audio-visualizer-python" | 6 | name = "audio-visualizer-python" |
| 7 | description = "Create audio visualization videos from a GUI or commandline" | 7 | description = "Create audio visualization videos from a GUI or commandline" |
| 8 | readme = "README.md" | 8 | readme = "README.md" |
| 9 | version = "2.2.2" | 9 | version = "2.2.3" |
| 10 | requires-python = ">= 3.12" | 10 | requires-python = ">= 3.12" |
| 11 | license = "MIT" | 11 | license = "MIT" |
| 12 | classifiers=[ | 12 | classifiers=[ |
diff --git a/src/avp/__init__.py b/src/avp/__init__.py index 9de9f93..8783660 100644 --- a/src/avp/__init__.py +++ b/src/avp/__init__.py | |||
| @@ -3,7 +3,7 @@ import os | |||
| 3 | import logging | 3 | import logging |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | __version__ = "2.2.2" | 6 | __version__ = "2.2.3" |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | class Logger(logging.getLoggerClass()): | 9 | class Logger(logging.getLoggerClass()): |
diff --git a/src/avp/core.py b/src/avp/core.py index 1e9a9c3..347a5dd 100644 --- a/src/avp/core.py +++ b/src/avp/core.py | |||
| @@ -426,13 +426,7 @@ class Core: | |||
| 426 | from .toolkit.ffmpeg import findFfmpeg | 426 | from .toolkit.ffmpeg import findFfmpeg |
| 427 | 427 | ||
| 428 | cls.wd = wd | 428 | cls.wd = wd |
| 429 | dataDir = ( | 429 | dataDir = cls.getConfigPath(dataDir) |
| 430 | QtCore.QStandardPaths.writableLocation( | ||
| 431 | QtCore.QStandardPaths.StandardLocation.AppConfigLocation | ||
| 432 | ) | ||
| 433 | if dataDir is None | ||
| 434 | else dataDir | ||
| 435 | ) | ||
| 436 | # Windows: C:/Users/<USER>/AppData/Local/audio-visualizer | 430 | # Windows: C:/Users/<USER>/AppData/Local/audio-visualizer |
| 437 | # macOS: ~/Library/Preferences/audio-visualizer | 431 | # macOS: ~/Library/Preferences/audio-visualizer |
| 438 | # Linux: ~/.config/audio-visualizer | 432 | # Linux: ~/.config/audio-visualizer |
| @@ -593,3 +587,16 @@ class Core: | |||
| 593 | libLog.addHandler(libLogFile) | 587 | libLog.addHandler(libLogFile) |
| 594 | # lowest level must be explicitly set on the root Logger | 588 | # lowest level must be explicitly set on the root Logger |
| 595 | libLog.setLevel(0) | 589 | libLog.setLevel(0) |
| 590 | |||
| 591 | @staticmethod | ||
| 592 | def getConfigPath(dataDir=None): | ||
| 593 | return ( | ||
| 594 | os.path.join( | ||
| 595 | QtCore.QStandardPaths.writableLocation( | ||
| 596 | QtCore.QStandardPaths.StandardLocation.AppConfigLocation | ||
| 597 | ), | ||
| 598 | "audio-visualizer", | ||
| 599 | ) | ||
| 600 | if dataDir is None | ||
| 601 | else dataDir | ||
| 602 | ) | ||
diff --git a/tests/__init__.py b/tests/__init__.py index df08c7c..bb35f72 100644 --- a/tests/__init__.py +++ b/tests/__init__.py | |||
| @@ -43,7 +43,7 @@ def getTestDataPath(filename=""): | |||
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | def initCore(): | 45 | def initCore(): |
| 46 | testDataDir = getTestDataPath() | 46 | testDataDir = getTestDataPath("config") |
| 47 | unwanted = ["autosave.avp", "settings.ini"] | 47 | unwanted = ["autosave.avp", "settings.ini"] |
| 48 | for file in unwanted: | 48 | for file in unwanted: |
| 49 | filename = os.path.join(testDataDir, "autosave.avp") | 49 | filename = os.path.join(testDataDir, "autosave.avp") |
diff --git a/tests/data/projects/testproject.avp b/tests/data/config/projects/testproject.avp index fd6b6eb..9639716 100644 --- a/tests/data/projects/testproject.avp +++ b/tests/data/config/projects/testproject.avp | |||
| @@ -9,9 +9,9 @@ OrderedDict({'LG_end': 0.0, 'LG_start': 0.0, 'RG_centre': 0.0015625, 'RG_end': 0 | |||
| 9 | [Settings] | 9 | [Settings] |
| 10 | componentDir=tests/data/inputfiles | 10 | componentDir=tests/data/inputfiles |
| 11 | inputDir=tests/data/inputfiles | 11 | inputDir=tests/data/inputfiles |
| 12 | presetDir=tests/data/presets | 12 | presetDir=tests/data/config/presets |
| 13 | projectDir=tests/data/projects | 13 | projectDir=tests/data/config/projects |
| 14 | 14 | ||
| 15 | [WindowFields] | 15 | [WindowFields] |
| 16 | lineEdit_audioFile=tests/data/test.ogg | 16 | lineEdit_audioFile=tests/data/inputfiles/test.ogg |
| 17 | lineEdit_outputFile= | 17 | lineEdit_outputFile= |
diff --git a/tests/test_core_init.py b/tests/test_core_init.py index 16606fb..e1f2dbb 100644 --- a/tests/test_core_init.py +++ b/tests/test_core_init.py | |||
| @@ -1,7 +1,10 @@ | |||
| 1 | import os | ||
| 1 | from avp.core import Core | 2 | from avp.core import Core |
| 3 | from . import getTestDataPath, initCore | ||
| 2 | 4 | ||
| 3 | 5 | ||
| 4 | def test_component_names(): | 6 | def test_component_names(): |
| 7 | initCore() | ||
| 5 | core = Core() | 8 | core = Core() |
| 6 | assert core.compNames == [ | 9 | assert core.compNames == [ |
| 7 | "Classic Visualizer", | 10 | "Classic Visualizer", |
| @@ -17,5 +20,15 @@ def test_component_names(): | |||
| 17 | 20 | ||
| 18 | 21 | ||
| 19 | def test_moduleindex(): | 22 | def test_moduleindex(): |
| 23 | initCore() | ||
| 20 | core = Core() | 24 | core = Core() |
| 21 | assert core.moduleIndexFor("Classic Visualizer") == 0 | 25 | assert core.moduleIndexFor("Classic Visualizer") == 0 |
| 26 | |||
| 27 | |||
| 28 | def test_configPath_default(): | ||
| 29 | configPath = Core.getConfigPath(None) | ||
| 30 | assert os.path.basename(configPath) == "audio-visualizer" | ||
| 31 | |||
| 32 | |||
| 33 | def test_configPath_nonstandard(): | ||
| 34 | assert Core.getConfigPath(getTestDataPath("config")) == getTestDataPath("config") | ||
diff --git a/tests/test_mainwindow_projects.py b/tests/test_mainwindow_projects.py index 8ad491a..6b49799 100644 --- a/tests/test_mainwindow_projects.py +++ b/tests/test_mainwindow_projects.py | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | from PyQt6 import QtCore | ||
| 2 | import os | ||
| 1 | from pytest import fixture | 3 | from pytest import fixture |
| 2 | from pytestqt import qtbot | 4 | from pytestqt import qtbot |
| 3 | from . import getTestDataPath, window | 5 | from . import getTestDataPath, window |
| @@ -8,9 +10,17 @@ def test_mainwindow_clear(qtbot, window): | |||
| 8 | assert len(window.core.selectedComponents) == 0 | 10 | assert len(window.core.selectedComponents) == 0 |
| 9 | 11 | ||
| 10 | 12 | ||
| 13 | def test_mainwindow_presetDir_in_tests(qtbot, window): | ||
| 14 | # FIXME presetDir gets set to projectDir for some reason | ||
| 15 | assert ( | ||
| 16 | os.path.basename(os.path.dirname(window.core.settings.value("presetDir"))) | ||
| 17 | == "config" | ||
| 18 | ) | ||
| 19 | |||
| 20 | |||
| 11 | def test_mainwindow_openProject(qtbot, window): | 21 | def test_mainwindow_openProject(qtbot, window): |
| 12 | """Open testproject.avp using MainWindow.openProject()""" | 22 | """Open testproject.avp using MainWindow.openProject()""" |
| 13 | window.openProject(getTestDataPath("projects/testproject.avp"), prompt=False) | 23 | window.openProject(getTestDataPath("config/projects/testproject.avp"), prompt=False) |
| 14 | assert len(window.core.selectedComponents) == 2 | 24 | assert len(window.core.selectedComponents) == 2 |
| 15 | 25 | ||
| 16 | 26 | ||
| @@ -4,7 +4,7 @@ requires-python = ">=3.12" | |||
| 4 | 4 | ||
| 5 | [[package]] | 5 | [[package]] |
| 6 | name = "audio-visualizer-python" | 6 | name = "audio-visualizer-python" |
| 7 | version = "2.2.2" | 7 | version = "2.2.3" |
| 8 | source = { editable = "." } | 8 | source = { editable = "." } |
| 9 | dependencies = [ | 9 | dependencies = [ |
| 10 | { name = "numpy" }, | 10 | { name = "numpy" }, |
