diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..88fc4f3 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include vocalinux.desktop +include resources/icons/scalable/*.svg +include resources/sounds/*.wav +recursive-include src/vocalinux/resources * diff --git a/install.sh b/install.sh index dbada3d..6712803 100755 --- a/install.sh +++ b/install.sh @@ -2548,12 +2548,58 @@ update_icon_cache() { fi } +# Function to install resources (icons, sounds) to the virtual environment +# so the resource_manager can find them at runtime +install_resources_to_venv() { + print_info "Installing resources to virtual environment..." + + # Target directory: $VENV_DIR/share/vocalinux/resources + local VENV_RESOURCES_DIR="$VENV_DIR/share/vocalinux/resources" + + # Create directories + mkdir -p "$VENV_RESOURCES_DIR/icons/scalable" || { + print_warning "Failed to create venv resources directory" + return 1 + } + mkdir -p "$VENV_RESOURCES_DIR/sounds" || { + print_warning "Failed to create venv sounds directory" + return 1 + } + + # Copy icons if available + if [ -d "resources/icons/scalable" ]; then + cp resources/icons/scalable/*.svg "$VENV_RESOURCES_DIR/icons/scalable/" 2>/dev/null || { + print_warning "Failed to copy icons to venv resources" + } + fi + + # Copy sounds if available + if [ -d "resources/sounds" ]; then + cp resources/sounds/*.wav "$VENV_RESOURCES_DIR/sounds/" 2>/dev/null || { + print_warning "Failed to copy sounds to venv resources" + } + fi + + # Verify + local ICON_COUNT=$(ls "$VENV_RESOURCES_DIR/icons/scalable/"*.svg 2>/dev/null | wc -l) + local SOUND_COUNT=$(ls "$VENV_RESOURCES_DIR/sounds/"*.wav 2>/dev/null | wc -l) + + if [ "$ICON_COUNT" -gt 0 ] && [ "$SOUND_COUNT" -gt 0 ]; then + print_success "Installed resources to venv ($ICON_COUNT icons, $SOUND_COUNT sounds)" + else + print_warning "Some resources may be missing from venv ($ICON_COUNT icons, $SOUND_COUNT sounds)" + fi +} + # Install desktop entry install_desktop_entry || print_warning "Desktop entry installation failed" # Install icons install_icons || print_warning "Icon installation failed" +# Install resources to venv for runtime discovery +install_resources_to_venv || print_warning "Venv resource installation failed" + # Install models based on selected engine # whisper.cpp is now the default engine if [ "$SKIP_MODELS" = "no" ]; then diff --git a/pyproject.toml b/pyproject.toml index 59b3ab7..d5ea30e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,7 +87,7 @@ Issues = "https://github.com/jatinkrmalik/vocalinux/issues" Changelog = "https://github.com/jatinkrmalik/vocalinux/releases" [tool.setuptools] -packages = ["vocalinux", "vocalinux.speech_recognition", "vocalinux.text_injection", "vocalinux.ui", "vocalinux.ui.keyboard_backends", "vocalinux.utils"] +packages = ["vocalinux", "vocalinux.resources", "vocalinux.speech_recognition", "vocalinux.text_injection", "vocalinux.ui", "vocalinux.ui.keyboard_backends", "vocalinux.utils"] package-dir = {"" = "src"} [tool.setuptools.dynamic] @@ -95,6 +95,7 @@ version = {attr = "vocalinux.version.__version__"} [tool.setuptools.package-data] "*" = ["*.svg", "*.wav"] +"vocalinux" = ["resources/**/*"] [tool.black] line-length = 100 diff --git a/src/vocalinux/resources/__init__.py b/src/vocalinux/resources/__init__.py new file mode 100644 index 0000000..edc7523 --- /dev/null +++ b/src/vocalinux/resources/__init__.py @@ -0,0 +1 @@ +"""Bundled resources (icons, sounds) for Vocalinux.""" diff --git a/src/vocalinux/resources/icons/scalable/vocalinux-microphone-off.svg b/src/vocalinux/resources/icons/scalable/vocalinux-microphone-off.svg new file mode 100644 index 0000000..a5f8b2f --- /dev/null +++ b/src/vocalinux/resources/icons/scalable/vocalinux-microphone-off.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/vocalinux/resources/icons/scalable/vocalinux-microphone-process.svg b/src/vocalinux/resources/icons/scalable/vocalinux-microphone-process.svg new file mode 100644 index 0000000..6fa2d08 --- /dev/null +++ b/src/vocalinux/resources/icons/scalable/vocalinux-microphone-process.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/vocalinux/resources/icons/scalable/vocalinux-microphone.svg b/src/vocalinux/resources/icons/scalable/vocalinux-microphone.svg new file mode 100644 index 0000000..a3f86d0 --- /dev/null +++ b/src/vocalinux/resources/icons/scalable/vocalinux-microphone.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/vocalinux/resources/icons/scalable/vocalinux.svg b/src/vocalinux/resources/icons/scalable/vocalinux.svg new file mode 100644 index 0000000..e6d7765 --- /dev/null +++ b/src/vocalinux/resources/icons/scalable/vocalinux.svg @@ -0,0 +1,5873 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/vocalinux/resources/sounds/error.wav b/src/vocalinux/resources/sounds/error.wav new file mode 100644 index 0000000..0a1186f Binary files /dev/null and b/src/vocalinux/resources/sounds/error.wav differ diff --git a/src/vocalinux/resources/sounds/start_recording.wav b/src/vocalinux/resources/sounds/start_recording.wav new file mode 100644 index 0000000..c592bf7 Binary files /dev/null and b/src/vocalinux/resources/sounds/start_recording.wav differ diff --git a/src/vocalinux/resources/sounds/stop_recording.wav b/src/vocalinux/resources/sounds/stop_recording.wav new file mode 100644 index 0000000..ce834f9 Binary files /dev/null and b/src/vocalinux/resources/sounds/stop_recording.wav differ diff --git a/src/vocalinux/utils/resource_manager.py b/src/vocalinux/utils/resource_manager.py index cc0c3cc..1baf13a 100644 --- a/src/vocalinux/utils/resource_manager.py +++ b/src/vocalinux/utils/resource_manager.py @@ -49,9 +49,12 @@ class ResourceManager: # Build list of candidate paths in priority order candidates = [ + # Resources bundled inside the installed package (pip install) + # This resolves to src/vocalinux/resources when installed + module_dir.parent / "resources", # For direct repository execution (go up from src/vocalinux/utils to root) module_dir.parent.parent.parent / "resources", - # For installed package or virtual environment + # For installed package or virtual environment (install.sh copies here) Path(sys.prefix) / "share" / "vocalinux" / "resources", # For development in virtual environment Path(sys.prefix).parent / "resources",